svn commit: r365317 - stable/12/sys/riscv/riscv

Mitchell Horne mhorne at FreeBSD.org
Thu Sep 3 23:17:26 UTC 2020


Author: mhorne
Date: Thu Sep  3 23:17:25 2020
New Revision: 365317
URL: https://svnweb.freebsd.org/changeset/base/365317

Log:
  MFC r364193:
  
  Enable interrupts while handling traps

Modified:
  stable/12/sys/riscv/riscv/trap.c

Modified: stable/12/sys/riscv/riscv/trap.c
==============================================================================
--- stable/12/sys/riscv/riscv/trap.c	Thu Sep  3 22:40:51 2020	(r365316)
+++ stable/12/sys/riscv/riscv/trap.c	Thu Sep  3 23:17:25 2020	(r365317)
@@ -194,14 +194,22 @@ data_abort(struct trapframe *frame, int usermode)
 	    "Kernel page fault") != 0)
 		goto fatal;
 
-	if (usermode)
+	if (usermode) {
 		map = &td->td_proc->p_vmspace->vm_map;
-	else if (stval >= VM_MAX_USER_ADDRESS)
-		map = kernel_map;
-	else {
-		if (pcb->pcb_onfault == 0)
-			goto fatal;
-		map = &td->td_proc->p_vmspace->vm_map;
+	} else {
+		/*
+		 * Enable interrupts for the duration of the page fault. For
+		 * user faults this was done already in do_trap_user().
+		 */
+		intr_enable();
+
+		if (stval >= VM_MAX_USER_ADDRESS) {
+			map = kernel_map;
+		} else {
+			if (pcb->pcb_onfault == 0)
+				goto fatal;
+			map = &td->td_proc->p_vmspace->vm_map;
+		}
 	}
 
 	va = trunc_page(stval);
@@ -320,6 +328,7 @@ do_trap_user(struct trapframe *frame)
 		riscv_cpu_intr(frame);
 		return;
 	}
+	intr_enable();
 
 	CTR3(KTR_TRAP, "do_trap_user: curthread: %p, sepc: %lx, frame: %p",
 	    curthread, frame->tf_sepc, frame);


More information about the svn-src-all mailing list