Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Sep 2020 23:17:26 +0000 (UTC)
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r365317 - stable/12/sys/riscv/riscv
Message-ID:  <202009032317.083NHQOQ087579@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009032317.083NHQOQ087579>