On Fri Feb 3, 2023 at 4:26 PM AEST, Sachin Sant wrote:
> I am observing an intermittent crash while running powerpc/security
> selftests on a Power10 LPAR booted with powerpc/merge branch code.
>
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 5644 at arch/powerpc/kernel/irq_64.c:278 
> arch_local_irq_restore+0x254/0x260

Okay, I guess the static branch test changes from true to false both
times it is tested and so it doesn't recover properly. It's a real bug.
I don't know why I didn't change the static branch under stop machine,
maybe it gets into some recursive issue, that would be ideal if we could
though. But this might be a safer minimal fix?

Thanks,
Nick
--

diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c
index fc6631a80527..0ec1581619db 100644
--- a/arch/powerpc/kernel/interrupt.c
+++ b/arch/powerpc/kernel/interrupt.c
@@ -50,16 +50,18 @@ static inline bool exit_must_hard_disable(void)
  */
 static notrace __always_inline bool prep_irq_for_enabled_exit(bool restartable)
 {
+       bool must_hard_disable = (exit_must_hard_disable() || !restartable);
+
        /* This must be done with RI=1 because tracing may touch vmaps */
        trace_hardirqs_on();
 
-       if (exit_must_hard_disable() || !restartable)
+       if (must_hard_disable)
                __hard_EE_RI_disable();
 
 #ifdef CONFIG_PPC64
        /* This pattern matches prep_irq_for_idle */
        if (unlikely(lazy_irq_pending_nocheck())) {
-               if (exit_must_hard_disable() || !restartable) {
+               if (must_hard_disable) {
                        local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
                        __hard_RI_enable();
                }

Reply via email to