linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Neuling <mikey@neuling.org>,
	mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] powerpc: Invalidate ERAT on powersave wakeup for POWER9
Date: Sun, 25 Jun 2017 15:18:04 +1000	[thread overview]
Message-ID: <20170625151804.30b56c67@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <1498325341.31581.90.camel@kernel.crashing.org>

On Sat, 24 Jun 2017 12:29:01 -0500
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On POWER9 the ERAT may be incorrect on wakeup from some stop states
> that lose state. This causes random segvs and illegal instructions
> when these stop states are enabled.
> 
> This patch invalidates the ERAT on wakeup on POWER9 to prevent this
> from causing a problem.
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> 
> v2. [BenH] Move to a place before we branch off to KVM if the
>            core was in a guest. Also add a comment about the
>            SRR1 bit extraction.

This looks a bit safer to me now (avoiding KVM). My understanding is
the real-mode i- and d-ERAT entries are still valid and usable,
which is why this works.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

> ---
>  arch/powerpc/kernel/exceptions-64s.S | 4 +++-
>  arch/powerpc/kernel/idle_book3s.S    | 7 +++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index ae418b85c17c..b4b2c3a344c4 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -99,7 +99,9 @@ EXC_VIRT_NONE(0x4000, 0x100)
>  #ifdef CONFIG_PPC_P7_NAP
>  	/*
>  	 * If running native on arch 2.06 or later, check if we are waking up
> -	 * from nap/sleep/winkle, and branch to idle handler.
> +	 * from nap/sleep/winkle, and branch to idle handler. This tests
> +	 * SRR1 bits 46:47. A non-0 value indicates that we are coming from
> +	 * a power saving state.
>  	 */
>  #define IDLETEST(n)							\
>  	BEGIN_FTR_SECTION ;						\
> diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
> index 4898d676dcae..3fd65739e105 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -489,6 +489,13 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
>   */
>  pnv_restore_hyp_resource_arch300:
>  	/*
> +	 * Workaround for POWER9, if we lost resources, the ERAT
> +	 * might have been mixed up and needs flushing.
> +	 */
> +	blt	cr3,1f
> +	PPC_INVALIDATE_ERAT
> +1:
> +	/*
>  	 * POWER ISA 3. Use PSSCR to determine if we
>  	 * are waking up from deep idle state
>  	 */
> 

  reply	other threads:[~2017-06-25  5:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 17:26 [PATCH] powerpc: Invalidate ERAT on powersave wakeup for POWER9 Michael Neuling
2017-06-23  0:50 ` Stewart Smith
2017-06-23  2:12   ` Michael Neuling
2017-06-23  3:09   ` Michael Neuling
2017-06-23  9:33 ` Michael Ellerman
2017-06-23 10:24   ` Nicholas Piggin
2017-06-23 10:45   ` Benjamin Herrenschmidt
2017-06-23 10:22 ` Anshuman Khandual
2017-06-24 17:29 ` [PATCH v2] " Benjamin Herrenschmidt
2017-06-25  5:18   ` Nicholas Piggin [this message]
2017-06-29 12:21   ` [v2] " Michael Ellerman

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=20170625151804.30b56c67@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    /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).