Unlock top part of the fault handler.
authormpi <mpi@openbsd.org>
Wed, 5 May 2021 07:29:00 +0000 (07:29 +0000)
committermpi <mpi@openbsd.org>
Wed, 5 May 2021 07:29:00 +0000 (07:29 +0000)
ok kettenis@

sys/arch/amd64/amd64/trap.c
sys/arch/arm64/arm64/trap.c
sys/arch/i386/i386/trap.c
sys/arch/powerpc/powerpc/trap.c
sys/arch/powerpc64/powerpc64/trap.c
sys/arch/sparc64/sparc64/trap.c

index 68fc28f..2b5262b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: trap.c,v 1.87 2020/10/22 13:41:51 deraadt Exp $       */
+/*     $OpenBSD: trap.c,v 1.88 2021/05/05 07:29:00 mpi Exp $   */
 /*     $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $    */
 
 /*-
@@ -176,10 +176,7 @@ upageflttrap(struct trapframe *frame, uint64_t cr2)
        union sigval sv;
        int signal, sicode, error;
 
-       KERNEL_LOCK();
        error = uvm_fault(&p->p_vmspace->vm_map, va, 0, access_type);
-       KERNEL_UNLOCK();
-
        if (error == 0) {
                uvm_grow(p, va);
                return 1;
@@ -261,9 +258,7 @@ kpageflttrap(struct trapframe *frame, uint64_t cr2)
        if (curcpu()->ci_inatomic == 0 || map == kernel_map) {
                onfault = pcb->pcb_onfault;
                pcb->pcb_onfault = NULL;
-               KERNEL_LOCK();
                error = uvm_fault(map, va, 0, access_type);
-               KERNEL_UNLOCK();
                pcb->pcb_onfault = onfault;
 
                if (error == 0 && map != kernel_map)
index c2b6795..c4a3ef0 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.35 2021/01/25 19:37:18 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.36 2021/05/05 07:29:00 mpi Exp $ */
 /*-
  * Copyright (c) 2014 Andrew Turner
  * All rights reserved.
@@ -120,9 +120,7 @@ udata_abort(struct trapframe *frame, uint64_t esr, uint64_t far, int exe)
        if (pmap_fault_fixup(map->pmap, va, access_type))
                return;
 
-       KERNEL_LOCK();
        error = uvm_fault(map, va, 0, access_type);
-       KERNEL_UNLOCK();
 
        if (error == 0) {
                uvm_grow(p, va);
@@ -178,9 +176,7 @@ kdata_abort(struct trapframe *frame, uint64_t esr, uint64_t far, int exe)
 
        /* Handle referenced/modified emulation */
        if (!pmap_fault_fixup(map->pmap, va, access_type)) {
-               KERNEL_LOCK();
                error = uvm_fault(map, va, 0, access_type);
-               KERNEL_UNLOCK();
 
                if (error == 0 && map != kernel_map)
                        uvm_grow(p, va);
index 65be20b..0772eb3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: trap.c,v 1.151 2020/10/27 19:17:12 deraadt Exp $      */
+/*     $OpenBSD: trap.c,v 1.152 2021/05/05 07:29:01 mpi Exp $  */
 /*     $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $        */
 
 /*-
@@ -126,10 +126,7 @@ upageflttrap(struct trapframe *frame, uint32_t cr2)
        union sigval sv;
        int signal, sicode, error;
 
-       KERNEL_LOCK();
        error = uvm_fault(&p->p_vmspace->vm_map, va, 0, access_type);
-       KERNEL_UNLOCK();
-
        if (error == 0) {
                uvm_grow(p, va);
                return 1;
@@ -203,9 +200,7 @@ kpageflttrap(struct trapframe *frame, uint32_t cr2)
        if (curcpu()->ci_inatomic == 0 || map == kernel_map) {
                onfault = pcb->pcb_onfault;
                pcb->pcb_onfault = NULL;
-               KERNEL_LOCK();
                error = uvm_fault(map, va, 0, access_type);
-               KERNEL_UNLOCK();
                pcb->pcb_onfault = onfault;
 
                if (error == 0 && map != kernel_map)
index 5caf476..02d6aab 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: trap.c,v 1.119 2021/03/11 11:16:59 jsg Exp $  */
+/*     $OpenBSD: trap.c,v 1.120 2021/05/05 07:29:01 mpi Exp $  */
 /*     $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $        */
 
 /*
@@ -282,9 +282,7 @@ trap(struct trapframe *frame)
                else
                        ftype = PROT_READ;
 
-               KERNEL_LOCK();
                error = uvm_fault(map, trunc_page(va), 0, ftype);
-               KERNEL_UNLOCK();
 
                if (error == 0)
                        return;
@@ -318,10 +316,8 @@ trap(struct trapframe *frame)
                } else
                        vftype = ftype = PROT_READ;
 
-               KERNEL_LOCK();
                error = uvm_fault(&p->p_vmspace->vm_map,
                    trunc_page(frame->dar), 0, ftype);
-               KERNEL_UNLOCK();
 
                if (error == 0) {
                        uvm_grow(p, frame->dar);
@@ -343,10 +339,8 @@ trap(struct trapframe *frame)
 
                ftype = PROT_READ | PROT_EXEC;
 
-               KERNEL_LOCK();
                error = uvm_fault(&p->p_vmspace->vm_map,
                    trunc_page(frame->srr0), 0, ftype);
-               KERNEL_UNLOCK();
 
                if (error == 0) {
                        uvm_grow(p, frame->srr0);
index 11eee18..1a7ccf0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: trap.c,v 1.49 2021/01/09 13:14:02 kettenis Exp $      */
+/*     $OpenBSD: trap.c,v 1.50 2021/05/05 07:29:01 mpi Exp $   */
 
 /*
  * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -126,9 +126,7 @@ trap(struct trapframe *frame)
                        access_type = PROT_READ | PROT_WRITE;
                else
                        access_type = PROT_READ;
-               KERNEL_LOCK();
                error = uvm_fault(map, trunc_page(va), 0, access_type);
-               KERNEL_UNLOCK();
                if (error == 0)
                        return;
 
@@ -237,9 +235,7 @@ trap(struct trapframe *frame)
                        access_type = PROT_READ | PROT_WRITE;
                else
                        access_type = PROT_READ;
-               KERNEL_LOCK();
                error = uvm_fault(map, trunc_page(va), 0, access_type);
-               KERNEL_UNLOCK();
                if (error == 0)
                        uvm_grow(p, va);
 
@@ -284,9 +280,7 @@ trap(struct trapframe *frame)
                map = &p->p_vmspace->vm_map;
                va = frame->srr0;
                access_type = PROT_READ | PROT_EXEC;
-               KERNEL_LOCK();
                error = uvm_fault(map, trunc_page(va), 0, access_type);
-               KERNEL_UNLOCK();
                if (error == 0)
                        uvm_grow(p, va);
 
index d864181..1d7165d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: trap.c,v 1.108 2021/03/11 11:17:00 jsg Exp $  */
+/*     $OpenBSD: trap.c,v 1.109 2021/05/05 07:29:01 mpi Exp $  */
 /*     $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */
 
 /*
@@ -773,10 +773,7 @@ data_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
                if (!(addr & TLB_TAG_ACCESS_CTX)) {
                        /* CTXT == NUCLEUS */
 
-                       KERNEL_LOCK();
                        error = uvm_fault(kernel_map, va, 0, access_type);
-                       KERNEL_UNLOCK();
-
                        if (error == 0)
                                return;
                        goto kfault;
@@ -792,9 +789,7 @@ data_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
 
        onfault = (vaddr_t)p->p_addr->u_pcb.pcb_onfault;
        p->p_addr->u_pcb.pcb_onfault = NULL;
-       KERNEL_LOCK();
        error = uvm_fault(&p->p_vmspace->vm_map, (vaddr_t)va, 0, access_type);
-       KERNEL_UNLOCK();
        p->p_addr->u_pcb.pcb_onfault = (void *)onfault;
 
        /*
@@ -959,9 +954,7 @@ text_access_fault(struct trapframe64 *tf, unsigned type, vaddr_t pc,
            uvm_map_inentry_sp, p->p_vmspace->vm_map.sserial))
                goto out;
 
-       KERNEL_LOCK();
        error = uvm_fault(&p->p_vmspace->vm_map, va, 0, access_type);
-       KERNEL_UNLOCK();
 
        /*
         * If this was a stack access we keep track of the maximum
@@ -1055,9 +1048,7 @@ text_access_error(struct trapframe64 *tf, unsigned type, vaddr_t pc,
            uvm_map_inentry_sp, p->p_vmspace->vm_map.sserial))
                goto out;
 
-       KERNEL_LOCK();
        error = uvm_fault(&p->p_vmspace->vm_map, va, 0, access_type);
-       KERNEL_UNLOCK();
 
        /*
         * If this was a stack access we keep track of the maximum