[PATCH 1/4] powerpc/64s: Fix HV NMI vs HV interrupt recoverability test
Nicholas Piggin
npiggin at gmail.com
Thu Feb 21 01:31:06 AEDT 2019
Nicholas Piggin's on January 22, 2019 4:46 pm:
> HV interrupts that use HSRR registers do not clear MSR[RI], but
> NMI entry code is not recoverable early on due to both using HSPRG
> for a scratch register.
>
> This bug means that a system reset or machine check can cause silent
> data corruption (due to loss of r13 register) if it hits in a small
> window when taking an HV interrupt.
>
> Fix this by marking NMIs non-recoverable if they land in HV interrupt
> ranges.
Hum, I had a v2 that I didn't send properly with a small compile fix,
but I've also just noticed this:
> +void hv_nmi_check_nonrecoverable(struct pt_regs *regs)
> +{
> +#ifdef CONFIG_POWERNV
> + unsigned long kbase = (unsigned long)_stext;
> + unsigned long nip = regs->nip;
> +
> + if (!(regs->msr & MSR_RI))
> + return;
> + if (!(regs->msr & MSR_HV))
> + return;
> + if (regs->msr & MSR_PR)
> + return;
> +again:
> + if (nip >= 0x500 && nip < 0x600)
> + goto nonrecoverable;
> + if (nip >= 0x980 && nip < 0xa00)
> + goto nonrecoverable;
> + if (nip >= 0xe00 && nip < 0xec0)
> + goto nonrecoverable;
> + if (nip >= 0xf80 && nip < 0xfa0)
> + goto nonrecoverable;
> + /* Trampolines are not relocated. */
> + if (nip >= real_trampolines_start - kbase &&
> + nip < real_trampolines_end - kbase)
> + goto nonrecoverable;
> + if (nip >= virt_trampolines_start - kbase &&
> + nip < virt_trampolines_end - kbase)
> + goto nonrecoverable;
> + if (nip >= 0xc000000000000000ULL) {
> + nip -= 0xc000000000000000ULL;
> + goto again;
Tried to be a bit too clever here. The 0xc... vectors also have a
+0x4000 offset so this won't catch them properly. I'll respin.
Thanks,
Nick
More information about the Linuxppc-dev
mailing list