mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] powerpc/entry: Trace the IRQ disable before irqentry_exit() on 32-bit
@ 2026-10-31 12:11 Ritesh Harjani (IBM)
  0 siblings, 0 replies; only message in thread
From: Ritesh Harjani (IBM) @ 2026-10-31 12:11 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Madhavan Srinivasan, Venkat Rao Bagalkote, linux-kernel,
	Mukesh Kumar Chaurasiya, chleroy, Ritesh Harjani (IBM)

Commit 63a7531ca31f ("powerpc/entry: Fix irq_soft_mask corruption on
replayed interrupt exit") changed arch_interrupt_exit_prepare() to
disable interrupts with hard_irq_disable() instead of
local_irq_disable().
This is correct for 64-bit (since it takes care of everything there)
however, it breaks lockdep on 32-bit.

exceptions such has page fault handling (do_page_fault()), re-enables
interrupts since handling a page fault can sleep. Then generic irq exit
expects the arch to disable the interrupts back before returning to the
user/kernel in their arch_interrupt_exit_prepare() function, before
irqentry_exit() is called. irqentry_exit() then checks for lockdep's irq
tracing state and expects the interrupts to be off.

Note that on 32-bit we don't have any soft mask and hard_irq_disable()
just clears the MSR[EE] state and does not update the irq tracing state
unlikes local_irq_disable(). This causes the lockdep to warn like:

    WARNING: include/linux/irq-entry-common.h:540 at irqentry_exit+0x398/0xd1c, CPU#1: init/1
    NIP  irqentry_exit+0x398/0xd1c
    LR   do_page_fault+0x390/0x7b4
    Call Trace:
     do_page_fault+0x218/0x7b4
     DataStorage+0x15c/0x180
    --- interrupt: 300 at __arch_clear_user+0x10/0xcc

    WARNING: include/linux/irq-entry-common.h:312 at irqentry_exit+0x224/0xd1c, CPU#1: init/1
    NIP  irqentry_exit+0x224/0xd1c
    LR   do_page_fault+0x390/0x7b4
    Call Trace:
     __per_cpu_offset+0x0/0x60 (unreliable)
     do_page_fault+0x390/0x7b4
     InstructionStorage+0x150/0x160
    ---- interrupt: 400 at 0xb77b059c

So, use local_irq_disable() on 32-bit which clears MSR[EE] and also
records the transition for lockdep. For 64-bit we keep hard_irq_disable().

Fixes: 63a7531ca31f ("powerpc/entry: Fix irq_soft_mask corruption on replayed interrupt exit")
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
This was caught during debugging some other issue on 32-bit platform.
When lockdep is enabled there, this warning can be easily seen during bootup
itself.

 arch/powerpc/include/asm/entry-common.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/entry-common.h b/arch/powerpc/include/asm/entry-common.h
index 8e91489fdf2b..c944a267532d 100644
--- a/arch/powerpc/include/asm/entry-common.h
+++ b/arch/powerpc/include/asm/entry-common.h
@@ -268,7 +268,10 @@ static inline void arch_interrupt_exit_prepare(struct pt_regs *regs)
 	}

 	/* irqentry_exit expects to be called with interrupts disabled */
-	hard_irq_disable();
+	if (IS_ENABLED(CONFIG_PPC64))
+		hard_irq_disable();
+	else
+		local_irq_disable();
 }

 static inline void arch_interrupt_async_enter_prepare(struct pt_regs *regs)
--
2.39.5


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

only message in thread, other threads:[~2026-10-31 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 12:11 [PATCH] powerpc/entry: Trace the IRQ disable before irqentry_exit() on 32-bit Ritesh Harjani (IBM)

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®