]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/64s: Fix local irq disable when PMIs are disabled
authorNicholas Piggin <npiggin@gmail.com>
Sat, 21 Jan 2023 09:53:52 +0000 (19:53 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:26 +0000 (11:28 +0100)
commit527470d9ada8420aa66d97b69bbf0af458cabf2f
tree3bfe3ddafea1463869c40ef52edbcada1e84640d
parentcbfe83530f263bb0b67b759d3848a52c9532f011
powerpc/64s: Fix local irq disable when PMIs are disabled

commit bc88ef663265676419555df2dc469a471c0add31 upstream.

When PMI interrupts are soft-masked, local_irq_save() will clear the PMI
mask bit, allowing PMIs in and causing a race condition. This causes a
deadlock in native_hpte_insert via hash_preload, which depends on PMIs
being disabled since commit 8b78f67e0a6b ("powerpc/64s/hash: Make hash
faults work in NMI context"). native_hpte_insert calls local_irq_save().
It's possible the lpar hash code is also affected when tracing is
enabled because __trace_hcall_entry() calls local_irq_save().

Fix this by making arch_local_irq_save() _or_ the IRQS_DISABLED bit into
the mask.

This was found with the stress_hpt option with a kbuild workload running
together with `perf record -g`.

Fixes: 384f14ea5b2c ("powerpc/64s: Add support to mask perf interrupts and replay them")
Fixes: 8b78f67e0a6b ("powerpc/64s/hash: Make hash faults work in NMI context")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Just take the fix without the new warning]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230121095352.2823517-1-npiggin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/include/asm/hw_irq.h