mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] parisc: irq: Trace hardirq state in do_cpu_irq_mask()
@ 2026-11-08 19:20 Karl Mehltretter
  0 siblings, 0 replies; only message in thread
From: Karl Mehltretter @ 2026-11-08 19:20 UTC (permalink / raw)
  To: James E.J. Bottomley, Helge Deller
  Cc: Karl Mehltretter, Peter Zijlstra, Thomas Gleixner, linux-parisc,
	linux-kernel

intr_extint calls do_cpu_irq_mask() with PSW[I] already clear. Since
commit 044d0d6de9f5 ("lockdep: Only trace IRQ edges"), its
local_irq_disable() then skips trace_hardirqs_off(), and lockdep
assertions fail in the timer tick:

  WARNING: kernel/rcu/tree.c:2739 at rcu_sched_clock_irq+0x618/0x1f84

The return to a context with PSW[I] set has not been annotated since
TRACE_IRQFLAGS_SUPPORT was enabled. Annotate both transitions.

Fixes: 366dd4ea9d5f ("parisc: Fix ftrace function tracer")
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
Assisted by an LLM.

Tested under QEMU hppa (32-bit, -smp 2, PREEMPT, PROVE_LOCKING) on
mainline d48723711bae: 13 to 18 lockdep warnings per boot before, none
after (two boots each and one with ftrace=irqsoff). Locking selftests
pass.

The exit annotation assumes intr_return does not call
preempt_schedule_irq(). It currently never does: intr_do_preempt tests
PSW_D rather than PSW_I ("bb,<,n %r20, 31 - PSW_SM_I"), and a kprobe
saw no calls. Fixing that needs the same annotation after
preempt_schedule_irq().

 arch/parisc/kernel/irq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index dff66be65d290..d9f6cb04e4bcf 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -497,7 +497,7 @@ asmlinkage void do_cpu_irq_mask(struct pt_regs *regs)
 #endif
 
 	old_regs = set_irq_regs(regs);
-	local_irq_disable();
+	trace_hardirqs_off();
 	irq_enter_rcu();
 
 	eirr_val = mfctl(23) & cpu_eiem & per_cpu(local_ack_eiem, cpu);
@@ -535,6 +535,8 @@ asmlinkage void do_cpu_irq_mask(struct pt_regs *regs)
  out:
 	irq_exit_rcu();
 	set_irq_regs(old_regs);
+	if (!irqs_disabled_flags(regs->gr[0]))
+		trace_hardirqs_on();
 	return;
 
  set_out:
base-commit: d48723711bae9b8cdc56719c448ba42fef28cbee

-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-08 19:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 19:20 [PATCH] parisc: irq: Trace hardirq state in do_cpu_irq_mask() Karl Mehltretter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®