Skip to content

Commit

Permalink
Patching XPMEM kernel code for 4.11.0
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Shamis (Pasha) <[email protected]>
  • Loading branch information
shamisp committed Sep 20, 2017
1 parent c394a9d commit 5d45cb4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
16 changes: 15 additions & 1 deletion kernel/xpmem_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright 2010,2012 Cray Inc. All Rights Reserved
* Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright 2017 ARM, Inc. All Rights Reserved
*/

/*
Expand All @@ -20,6 +21,10 @@
#include "xpmem_internal.h"
#include "xpmem_private.h"

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#endif

static void
xpmem_open_handler(struct vm_area_struct *vma)
{
Expand Down Expand Up @@ -152,11 +157,20 @@ xpmem_close_handler(struct vm_area_struct *vma)
}

static int
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
xpmem_fault_handler(struct vm_fault *vmf)
#else
xpmem_fault_handler(struct vm_area_struct *vma, struct vm_fault *vmf)
#endif
{
int ret, att_locked = 0;
int seg_tg_mmap_sem_locked = 0, vma_verification_needed = 0;
u64 vaddr = (u64)(uintptr_t) vmf->virtual_address;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
u64 vaddr = (u64)(uintptr_t) vmf->address;
struct vm_area_struct *vma = vmf->vma;
#else
u64 vaddr = (u64)(uintptr_t) vmf->virtual_address;
#endif
u64 seg_vaddr;
unsigned long pfn = 0, old_pfn = 0;
struct xpmem_thread_group *ap_tg, *seg_tg;
Expand Down
5 changes: 5 additions & 0 deletions kernel/xpmem_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
* Copyright 2010, 2014 Cray Inc. All Rights Reserved
* Copyright 2015-2016 Los Alamos National Security, LLC. All rights reserved.
* Copyright 2017 ARM, Inc. All rights reserved.
*/

/*
Expand Down Expand Up @@ -33,6 +34,10 @@
#include "xpmem_internal.h"
#include "xpmem_private.h"

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/task.h>
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
#define proc_set_user(_pde, _uid, _gid) \
do { \
Expand Down
5 changes: 5 additions & 0 deletions kernel/xpmem_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
* Copyright 2009, 2010, 2014 Cray Inc. All Rights Reserved
* Copyright 2017 ARM, Inc. All Rights Reserved
*/

/*
Expand All @@ -19,6 +20,10 @@
#include "xpmem_private.h"
#include <linux/module.h>

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/task.h>
#endif

uint32_t xpmem_debug_on = 0;

/*
Expand Down
11 changes: 9 additions & 2 deletions kernel/xpmem_pfn.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
* Copyright 2009, 2014 Cray Inc. All Rights Reserved
* Copyright 2016 ARM Inc. All Rights Reserved
* Copyright 2016-2017 ARM Inc. All Rights Reserved
* Copyright (c) 2016-2017 Nathan Hjelm <[email protected]>
*/

Expand All @@ -20,6 +20,10 @@
#include "xpmem_internal.h"
#include "xpmem_private.h"

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/signal.h>
#endif

/* #of pages rounded up that vaddr and size occupy */
#undef num_of_pages
#define num_of_pages(v, s) \
Expand Down Expand Up @@ -223,7 +227,10 @@ xpmem_pin_page(struct xpmem_thread_group *tg, struct task_struct *src_task,
}

/* get_user_pages() faults and pins the page */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
ret = get_user_pages_remote (src_task, src_mm, vaddr, 1, FOLL_WRITE | FOLL_FORCE,
&page, NULL, NULL);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
ret = get_user_pages_remote (src_task, src_mm, vaddr, 1, FOLL_WRITE | FOLL_FORCE,
&page, NULL);
#else
Expand Down

0 comments on commit 5d45cb4

Please sign in to comment.