mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-14 06:35:12 +00:00
powerpc/64/interrupt: Reconcile soft-mask state in NMI and fix false BUG
If a NMI hits early in an interrupt handler before the irq soft-mask
state is reconciled, that can cause a false-positive BUG with a
CONFIG_PPC_IRQ_SOFT_MASK_DEBUG assertion.
Remove that assertion and instead check the case that if regs->msr has
EE clear, then regs->softe should be marked as disabled so the irq state
looks correct to NMI handlers, the same as how it's fixed up in the
case it was implicit soft-masked.
This doesn't fix a known problem -- the change that was fixed by commit
4ec5feec1a
("powerpc/64s: Make NMI record implicitly soft-masked code
as irqs disabled") was the addition of a warning in the soft-nmi
watchdog interrupt which can never actually fire when MSR[EE]=0. However
it may be important if NMI handlers grow more code, and it's less
surprising to anything using 'regs' - (I tripped over this when working
in the area).
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211004145642.1331214-5-npiggin@gmail.com
This commit is contained in:
parent
ff058a8ada
commit
768c470103
1 changed files with 8 additions and 5 deletions
|
@ -265,13 +265,16 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte
|
|||
local_paca->irq_soft_mask = IRQS_ALL_DISABLED;
|
||||
local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
|
||||
|
||||
if (is_implicit_soft_masked(regs)) {
|
||||
// Adjust regs->softe soft implicit soft-mask, so
|
||||
// arch_irq_disabled_regs(regs) behaves as expected.
|
||||
if (!(regs->msr & MSR_EE) || is_implicit_soft_masked(regs)) {
|
||||
/*
|
||||
* Adjust regs->softe to be soft-masked if it had not been
|
||||
* reconcied (e.g., interrupt entry with MSR[EE]=0 but softe
|
||||
* not yet set disabled), or if it was in an implicit soft
|
||||
* masked state. This makes arch_irq_disabled_regs(regs)
|
||||
* behave as expected.
|
||||
*/
|
||||
regs->softe = IRQS_ALL_DISABLED;
|
||||
}
|
||||
if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
|
||||
BUG_ON(!arch_irq_disabled_regs(regs) && !(regs->msr & MSR_EE));
|
||||
|
||||
/* Don't do any per-CPU operations until interrupt state is fixed */
|
||||
|
||||
|
|
Loading…
Reference in a new issue