mm: convert return type of handle_mm_fault() caller to vm_fault_t
Subsystems (25)
PATCH 1/1 mm: convert return type of handle_mm_fault() caller to vm_fault_t
Use new return type vm_fault_t for fault handler. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type.
Ref-> commit 1c8f422059ae ("mm: change return type to vm_fault_t")
In this patch all the caller of handle_mm_fault() are changed to return vm_fault_t type.
--- arch/alpha/mm/fault.c | 3 ++- arch/arc/mm/fault.c | 4 +++- arch/arm/mm/fault.c | 7 ++++--- arch/arm64/mm/fault.c | 6 +++--- arch/hexagon/mm/vm_fault.c | 2 +- arch/ia64/mm/fault.c | 2 +- arch/m68k/mm/fault.c | 4 ++-- arch/microblaze/mm/fault.c | 2 +- arch/mips/mm/fault.c | 2 +- arch/nds32/mm/fault.c | 2 +- arch/nios2/mm/fault.c | 2 +- arch/openrisc/mm/fault.c | 2 +- arch/parisc/mm/fault.c | 2 +- arch/powerpc/mm/copro_fault.c | 2 +- arch/powerpc/mm/fault.c | 7 ++++--- arch/riscv/mm/fault.c | 3 ++- arch/s390/mm/fault.c | 13 ++++++++----- arch/sh/mm/fault.c | 4 ++-- arch/sparc/mm/fault_32.c | 3 ++- arch/sparc/mm/fault_64.c | 3 ++- arch/um/kernel/trap.c | 2 +- arch/unicore32/mm/fault.c | 9 +++++---- arch/x86/mm/fault.c | 5 +++-- arch/xtensa/mm/fault.c | 2 +- drivers/iommu/amd_iommu_v2.c | 2 +- drivers/iommu/intel-svm.c | 4 +++- mm/hmm.c | 8 ++++---- mm/ksm.c | 2 +- 28 files changed, 62 insertions(+), 47 deletions(-)
arch/alpha/mm/fault.c +2 -1
@@ -87,7 +87,8 @@struct vm_area_struct * vma;struct mm_struct *mm = current->mm;const struct exception_table_entry *fixup; -int fault, si_code =SEGV_MAPERR ; +int si_code =SEGV_MAPERR ; +vm_fault_t fault;siginfo_t info;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;
arch/arc/mm/fault.c +3 -1
@@ -15,6 +15,7 @@#include <linux/uaccess.h> #include <linux/kdebug.h> #include <linux/perf_event.h> +#include <linux/mm_types.h> #include <asm/pgalloc.h> #include <asm/mmu.h>
@@ -66,7 +67,8 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)struct task_struct *tsk = current;struct mm_struct *mm = tsk->mm;siginfo_t info; -int fault, ret; +int ret; +vm_fault_t fault;int write = regs->ecr_cause &ECR_C_PROTV_STORE ;/* ST/EX */ unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;
arch/arm/mm/fault.c +4 -3
@@ -219,12 +219,12 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)return vma->vm_flags & mask ? false : true; } -static int __kprobes +static vm_fault_t __kprobes __do_page_fault (struct mm_struct *mm,unsigned long addr,unsigned int fsr,unsigned int flags,struct task_struct *tsk) {struct vm_area_struct *vma; -int fault; +vm_fault_t fault; vma =find_vma (mm, addr); fault =VM_FAULT_BADMAP ;
@@ -259,7 +259,8 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) {struct task_struct *tsk;struct mm_struct *mm; -int fault, sig, code; +int sig, code; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;if (notify_page_fault (regs, fsr))
arch/arm64/mm/fault.c +3 -3
@@ -371,12 +371,12 @@ static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *re#define VM_FAULT_BADMAP 0x010000#define VM_FAULT_BADACCESS 0x020000 -static int __do_page_fault (struct mm_struct *mm,unsigned long addr, +static vm_fault_t __do_page_fault (struct mm_struct *mm,unsigned long addr,unsigned int mm_flags,unsigned long vm_flags,struct task_struct *tsk) {struct vm_area_struct *vma; -int fault; +vm_fault_t fault; vma =find_vma (mm, addr); fault =VM_FAULT_BADMAP ;
@@ -419,7 +419,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,struct task_struct *tsk;struct mm_struct *mm;struct siginfo si; -int fault, major =0 ; +vm_fault_t fault, major =0 ;unsigned long vm_flags =VM_READ |VM_WRITE ;unsigned int mm_flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;
arch/hexagon/mm/vm_fault.c +1 -1
@@ -52,7 +52,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)struct mm_struct *mm = current->mm;siginfo_t info;int si_code =SEGV_MAPERR ; -int fault; +vm_fault_t fault;const struct exception_table_entry *fixup;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;
arch/ia64/mm/fault.c +1 -1
@@ -87,7 +87,7 @@ static inline int notify_page_fault(struct pt_regs *regs, int trap)struct mm_struct *mm = current->mm;struct siginfo si;unsigned long mask; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
arch/m68k/mm/fault.c +2 -2
@@ -73,7 +73,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, {struct mm_struct *mm = current->mm;struct vm_area_struct * vma; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; pr_debug("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
@@ -139,7 +139,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,*/ fault =handle_mm_fault (vma, address, flags); -pr_debug ("handle_mm_fault returns %d\n" , fault); +pr_debug ("handle_mm_fault returns %x\n" , fault);if ((fault &VM_FAULT_RETRY ) &&fatal_signal_pending (current))return 0 ;
arch/microblaze/mm/fault.c +1 -1
@@ -91,7 +91,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,siginfo_t info;int code =SEGV_MAPERR ;int is_write = error_code &ESR_S ; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; regs->ear = address;
arch/mips/mm/fault.c +1 -1
@@ -43,7 +43,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,struct mm_struct *mm = tsk->mm;const int field =sizeof (unsigned long ) *2 ;siginfo_t info; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10);
arch/nds32/mm/fault.c +1 -1
@@ -73,7 +73,7 @@ void do_page_fault(unsigned long entry, unsigned long addr,struct mm_struct *mm;struct vm_area_struct *vma;siginfo_t info; -int fault; +vm_fault_t fault;unsigned int mask =VM_READ |VM_WRITE |VM_EXEC ;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;
arch/nios2/mm/fault.c +1 -1
@@ -47,7 +47,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,struct task_struct *tsk = current;struct mm_struct *mm = tsk->mm;int code =SEGV_MAPERR ; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; cause >>=2 ;
arch/openrisc/mm/fault.c +1 -1
@@ -53,7 +53,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,struct mm_struct *mm;struct vm_area_struct *vma;siginfo_t info; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; tsk = current;
arch/parisc/mm/fault.c +1 -1
@@ -262,7 +262,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,struct task_struct *tsk;struct mm_struct *mm;unsigned long acc_type; -int fault =0 ; +vm_fault_t fault =0 ;unsigned int flags;if (faulthandler_disabled ())
arch/powerpc/mm/copro_fault.c +1 -1
@@ -34,7 +34,7 @@* to handle fortunately. */ int copro_handle_mm_fault (struct mm_struct *mm,unsigned long ea, -unsigned long dsisr,unsigned *flt) +unsigned long dsisr,vm_fault_t *flt) {struct vm_area_struct *vma;unsigned long is_write;
arch/powerpc/mm/fault.c +4 -3
@@ -159,7 +159,7 @@ static noinline int bad_access(struct pt_regs *regs, unsigned long address) }static int do_sigbus (struct pt_regs *regs,unsigned long address, -unsigned int fault) +vm_fault_t fault) {siginfo_t info;unsigned int lsb =0 ;
@@ -189,7 +189,8 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,return 0 ; } -static int mm_fault_error (struct pt_regs *regs,unsigned long addr,int fault) +static int mm_fault_error (struct pt_regs *regs,unsigned long addr, +vm_fault_t fault) {/* * Kernel page fault interrupted by SIGKILL. We have no reason to
@@ -402,7 +403,7 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,int is_exec =TRAP (regs) ==0x400 ;int is_user =user_mode (regs);int is_write =page_fault_is_write (error_code); -int fault, major =0 ; +vm_fault_t fault, major =0 ;bool store_update_sp = false;if (notify_page_fault (regs))
arch/riscv/mm/fault.c +2 -1
@@ -41,7 +41,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs)struct mm_struct *mm;unsigned long addr, cause;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; -int fault, code =SEGV_MAPERR ; +int code =SEGV_MAPERR ; +vm_fault_t fault; cause = regs->scause; addr = regs->sbadaddr;
arch/s390/mm/fault.c +8 -5
@@ -350,7 +350,8 @@ static noinline int signal_return(struct pt_regs *regs)return -EACCES ; } -static noinline void do_fault_error(struct pt_regs *regs, int access, int fault) +static noinline void do_fault_error(struct pt_regs *regs, int access, +vm_fault_t fault) {int si_code;
@@ -410,7 +411,7 @@ static noinline void do_fault_error(struct pt_regs *regs, int access, int fault)* 11 Page translation -> Not present (nullification) * 3b Region third trans. -> Not present (nullification) */ -static inline int do_exception (struct pt_regs *regs,int access) +static inline vm_fault_t do_exception (struct pt_regs *regs,int access) {struct gmap *gmap;struct task_struct *tsk;
@@ -420,7 +421,7 @@ static inline int do_exception(struct pt_regs *regs, int access)unsigned long trans_exc_code;unsigned long address;unsigned int flags; -int fault; +vm_fault_t fault; tsk = current;/*
@@ -571,7 +572,8 @@ static inline int do_exception(struct pt_regs *regs, int access)void do_protection_exception (struct pt_regs *regs) {unsigned long trans_exc_code; -int access, fault; +int access; +vm_fault_t fault; trans_exc_code = regs->int_parm_long;/*
@@ -606,7 +608,8 @@ void do_protection_exception(struct pt_regs *regs)void do_dat_exception (struct pt_regs *regs) { -int access, fault; +int access; +vm_fault_t fault; access =VM_READ |VM_EXEC |VM_WRITE ; fault =do_exception (regs, access);
arch/sh/mm/fault.c +2 -2
@@ -320,7 +320,7 @@ static noinline int vmalloc_fault(unsigned long address) static noinline intmm_fault_error (struct pt_regs *regs,unsigned long error_code, -unsigned long address,unsigned int fault) +unsigned long address,vm_fault_t fault) {/* * Pagefault was interrupted by SIGKILL. We have no reason to
@@ -403,7 +403,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,struct task_struct *tsk;struct mm_struct *mm;struct vm_area_struct * vma; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; tsk = current;
arch/sparc/mm/fault_32.c +2 -1
@@ -174,7 +174,8 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,unsigned int fixup;unsigned long g2;int from_user = !(regs->psr &PSR_PS ); -int fault, code; +int code; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;if (text_fault)
arch/sparc/mm/fault_64.c +2 -1
@@ -284,7 +284,8 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)struct mm_struct *mm = current->mm;struct vm_area_struct *vma;unsigned int insn =0 ; -int si_code, fault_code, fault; +int si_code, fault_code; +vm_fault_t fault;unsigned long address, mm_rss;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;
arch/um/kernel/trap.c +1 -1
@@ -72,7 +72,7 @@ int handle_page_fault(unsigned long address, unsigned long ip, } do { - int fault; + vm_fault_t fault; fault = handle_mm_fault(vma, address, flags);
arch/unicore32/mm/fault.c +5 -4
@@ -167,11 +167,11 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)return vma->vm_flags & mask ? false : true; } -static int __do_pf (struct mm_struct *mm,unsigned long addr,unsigned int fsr, -unsigned int flags,struct task_struct *tsk) +static vm_fault_t __do_pf (struct mm_struct *mm,unsigned long addr, +unsigned int fsr,unsigned int flags,struct task_struct *tsk) {struct vm_area_struct *vma; -int fault; +vm_fault_t fault; vma =find_vma (mm, addr); fault =VM_FAULT_BADMAP ;
@@ -208,7 +208,8 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs) {struct task_struct *tsk;struct mm_struct *mm; -int fault, sig, code; +int sig, code; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; tsk = current;
arch/x86/mm/fault.c +3 -2
@@ -16,6 +16,7 @@#include <linux/prefetch.h> /* prefetchw */ #include <linux/context_tracking.h> /* exception_enter(), ... */ #include <linux/uaccess.h> /* faulthandler_disabled() */ +#include <linux/mm_types.h> #include <asm/cpufeature.h> /* boot_cpu_has, ... */ #include <asm/traps.h> /* dotraplinkage, ... */
@@ -1004,7 +1005,7 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code, static noinline voidmm_fault_error (struct pt_regs *regs,unsigned long error_code, -unsigned long address,u32 *pkey,unsigned int fault) +unsigned long address,u32 *pkey,vm_fault_t fault) {if (fatal_signal_pending (current) && !(error_code &X86_PF_USER )) {no_context (regs, error_code, address,0 ,0 );
@@ -1218,7 +1219,7 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs)struct vm_area_struct *vma;struct task_struct *tsk;struct mm_struct *mm; -int fault, major =0 ; +vm_fault_t fault, major =0 ;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ;u32 pkey;
arch/xtensa/mm/fault.c +1 -1
@@ -42,7 +42,7 @@ void do_page_fault(struct pt_regs *regs)siginfo_t info;int is_write, is_exec; -int fault; +vm_fault_t fault;unsigned int flags =FAULT_FLAG_ALLOW_RETRY |FAULT_FLAG_KILLABLE ; info.si_code =SEGV_MAPERR ;
drivers/iommu/amd_iommu_v2.c +1 -1
@@ -508,7 +508,7 @@ static void do_fault(struct work_struct *work) { struct fault *fault = container_of(work, struct fault, work);struct vm_area_struct *vma; -int ret =VM_FAULT_ERROR ; +vm_fault_t ret =VM_FAULT_ERROR ;unsigned int flags =0 ;struct mm_struct *mm;u64 address;
drivers/iommu/intel-svm.c +3 -1
@@ -24,6 +24,7 @@#include <linux/pci-ats.h> #include <linux/dmar.h> #include <linux/interrupt.h> +#include <linux/mm_types.h> #include <asm/page.h> #define PASID_ENTRY_P BIT_ULL(0)
@@ -594,7 +595,8 @@ static irqreturn_t prq_event_thread(int irq, void *d)struct vm_area_struct *vma;struct page_req_dsc *req;struct qi_desc resp; -int ret, result; +int result; +vm_fault_t ret;u64 address; handled =1 ;
mm/hmm.c +4 -4
@@ -308,14 +308,14 @@ static int hmm_vma_do_fault(struct mm_walk *walk, unsigned long addr,struct hmm_vma_walk *hmm_vma_walk = walk->private;struct hmm_range *range = hmm_vma_walk->range;struct vm_area_struct *vma = walk->vma; -int r; +vm_fault_t ret; flags |= hmm_vma_walk->block ?0 :FAULT_FLAG_ALLOW_RETRY ; flags |= write_fault ?FAULT_FLAG_WRITE :0 ; - r =handle_mm_fault (vma, addr, flags); -if (r &VM_FAULT_RETRY ) + ret =handle_mm_fault (vma, addr, flags); +if (ret &VM_FAULT_RETRY )return -EBUSY ; -if (r &VM_FAULT_ERROR ) { +if (ret &VM_FAULT_ERROR ) { *pfn = range->values[HMM_PFN_ERROR ];return -EFAULT ; }
mm/ksm.c +1 -1
@@ -451,7 +451,7 @@ static inline bool ksm_test_exit(struct mm_struct *mm)static int break_ksm (struct vm_area_struct *vma,unsigned long addr) {struct page *page; -int ret =0 ; +vm_fault_t ret =0 ; do { cond_resched();
Signature · 1 line
1.9.1
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Souptick,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v4.17]
[cannot apply to linus/master powerpc/next sparc-next/master next-20180614]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Souptick-Joarder/mm-convert-return-type-of-handle_mm_fault-caller-to-vm_fault_t/20180615-030636
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
>> arch/powerpc/mm/copro_fault.c:36:5: error: conflicting types for 'copro_handle_mm_fault'
int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
^~~~~~~~~~~~~~~~~~~~~
In file included from arch/powerpc/mm/copro_fault.c:27:0:
arch/powerpc/include/asm/copro.h:18:5: note: previous declaration of 'copro_handle_mm_fault' was here
int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
^~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7:0,
from include/linux/kernel.h:7,
from include/asm-generic/bug.h:18,
from arch/powerpc/include/asm/bug.h:128,
from include/linux/bug.h:5,
from arch/powerpc/include/asm/mmu.h:126,
from arch/powerpc/include/asm/lppaca.h:36,
from arch/powerpc/include/asm/paca.h:21,
from arch/powerpc/include/asm/current.h:16,
from include/linux/sched.h:12,
from arch/powerpc/mm/copro_fault.c:23:
arch/powerpc/mm/copro_fault.c:101:19: error: conflicting types for 'copro_handle_mm_fault'
EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
^
include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
extern typeof(sym) sym; \
^~~
arch/powerpc/mm/copro_fault.c:101:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
^~~~~~~~~~~~~~~~~ In file included from arch/powerpc/mm/copro_fault.c:27:0:
arch/powerpc/include/asm/copro.h:18:5: note: previous declaration of 'copro_handle_mm_fault' was here
int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
^~~~~~~~~~~~~~~~~~~~~
vim +/copro_handle_mm_fault +36 arch/powerpc/mm/copro_fault.c
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 30
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 31 /*
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 32 * This ought to be kept in sync with the powerpc specific do_page_fault
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 33 * function. Currently, there are a few corner cases that we haven't had
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 34 * to handle fortunately.
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 35 */
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 @36 int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
7c71e54a4 arch/powerpc/mm/copro_fault.c Souptick Joarder 2018-06-15 37 unsigned long dsisr, vm_fault_t *flt)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 38 {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 39 struct vm_area_struct *vma;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 40 unsigned long is_write;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 41 int ret;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 42
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 43 if (mm == NULL)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 44 return -EFAULT;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 45
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 46 if (mm->pgd == NULL)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 47 return -EFAULT;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 48
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 49 down_read(&mm->mmap_sem);
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 50 ret = -EFAULT;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 51 vma = find_vma(mm, ea);
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 52 if (!vma)
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 53 goto out_unlock;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 54
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 55 if (ea < vma->vm_start) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 56 if (!(vma->vm_flags & VM_GROWSDOWN))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 57 goto out_unlock;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 58 if (expand_stack(vma, ea))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 59 goto out_unlock;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 60 }
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 61
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 62 is_write = dsisr & DSISR_ISSTORE;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 63 if (is_write) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 64 if (!(vma->vm_flags & VM_WRITE))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 65 goto out_unlock;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 66 } else {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 67 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 68 goto out_unlock;
842915f56 arch/powerpc/mm/copro_fault.c Mel Gorman 2015-02-12 69 /*
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 70 * PROT_NONE is covered by the VMA check above.
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 71 * and hash should get a NOHPTE fault instead of
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 72 * a PROTFAULT in case fixup is needed for things
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 73 * like autonuma.
842915f56 arch/powerpc/mm/copro_fault.c Mel Gorman 2015-02-12 74 */
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 75 if (!radix_enabled())
842915f56 arch/powerpc/mm/copro_fault.c Mel Gorman 2015-02-12 76 WARN_ON_ONCE(dsisr & DSISR_PROTFAULT);
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 77 }
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 78
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 79 ret = 0;
dcddffd41 arch/powerpc/mm/copro_fault.c Kirill A. Shutemov 2016-07-26 80 *flt = handle_mm_fault(vma, ea, is_write ? FAULT_FLAG_WRITE : 0);
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 81 if (unlikely(*flt & VM_FAULT_ERROR)) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 82 if (*flt & VM_FAULT_OOM) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 83 ret = -ENOMEM;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 84 goto out_unlock;
33692f275 arch/powerpc/mm/copro_fault.c Linus Torvalds 2015-01-29 85 } else if (*flt & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 86 ret = -EFAULT;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 87 goto out_unlock;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 88 }
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 89 BUG();
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 90 }
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 91
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 92 if (*flt & VM_FAULT_MAJOR)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 93 current->maj_flt++;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 94 else
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 95 current->min_flt++;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 96
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 97 out_unlock:
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 98 up_read(&mm->mmap_sem);
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 99 return ret;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 100 }
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 101 EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
73d16a6e0 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 102 :::::: The code at line 36 was first introduced by commit
:::::: e83d01697583d8610d1d62279758c2a881e3396f powerpc/cell: Move spu_handle_mm_fault() out of cell platform
:::::: TO: Ian Munsie <[email protected]> :::::: CC: Michael Ellerman <mpe-Gsx/[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botThank you for the patch! Perhaps something to improve:
Hi Souptick,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on v4.17]
[cannot apply to linus/master powerpc/next sparc-next/master next-20180615]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Souptick-Joarder/mm-convert-return-type-of-handle_mm_fault-caller-to-vm_fault_t/20180615-030636
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc
All warnings (new ones prefixed by >>):
arch/powerpc/mm/copro_fault.c:36:5: error: conflicting types for 'copro_handle_mm_fault'
int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
^~~~~~~~~~~~~~~~~~~~~
In file included from arch/powerpc/mm/copro_fault.c:27:0:
arch/powerpc/include/asm/copro.h:18:5: note: previous declaration of 'copro_handle_mm_fault' was here
int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
^~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/linkage.h:7:0,
from include/linux/kernel.h:7,
from include/asm-generic/bug.h:18,
from arch/powerpc/include/asm/bug.h:128,
from include/linux/bug.h:5,
from arch/powerpc/include/asm/mmu.h:126,
from arch/powerpc/include/asm/lppaca.h:36,
from arch/powerpc/include/asm/paca.h:21,
from arch/powerpc/include/asm/current.h:16,
from include/linux/sched.h:12,
from arch/powerpc/mm/copro_fault.c:23:
arch/powerpc/mm/copro_fault.c:101:19: error: conflicting types for 'copro_handle_mm_fault'
EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
^
include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
extern typeof(sym) sym; \
^~~
>> arch/powerpc/mm/copro_fault.c:101:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
^~~~~~~~~~~~~~~~~ In file included from arch/powerpc/mm/copro_fault.c:27:0:
arch/powerpc/include/asm/copro.h:18:5: note: previous declaration of 'copro_handle_mm_fault' was here
int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
^~~~~~~~~~~~~~~~~~~~~
vim +/EXPORT_SYMBOL_GPL +101 arch/powerpc/mm/copro_fault.c
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 @23 #include <linux/sched.h>
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 24 #include <linux/mm.h>
4b16f8e2d arch/powerpc/platforms/cell/spu_fault.c Paul Gortmaker 2011-07-22 25 #include <linux/export.h>
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 26 #include <asm/reg.h>
73d16a6e0 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 27 #include <asm/copro.h>
be3ebfe82 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 28 #include <asm/spu.h>
ec249dd86 arch/powerpc/mm/copro_fault.c Michael Neuling 2015-05-27 29 #include <misc/cxl-base.h>
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 30
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 31 /*
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 32 * This ought to be kept in sync with the powerpc specific do_page_fault
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 33 * function. Currently, there are a few corner cases that we haven't had
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 34 * to handle fortunately.
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 35 */
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 36 int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
7c71e54a4 arch/powerpc/mm/copro_fault.c Souptick Joarder 2018-06-15 37 unsigned long dsisr, vm_fault_t *flt)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 38 {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 39 struct vm_area_struct *vma;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 40 unsigned long is_write;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 41 int ret;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 42
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 43 if (mm == NULL)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 44 return -EFAULT;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 45
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 46 if (mm->pgd == NULL)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 47 return -EFAULT;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 48
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 49 down_read(&mm->mmap_sem);
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 50 ret = -EFAULT;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 51 vma = find_vma(mm, ea);
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 52 if (!vma)
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 53 goto out_unlock;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 54
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 55 if (ea < vma->vm_start) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 56 if (!(vma->vm_flags & VM_GROWSDOWN))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 57 goto out_unlock;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 58 if (expand_stack(vma, ea))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 59 goto out_unlock;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 60 }
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 61
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 62 is_write = dsisr & DSISR_ISSTORE;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 63 if (is_write) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 64 if (!(vma->vm_flags & VM_WRITE))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 65 goto out_unlock;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 66 } else {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 67 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 68 goto out_unlock;
842915f56 arch/powerpc/mm/copro_fault.c Mel Gorman 2015-02-12 69 /*
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 70 * PROT_NONE is covered by the VMA check above.
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 71 * and hash should get a NOHPTE fault instead of
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 72 * a PROTFAULT in case fixup is needed for things
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 73 * like autonuma.
842915f56 arch/powerpc/mm/copro_fault.c Mel Gorman 2015-02-12 74 */
18061c17c arch/powerpc/mm/copro_fault.c Aneesh Kumar K.V 2017-01-30 75 if (!radix_enabled())
842915f56 arch/powerpc/mm/copro_fault.c Mel Gorman 2015-02-12 76 WARN_ON_ONCE(dsisr & DSISR_PROTFAULT);
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 77 }
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 78
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 79 ret = 0;
dcddffd41 arch/powerpc/mm/copro_fault.c Kirill A. Shutemov 2016-07-26 80 *flt = handle_mm_fault(vma, ea, is_write ? FAULT_FLAG_WRITE : 0);
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 81 if (unlikely(*flt & VM_FAULT_ERROR)) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 82 if (*flt & VM_FAULT_OOM) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 83 ret = -ENOMEM;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 84 goto out_unlock;
33692f275 arch/powerpc/mm/copro_fault.c Linus Torvalds 2015-01-29 85 } else if (*flt & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) {
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 86 ret = -EFAULT;
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 87 goto out_unlock;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 88 }
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 89 BUG();
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 90 }
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 91
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 92 if (*flt & VM_FAULT_MAJOR)
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 93 current->maj_flt++;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 94 else
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 95 current->min_flt++;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 96
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 97 out_unlock:
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 98 up_read(&mm->mmap_sem);
60ee03194 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2009-02-17 99 return ret;
7cd58e438 arch/powerpc/platforms/cell/spu_fault.c Jeremy Kerr 2007-12-20 100 }
e83d01697 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 @101 EXPORT_SYMBOL_GPL(copro_handle_mm_fault);
73d16a6e0 arch/powerpc/mm/copro_fault.c Ian Munsie 2014-10-08 102 :::::: The code at line 101 was first introduced by commit
:::::: e83d01697583d8610d1d62279758c2a881e3396f powerpc/cell: Move spu_handle_mm_fault() out of cell platform
:::::: TO: Ian Munsie <[email protected]> :::::: CC: Michael Ellerman <mpe-Gsx/[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation