mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karl Mehltretter <kmehltretter@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Helge Deller <deller@gmx.de>
Cc: Karl Mehltretter <kmehltretter@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>,
	linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] parisc: irq: Trace hardirq state in do_cpu_irq_mask()
Date: Sun,  8 Nov 2026 20:20:41 +0100	[thread overview]
Message-ID: <20261108192042.14425-1-kmehltretter@gmail.com> (raw)

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)


                 reply	other threads:[~2026-11-08 19:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261108192042.14425-1-kmehltretter@gmail.com \
    --to=kmehltretter@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®