From: Gleb C. <lna...@ya...> - 2023-07-10 07:36:13
|
Commit: a62b094 GitHub URL: https://github.com/SCST-project/scst/commit/a62b094f4fea3006497c025927575ed35d1e2829 Author: Gleb Chesnokov Date: 2023-07-10T10:34:57+03:00 Log Message: ----------- scst_user: Port to Linux kernel v6.5 Support for the following mm layer changes in the Linux kernel v6.5: - 54d020692b34 ("mm/gup: remove unused vmas parameter from get_user_pages()") Modified Paths: -------------- scst/include/backport.h | 73 ++++++--------- scst/src/dev_handlers/scst_user.c | 4 +- 2 files changed, 33 insertions(+), 44 deletions(-) =================================================================== diff --git a/scst/include/backport.h b/scst/include/backport.h index dd784cf..709a88f 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -572,60 +572,49 @@ static inline u32 int_sqrt64(u64 x) } #endif -#if LINUX_VERSION_CODE >> 8 == KERNEL_VERSION(4, 4, 0) >> 8 && \ - LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 168) -/* - * See also commit 8e50b8b07f46 ("mm: replace get_user_pages() write/force - * parameters with gup_flags") # v4.4.168. - */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0) static inline long get_user_pages_backport(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, - struct page **pages, - struct vm_area_struct **vmas) + struct page **pages) { +#if LINUX_VERSION_CODE >> 8 == KERNEL_VERSION(4, 4, 0) >> 8 && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 168) + /* + * See also commit 8e50b8b07f46 ("mm: replace get_user_pages() write/force + * parameters with gup_flags") # v4.4.168. + */ return get_user_pages(current, current->mm, start, nr_pages, gup_flags, - pages, vmas); -} -#define get_user_pages get_user_pages_backport -#elif !defined(CONFIG_SUSE_KERNEL) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) -/* - * See also commit cde70140fed8 ("mm/gup: Overload get_user_pages() functions") - * # v4.6. - */ -static inline long get_user_pages_backport(unsigned long start, - unsigned long nr_pages, - unsigned int gup_flags, - struct page **pages, - struct vm_area_struct **vmas) -{ - const bool write = gup_flags & FOLL_WRITE; - const bool force = 0; - - WARN_ON_ONCE(gup_flags & ~FOLL_WRITE); - return get_user_pages(current, current->mm, start, nr_pages, write, - force, pages, vmas); -} -#define get_user_pages get_user_pages_backport + pages, NULL); #elif (!defined(CONFIG_SUSE_KERNEL) && \ LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) || \ LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) -/* - * See also commit 768ae309a961 ("mm: replace get_user_pages() write/force - * parameters with gup_flags") # v4.9. - */ -static inline long get_user_pages_backport(unsigned long start, - unsigned long nr_pages, - unsigned int gup_flags, - struct page **pages, - struct vm_area_struct **vmas) -{ const bool write = gup_flags & FOLL_WRITE; const bool force = 0; WARN_ON_ONCE(gup_flags & ~FOLL_WRITE); - return get_user_pages(start, nr_pages, write, force, pages, vmas); +#if !defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) + /* + * See also commit cde70140fed8 ("mm/gup: Overload get_user_pages() functions") + * # v4.6. + */ + return get_user_pages(current, current->mm, start, nr_pages, write, + force, pages, NULL); +#else + /* + * See also commit 768ae309a961 ("mm: replace get_user_pages() write/force + * parameters with gup_flags") # v4.9. + */ + return get_user_pages(start, nr_pages, write, force, pages, NULL); +#endif +#else + /* + * See also commit 54d020692b34 ("mm/gup: remove unused vmas parameter from + * get_user_pages()") # v6.5. + */ + return get_user_pages(start, nr_pages, gup_flags, pages, NULL); +#endif } #define get_user_pages get_user_pages_backport #endif diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index e66a410..10ace41 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -1261,12 +1261,12 @@ static int dev_user_map_buf(struct scst_user_cmd *ucmd, unsigned long ubuff, #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0) down_read(&tsk->mm->mmap_sem); rc = get_user_pages(ubuff, ucmd->num_data_pages, FOLL_WRITE, - ucmd->data_pages, NULL); + ucmd->data_pages); up_read(&tsk->mm->mmap_sem); #else mmap_read_lock(tsk->mm); rc = get_user_pages(ubuff, ucmd->num_data_pages, FOLL_WRITE, - ucmd->data_pages, NULL); + ucmd->data_pages); mmap_read_unlock(tsk->mm); #endif |