From: Nicholas Piggin <npiggin@gmail.com> Date: 2022-10-13 06:45:41
It's possible for an interrupt returning to an irqs-disabled context to
lose a pending soft-masked irq because it branches to part of the exit
code for irqs-enabled contexts, which is meant to clear only the
PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This
just looks like a simple thinko from a recent commit (if there was no
hard mask pending, there would be no reason to clear it anyway).
This also adds comment to the code that actually does need to clear the
flag.
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Sachin Sant <redacted>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: e485f6c751e0a ("powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
I credit Sachin as well because he likely ran into it here,
https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-March/240971.html
It was much more difficult to hit on his setup so when I asked him to
re-test with a later kernel and it didn't reproduce, I thought it
could have been unrelated. I stared at the patch for ages back then and
didn't see the bug. I should have known better :(
I'm pretty confident this is the hang problem. Reproducer is intermittent
for me, but I did catch it losing pending irqs here using debug code, so
this certainly is _a_ bug that can explain the symptoms.
Thanks,
Nick
arch/powerpc/kernel/interrupt_64.S | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
On Thu, Oct 13, 2022 at 04:44:18PM +1000, Nicholas Piggin wrote:
It's possible for an interrupt returning to an irqs-disabled context to
lose a pending soft-masked irq because it branches to part of the exit
code for irqs-enabled contexts, which is meant to clear only the
PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This
just looks like a simple thinko from a recent commit (if there was no
hard mask pending, there would be no reason to clear it anyway).
This also adds comment to the code that actually does need to clear the
flag.
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Sachin Sant <redacted>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: e485f6c751e0a ("powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
I thought I sent this before, but I am not sure if it got lost
since I don't see it in the powerpc patchwork.
Tested-by: Guenter Roeck <linux@roeck-us.net>
Guenter
quoted hunk
---
I credit Sachin as well because he likely ran into it here,
https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-March/240971.html
It was much more difficult to hit on his setup so when I asked him to
re-test with a later kernel and it didn't reproduce, I thought it
could have been unrelated. I stared at the patch for ages back then and
didn't see the bug. I should have known better :(
I'm pretty confident this is the hang problem. Reproducer is intermittent
for me, but I did catch it losing pending irqs here using debug code, so
this certainly is _a_ bug that can explain the symptoms.
Thanks,
Nick
arch/powerpc/kernel/interrupt_64.S | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
From: Michael Ellerman <hidden> Date: 2022-10-14 23:22:44
On Thu, 13 Oct 2022 16:44:18 +1000, Nicholas Piggin wrote:
It's possible for an interrupt returning to an irqs-disabled context to
lose a pending soft-masked irq because it branches to part of the exit
code for irqs-enabled contexts, which is meant to clear only the
PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This
just looks like a simple thinko from a recent commit (if there was no
hard mask pending, there would be no reason to clear it anyway).
[...]