Skip to content

Commit 0f86ac4

Browse files
hcahcaVasily Gorbik
authored andcommitted
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>
1 parent 0f1a14e commit 0f86ac4

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

arch/s390/mm/fault.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
* Allocate private vm_fault_reason from top.
5050
* Please make sure it won't collide with vm_fault_reason.
5151
*/
52-
#define VM_FAULT_BADCONTEXT ((__force vm_fault_t)0x80000000)
5352
#define VM_FAULT_BADMAP ((__force vm_fault_t)0x40000000)
5453
#define VM_FAULT_BADACCESS ((__force vm_fault_t)0x20000000)
5554
#define VM_FAULT_SIGNAL ((__force vm_fault_t)0x10000000)
@@ -257,6 +256,19 @@ static void do_no_context(struct pt_regs *regs)
257256
die(regs, "Oops");
258257
}
259258

259+
static inline void handle_fault_error_nolock(struct pt_regs *regs)
260+
{
261+
do_no_context(regs);
262+
}
263+
264+
static void handle_fault_error(struct pt_regs *regs)
265+
{
266+
struct mm_struct *mm = current->mm;
267+
268+
mmap_read_unlock(mm);
269+
handle_fault_error_nolock(regs);
270+
}
271+
260272
static void do_sigbus(struct pt_regs *regs)
261273
{
262274
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)
277289
do_sigsegv(regs, si_code);
278290
break;
279291
}
280-
fallthrough;
281-
case VM_FAULT_BADCONTEXT:
282292
do_no_context(regs);
283293
break;
284294
case VM_FAULT_SIGNAL:
@@ -344,15 +354,14 @@ static void do_exception(struct pt_regs *regs, int access)
344354
mm = tsk->mm;
345355
address = get_fault_address(regs);
346356
is_write = fault_is_write(regs);
347-
fault = VM_FAULT_BADCONTEXT;
348357
type = get_fault_type(regs);
349358
switch (type) {
350359
case KERNEL_FAULT:
351-
goto out;
360+
return handle_fault_error_nolock(regs);
352361
case USER_FAULT:
353362
case GMAP_FAULT:
354363
if (faulthandler_disabled() || !mm)
355-
goto out;
364+
return handle_fault_error_nolock(regs);
356365
break;
357366
}
358367
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
@@ -443,8 +452,7 @@ static void do_exception(struct pt_regs *regs, int access)
443452
* mmap_lock has not been released
444453
*/
445454
current->thread.gmap_pfault = 1;
446-
fault = VM_FAULT_BADCONTEXT;
447-
goto out_up;
455+
return handle_fault_error(regs);
448456
}
449457
flags &= ~FAULT_FLAG_RETRY_NOWAIT;
450458
flags |= FAULT_FLAG_TRIED;

0 commit comments

Comments
 (0)