diff --git a/AUTHORS b/AUTHORS index 5ec20a0..1133c74 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,3 @@ Cray Inc. + +Tony Curtis diff --git a/dkms.conf b/dkms.conf index 38100db..16519f8 100644 --- a/dkms.conf +++ b/dkms.conf @@ -4,19 +4,19 @@ # DKMS module name and version PACKAGE_NAME="xpmem" -PACKAGE_VERSION="2.6.5" +PACKAGE_VERSION="2.6.6" # module name BUILT_MODULE_NAME[0]="xpmem" # where we find the .ko file under the build directory BUILT_MODULE_LOCATION[0]="kernel" # where we put it under the kernel modules directory -DEST_MODULE_LOCATION[0]="/kernel/../updates/" +DEST_MODULE_LOCATION[0]="/kernel/../extra/" # how to build it -MAKE[0]="./configure --prefix=/opt/xpmem; make clean; make install" +MAKE[0]="./autogen.sh && ./configure --with-kernelvers=${kernelver} --prefix=/opt/xpmem && make -j3 install && rm -f /etc/udev/rules.d/56-xpmem.rules && install -c -m 644 56-xpmem.rules /etc/udev/rules.d/" # clean up command -CLEAN="make distclean" +CLEAN="make clean" # rebuild and autoinstall automatically when dkms_autoinstaller runs # for a new kernel diff --git a/kernel/xpmem_attach.c b/kernel/xpmem_attach.c index 26ec933..a52b1be 100644 --- a/kernel/xpmem_attach.c +++ b/kernel/xpmem_attach.c @@ -10,6 +10,7 @@ * Copyright (c) 2019 Google, LLC. All rights reserved. * Copyright (c) 2019 Nathan Hjelm. All rights reserved. * Copyright 2017 ARM, Inc. All Rights Reserved + * Copyright 2019 Stony Brook University. All Rights Reserved */ /* @@ -414,7 +415,7 @@ xpmem_attach(struct file *file, xpmem_apid_t apid, off_t offset, size_t size, return -EINVAL; /* If the size is not page aligned, fix it */ - if (offset_in_page(size) != 0) + if (offset_in_page(size) != 0) size += PAGE_SIZE - offset_in_page(size); ap_tg = xpmem_tg_ref_by_apid(apid); @@ -764,8 +765,11 @@ xpmem_clear_PTEs_of_att(struct xpmem_attachment *att, u64 start, u64 end, u64 invalidate_start, invalidate_end, invalidate_len; u64 offset_start, offset_end, unpin_at; u64 att_vaddr_end = att->vaddr + att->at_size; +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4, 17, 0) + int ret; +#endif - /* + /* * SOURCE [ PG 0 | PG 1 | PG 2 | PG 3 | PG 4 | ... ] * ^ ^ * | | @@ -821,7 +825,13 @@ xpmem_clear_PTEs_of_att(struct xpmem_attachment *att, u64 start, u64 end, /* NTH: is this a viable alternative to zap_page_range(). The * benefit of zap_vma_ptes is that it is exported by default. */ +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4, 17, 0) + ret = zap_vma_ptes (vma, unpin_at, invalidate_len); + + XPMEM_DEBUG("zap_vma_ptes returned %d", ret); +#else (void) zap_vma_ptes (vma, unpin_at, invalidate_len); +#endif /* Only clear the flag if all pages were zapped */ if (offset_start == 0 && att->at_size == invalidate_len) diff --git a/kernel/xpmem_main.c b/kernel/xpmem_main.c index 8fe24f0..b552730 100644 --- a/kernel/xpmem_main.c +++ b/kernel/xpmem_main.c @@ -490,6 +490,6 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Silicon Graphics, Inc."); MODULE_INFO(supported, "external"); MODULE_DESCRIPTION("XPMEM support"); -MODULE_VERSION("2.6.5"); +MODULE_VERSION("2.6.6"); module_init(xpmem_init); module_exit(xpmem_exit); diff --git a/kernel/xpmem_misc.c b/kernel/xpmem_misc.c index a2099b8..9b46661 100644 --- a/kernel/xpmem_misc.c +++ b/kernel/xpmem_misc.c @@ -290,11 +290,11 @@ xpmem_debug_printk_procfs_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { char buf; - + if(copy_from_user(&buf, buffer, 1)) return -EFAULT; - if (buf == '0') + if (buf == '0') xpmem_debug_on = 0; else if (buf == '1') xpmem_debug_on = 1; @@ -315,6 +315,15 @@ xpmem_debug_printk_procfs_open(struct inode *inode, struct file *file) return single_open(file, xpmem_debug_printk_procfs_show, NULL); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) +struct proc_ops xpmem_debug_printk_procfs_ops = { + .proc_lseek = seq_lseek, + .proc_read = seq_read, + .proc_write = xpmem_debug_printk_procfs_write, + .proc_open = xpmem_debug_printk_procfs_open, + .proc_release = single_release, +}; +#else struct file_operations xpmem_debug_printk_procfs_ops = { .owner = THIS_MODULE, .llseek = seq_lseek, @@ -323,3 +332,4 @@ struct file_operations xpmem_debug_printk_procfs_ops = { .open = xpmem_debug_printk_procfs_open, .release = single_release, }; +#endif /* kernel 5.6 */ diff --git a/kernel/xpmem_mmu_notifier.c b/kernel/xpmem_mmu_notifier.c index d2ed601..8f731d7 100644 --- a/kernel/xpmem_mmu_notifier.c +++ b/kernel/xpmem_mmu_notifier.c @@ -5,6 +5,7 @@ * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 Nathan Hjelm + * Copyright (c) 2019 Stony Brook University. All Rights Reserved * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive for @@ -65,19 +66,19 @@ xpmem_invalidate_PTEs_range(struct xpmem_thread_group *seg_tg, * XPMEM only uses the invalidate_range_end() portion. That is, when all pages * in the range have been unmapped and the pages have been freed by the VM. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) -static void -xpmem_invalidate_range(struct mmu_notifier *mn, struct mm_struct *mm, - unsigned long start, unsigned long end) -{ -#else static void +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) xpmem_invalidate_range(struct mmu_notifier *mn, - const struct mmu_notifier_range *mnr) + const struct mmu_notifier_range *rp) +#else +xpmem_invalidate_range(struct mmu_notifier *mn, struct mm_struct *mm, + unsigned long start, unsigned long end) +#endif { - struct mm_struct *mm = mnr->mm; - unsigned long start = mnr->start; - unsigned long end = mnr->end; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) + unsigned long start = rp->start; + unsigned long end = rp->end; + struct mm_struct *mm = rp->mm; #endif struct xpmem_thread_group *seg_tg; struct vm_area_struct *vma; diff --git a/kernel/xpmem_pfn.c b/kernel/xpmem_pfn.c index d06961c..3b96768 100644 --- a/kernel/xpmem_pfn.c +++ b/kernel/xpmem_pfn.c @@ -621,6 +621,15 @@ xpmem_unpin_procfs_open(struct inode *inode, struct file *file) return single_open(file, xpmem_unpin_procfs_show, PDE_DATA(inode)); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) +struct proc_ops xpmem_unpin_procfs_ops = { + .proc_lseek = seq_lseek, + .proc_read = seq_read, + .proc_write = xpmem_unpin_procfs_write, + .proc_open = xpmem_unpin_procfs_open, + .proc_release = single_release, +}; +#else struct file_operations xpmem_unpin_procfs_ops = { .owner = THIS_MODULE, .llseek = seq_lseek, @@ -629,3 +638,5 @@ struct file_operations xpmem_unpin_procfs_ops = { .open = xpmem_unpin_procfs_open, .release = single_release, }; +#endif /* kernel 5.6 */ + diff --git a/kernel/xpmem_private.h b/kernel/xpmem_private.h index 7db3cc4..fe8a76a 100644 --- a/kernel/xpmem_private.h +++ b/kernel/xpmem_private.h @@ -69,8 +69,8 @@ * major - major revision number (12-bits) * minor - minor revision number (16-bits) */ -#define XPMEM_CURRENT_VERSION 0x00026005 -#define XPMEM_CURRENT_VERSION_STRING "2.6.5" +#define XPMEM_CURRENT_VERSION 0x00026006 +#define XPMEM_CURRENT_VERSION_STRING "2.6.6" #define XPMEM_MODULE_NAME "xpmem" @@ -296,7 +296,12 @@ extern int xpmem_fork_end(void); #define XPMEM_TGID_STRING_LEN 11 extern spinlock_t xpmem_unpin_procfs_lock; extern struct proc_dir_entry *xpmem_unpin_procfs_dir; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) +extern struct proc_ops xpmem_unpin_procfs_ops; +#else extern struct file_operations xpmem_unpin_procfs_ops; +#endif /* kernel 5.6 */ /* found in xpmem_main.c */ extern struct xpmem_partition *xpmem_my_part; @@ -339,7 +344,13 @@ extern int xpmem_seg_down_read(struct xpmem_thread_group *, struct xpmem_segment *, int, int); extern int xpmem_validate_access(struct xpmem_access_permit *, off_t, size_t, int, u64 *); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) +extern struct proc_ops xpmem_debug_printk_procfs_ops; +#else extern struct file_operations xpmem_debug_printk_procfs_ops; +#endif /* kernel 5.6 */ + /* found in xpmem_mmu_notifier.c */ extern int xpmem_mmu_notifier_init(struct xpmem_thread_group *); extern void xpmem_mmu_notifier_unlink(struct xpmem_thread_group *); diff --git a/xpmem-kmod.spec b/xpmem-kmod.spec index a1acbc8..f1e4020 100644 --- a/xpmem-kmod.spec +++ b/xpmem-kmod.spec @@ -7,7 +7,7 @@ Summary: XPMEM: Cross-partition memory Name: xpmem-kmod-%{kernel_release} -Version: 2.6.5 +Version: 2.6.6 Release: 0 License: GPLv2 Group: System Environment/Kernel