diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2023-10-12 09:40:49 +0200 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2023-10-23 18:21:23 +0200 |
commit | 0f86ac4ba71329936c44ef71222f1c50284a8928 (patch) | |
tree | 979fddd1dba4314d6a66fa7417ec5fc1681fb212 | |
parent | 0f1a14e0348eb48e93e139af569944349b725f3f (diff) | |
download | lwn-0f86ac4ba71329936c44ef71222f1c50284a8928.tar.gz lwn-0f86ac4ba71329936c44ef71222f1c50284a8928.zip |
s390/mm,fault: remove VM_FAULT_BADCONTEXT
Remove VM_FAULT_BADCONTEXT and instead call do_no_context() via
wrappers. This adds two new wrappers similar to what x86 has:
handle_fault_error() and handle_fault_error_nolock(). Both of them
simply call do_no_context(), while handle_fault_error() also unlocks
mmap lock, which avoids adding lots of mmap_read_unlock() calls with
this and subsequent patches.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r-- | arch/s390/mm/fault.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index e0dbc231828c..05c908051e93 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -49,7 +49,6 @@ * Allocate private vm_fault_reason from top. * Please make sure it won't collide with vm_fault_reason. */ -#define VM_FAULT_BADCONTEXT ((__force vm_fault_t)0x80000000) #define VM_FAULT_BADMAP ((__force vm_fault_t)0x40000000) #define VM_FAULT_BADACCESS ((__force vm_fault_t)0x20000000) #define VM_FAULT_SIGNAL ((__force vm_fault_t)0x10000000) @@ -257,6 +256,19 @@ static void do_no_context(struct pt_regs *regs) die(regs, "Oops"); } +static inline void handle_fault_error_nolock(struct pt_regs *regs) +{ + do_no_context(regs); +} + +static void handle_fault_error(struct pt_regs *regs) +{ + struct mm_struct *mm = current->mm; + + mmap_read_unlock(mm); + handle_fault_error_nolock(regs); +} + static void do_sigbus(struct pt_regs *regs) { force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)get_fault_address(regs)); @@ -277,8 +289,6 @@ static void do_fault_error(struct pt_regs *regs, vm_fault_t fault) do_sigsegv(regs, si_code); break; } - fallthrough; - case VM_FAULT_BADCONTEXT: do_no_context(regs); break; case VM_FAULT_SIGNAL: @@ -344,15 +354,14 @@ static void do_exception(struct pt_regs *regs, int access) mm = tsk->mm; address = get_fault_address(regs); is_write = fault_is_write(regs); - fault = VM_FAULT_BADCONTEXT; type = get_fault_type(regs); switch (type) { case KERNEL_FAULT: - goto out; + return handle_fault_error_nolock(regs); case USER_FAULT: case GMAP_FAULT: if (faulthandler_disabled() || !mm) - goto out; + return handle_fault_error_nolock(regs); break; } perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); @@ -443,8 +452,7 @@ retry: * mmap_lock has not been released */ current->thread.gmap_pfault = 1; - fault = VM_FAULT_BADCONTEXT; - goto out_up; + return handle_fault_error(regs); } flags &= ~FAULT_FLAG_RETRY_NOWAIT; flags |= FAULT_FLAG_TRIED; |