Thread (12 messages) 12 messages, 2 authors, 2019-08-01

Re: [PATCH v3 3/4] arm64: Make debug exception handlers visible from RCU

From: Will Deacon <will@kernel.org>
Date: 2019-08-01 07:37:45
Also in: lkml

Hi Masami,

On Thu, Aug 01, 2019 at 02:32:25PM +0900, Masami Hiramatsu wrote:
On Wed, 31 Jul 2019 18:26:03 +0100
Will Deacon [off-list ref] wrote:
quoted
On Thu, Jul 25, 2019 at 05:16:15PM +0900, Masami Hiramatsu wrote:
quoted
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 9568c116ac7f..ed6c55c87fdc 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -777,6 +777,42 @@ void __init hook_debug_fault_code(int nr,
 	debug_fault_info[nr].name	= name;
 }
 
+/*
+ * In debug exception context, we explicitly disable preemption.
Maybe add "despite having interrupts disabled"?
OK, I'll add it.
quoted
quoted
+ * This serves two purposes: it makes it much less likely that we would
+ * accidentally schedule in exception context and it will force a warning
+ * if we somehow manage to schedule by accident.
+ */
+static void debug_exception_enter(struct pt_regs *regs)
+{
+	if (user_mode(regs)) {
+		RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
+	} else {
+		/*
+		 * We might have interrupted pretty much anything.  In
+		 * fact, if we're a debug exception, we can even interrupt
+		 * NMI processing. We don't want this code makes in_nmi()
+		 * to return true, but we need to notify RCU.
+		 */
+		rcu_nmi_enter();
+	}
+
+	preempt_disable();
If you're addingt new functions for entry/exit, maybe move the
trace_hardirqs_{on,off}() calls in here too?
OK, let's move it in these functions.
Brill, thanks. Please just resend this patch, as I can pick the other three
up as they are.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help