[PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Breno Leitao
From: Michael Neuling <[hidden email]>

BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1700521

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 <[hidden email]>
Signed-off-by: Benjamin Herrenschmidt <[hidden email]>
(backported from: https://patchwork.ozlabs.org/patch/780365/)
Signed-off-by: Breno Leitao <[hidden email]>
---
 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 f2a18432253c..3ee66dd600fc 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -99,7 +99,9 @@ EXC_VIRT_NONE(0x4000, 0x4100)
 #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 67ba6a66fed5..fb762ee5ac6f 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -433,6 +433,13 @@ FTR_SECTION_ELSE_NESTED(70)
  ld r2, PACATOC(r13)
 ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_POWER9_DD1, 70)
  /*
+ * 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
  */
--
2.11.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK / APPLIED[artful]: [PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Seth Forshee
On Tue, Jun 27, 2017 at 01:45:27PM -0300, Breno Leitao wrote:

> From: Michael Neuling <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1700521
>
> 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 <[hidden email]>
> Signed-off-by: Benjamin Herrenschmidt <[hidden email]>
> (backported from: https://patchwork.ozlabs.org/patch/780365/)
> Signed-off-by: Breno Leitao <[hidden email]>

Acked-by: Seth Forshee <[hidden email]>

I also applied this to artful/master-next and unstable/master, using the
patch from patchworks since this backport didn't apply cleanly.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ACK / APPLIED[artful]: [PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Breno Leitao
Hi Seth,

On Tue, Jun 27, 2017 at 01:23:26PM -0500, Seth Forshee wrote:

> On Tue, Jun 27, 2017 at 01:45:27PM -0300, Breno Leitao wrote:
> > From: Michael Neuling <[hidden email]>
> >
> > BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1700521
> >
> > 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 <[hidden email]>
> > Signed-off-by: Benjamin Herrenschmidt <[hidden email]>
> > (backported from: https://patchwork.ozlabs.org/patch/780365/)
> > Signed-off-by: Breno Leitao <[hidden email]>
>
> Acked-by: Seth Forshee <[hidden email]>
>
> I also applied this to artful/master-next and unstable/master, using the
> patch from patchworks since this backport didn't apply cleanly.

Nice, thanks. I expect that this patch gets integrated very soon, so, it
will be overwritten on artful by the 'official' commit very soon.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ACK / APPLIED[artful]: [PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Seth Forshee
On Tue, Jun 27, 2017 at 03:28:15PM -0300, Breno Leitao wrote:

> Hi Seth,
>
> On Tue, Jun 27, 2017 at 01:23:26PM -0500, Seth Forshee wrote:
> > On Tue, Jun 27, 2017 at 01:45:27PM -0300, Breno Leitao wrote:
> > > From: Michael Neuling <[hidden email]>
> > >
> > > BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1700521
> > >
> > > 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 <[hidden email]>
> > > Signed-off-by: Benjamin Herrenschmidt <[hidden email]>
> > > (backported from: https://patchwork.ozlabs.org/patch/780365/)
> > > Signed-off-by: Breno Leitao <[hidden email]>
> >
> > Acked-by: Seth Forshee <[hidden email]>
> >
> > I also applied this to artful/master-next and unstable/master, using the
> > patch from patchworks since this backport didn't apply cleanly.
>
> Nice, thanks. I expect that this patch gets integrated very soon, so, it
> will be overwritten on artful by the 'official' commit very soon.

Yeah, that happens a lot. We'll drop the sauce patch when we rebase to
the upstream version which contains the commit.

Seth

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK/cmnt: [PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Stefan Bader-2
In reply to this post by Breno Leitao
On 27.06.2017 18:45, Breno Leitao wrote:

> From: Michael Neuling <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1700521
>
> 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 <[hidden email]>
> Signed-off-by: Benjamin Herrenschmidt <[hidden email]>
> (backported from: https://patchwork.ozlabs.org/patch/780365/)
> Signed-off-by: Breno Leitao <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

> ---

This seems to be now upstream as ba6d334ac230065243a92bb7cb3fd6a5f6a7f8ac
(not a cherry-pick but should be not too hard to backport as the failing
hunk is comment only and the other just fuzz).

-Stefan

>  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 f2a18432253c..3ee66dd600fc 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -99,7 +99,9 @@ EXC_VIRT_NONE(0x4000, 0x4100)
>  #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 67ba6a66fed5..fb762ee5ac6f 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -433,6 +433,13 @@ FTR_SECTION_ELSE_NESTED(70)
>   ld r2, PACATOC(r13)
>  ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_POWER9_DD1, 70)
>   /*
> + * 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
>   */
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

APPLIED: [PATCH][Zesty] UBUNTU: SAUCE: powerpc: Invalidate ERAT on powersave wakeup for POWER9

Thadeu Lima de Souza Cascardo-3
In reply to this post by Breno Leitao
Applied to zesty master-next branch, as a cherry-pick of the upstream
commit.

Thanks.
Cascardo.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Loading...