linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Nicholas Piggin <npiggin@gmail.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/4] powerpc/64s: Fix HV NMI vs HV interrupt recoverability test
Date: Thu, 21 Feb 2019 21:05:27 +1100	[thread overview]
Message-ID: <87bm35wj6g.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <1550672893.su6y10x0gg.astroid@bobo.none>

Nicholas Piggin <npiggin@gmail.com> writes:
> 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.

I'm seeing the same build error as the kbuild robot too.

cheers

  reply	other threads:[~2019-02-21 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22  6:46 [PATCH 0/4] Fixes for 3 separate NMI reentrancy bugs Nicholas Piggin
2019-01-22  6:46 ` [PATCH 1/4] powerpc/64s: Fix HV NMI vs HV interrupt recoverability test Nicholas Piggin
2019-02-20 14:31   ` Nicholas Piggin
2019-02-21 10:05     ` Michael Ellerman [this message]
2019-01-22  6:46 ` [PATCH 2/4] powerpc/64s: system reset interrupt preserve HSRRs Nicholas Piggin
2019-01-22  6:46 ` [PATCH 3/4] powerpc/64s: Prepare to handle data interrupts vs d-side MCE reentrancy Nicholas Piggin
2019-01-22  6:46 ` [PATCH 4/4] powerpc/64s: Fix " Nicholas Piggin
2019-01-22 10:30   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bm35wj6g.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).