Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1724127 > unrolled thread

[PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline

Started by"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
First post2017-08-31 13:50 +0200
Last post2017-09-06 11:00 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2017-08-31 13:50 +0200
    Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only  for deep state offline Nicholas Piggin <npiggin@gmail.com> - 2017-08-31 14:10 +0200
    Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for  deep state offline Akshay Adiga <akshay.adiga@linux.vnet.ibm.com> - 2017-09-01 12:10 +0200
      Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only  for deep state offline Nicholas Piggin <npiggin@gmail.com> - 2017-09-01 12:40 +0200
    Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for  deep state offline pavrampu <pavrampu@linux.vnet.ibm.com> - 2017-09-06 11:00 +0200

#1724127 — [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline

From"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Date2017-08-31 13:50 +0200
Subject[PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline
Message-ID<ukw8W-55Z-17@gated-at.bofh.it>
From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>

commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
stop-api only on Hotplug") clears the PECE1 bit of the LPCR via
stop-api during CPU-Hotplug to prevent wakeup due to a decrementer on
an offlined CPU which is in a deep stop state.

In the case where the stop-api support is found to be lacking, the
commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT
states when stop-api fails") disables deep states that lose hypervisor
context. Thus in this case, the offlined CPU will be put to some
shallow idle state.

However, we currently unconditionally clear the PECE1 in LPCR via
stop-api during CPU-Hotplug even when deep states are disabled due to
stop-api failure.

Fix this by clearing PECE1 of LPCR via stop-api during CPU-Hotplug
*only* when the offlined CPU will be put to a deep state that loses
hypervisor context.

Fixes: commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
stop-api only on Hotplug")

Reported-by: Pavithra Prakash <pavirampu@linux.vnet.ibm.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/idle.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index 9f59041..23f8fba 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -393,7 +393,13 @@ static void pnv_program_cpu_hotplug_lpcr(unsigned int cpu, u64 lpcr_val)
 	u64 pir = get_hard_smp_processor_id(cpu);
 
 	mtspr(SPRN_LPCR, lpcr_val);
-	opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
+
+	/*
+	 * Program the LPCR via stop-api only for deepest stop state
+	 * can lose hypervisor context.
+	 */
+	if (supported_cpuidle_states & OPAL_PM_LOSE_FULL_CONTEXT)
+		opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
 }
 
 /*
-- 
1.9.4

[toc] | [next] | [standalone]


#1724157 — Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline

FromNicholas Piggin <npiggin@gmail.com>
Date2017-08-31 14:10 +0200
SubjectRe: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline
Message-ID<ukwsi-5u5-29@gated-at.bofh.it>
In reply to#1724127
On Thu, 31 Aug 2017 17:17:41 +0530
"Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote:

> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> 
> commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> stop-api only on Hotplug") clears the PECE1 bit of the LPCR via
> stop-api during CPU-Hotplug to prevent wakeup due to a decrementer on
> an offlined CPU which is in a deep stop state.
> 
> In the case where the stop-api support is found to be lacking, the
> commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT
> states when stop-api fails") disables deep states that lose hypervisor
> context. Thus in this case, the offlined CPU will be put to some
> shallow idle state.
> 
> However, we currently unconditionally clear the PECE1 in LPCR via
> stop-api during CPU-Hotplug even when deep states are disabled due to
> stop-api failure.
> 
> Fix this by clearing PECE1 of LPCR via stop-api during CPU-Hotplug
> *only* when the offlined CPU will be put to a deep state that loses
> hypervisor context.

This looks okay to me. The bug is due to calling opal_slw_set_reg when
firmware has not enabled that feature, right?

> 
> Fixes: commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> stop-api only on Hotplug")
> 
> Reported-by: Pavithra Prakash <pavirampu@linux.vnet.ibm.com>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/powernv/idle.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
> index 9f59041..23f8fba 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -393,7 +393,13 @@ static void pnv_program_cpu_hotplug_lpcr(unsigned int cpu, u64 lpcr_val)
>  	u64 pir = get_hard_smp_processor_id(cpu);
>  
>  	mtspr(SPRN_LPCR, lpcr_val);
> -	opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> +
> +	/*
> +	 * Program the LPCR via stop-api only for deepest stop state
> +	 * can lose hypervisor context.
> +	 */
> +	if (supported_cpuidle_states & OPAL_PM_LOSE_FULL_CONTEXT)
> +		opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
>  }
>  
>  /*

[toc] | [prev] | [next] | [standalone]


#1724933 — Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline

FromAkshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Date2017-09-01 12:10 +0200
SubjectRe: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline
Message-ID<ukR3H-2tp-7@gated-at.bofh.it>
In reply to#1724127
On 08/31/2017 05:37 PM, Nicholas Piggin wrote:
> On Thu, 31 Aug 2017 17:17:41 +0530
> "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote:
>
> > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> >
> > commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> > stop-api only on Hotplug") clears the PECE1 bit of the LPCR via
> > stop-api during CPU-Hotplug to prevent wakeup due to a decrementer on
> > an offlined CPU which is in a deep stop state.
> >
> > In the case where the stop-api support is found to be lacking, the
> > commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT
> > states when stop-api fails") disables deep states that lose hypervisor
> > context. Thus in this case, the offlined CPU will be put to some
> > shallow idle state.
> >
> > However, we currently unconditionally clear the PECE1 in LPCR via
> > stop-api during CPU-Hotplug even when deep states are disabled due to
> > stop-api failure.
> >
> > Fix this by clearing PECE1 of LPCR via stop-api during CPU-Hotplug
> > *only* when the offlined CPU will be put to a deep state that loses
> > hypervisor context.
>
> This looks okay to me. The bug is due to calling opal_slw_set_reg when
> firmware has not enabled that feature, right?
Yes,

In the case where the stop-api support is found to be lacking, the 
commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT 
states when stop-api fails") disables deep states that lose hypervisor 
context. Thus in this case, the offlined CPU will be put to some shallow 
idle state.

If a shallow state ( < stop4 ) is being chosen for cpu hotplug, then :
1) this opal call is not required.
2) may not be supported.

Hence  should call opal_slw_set_reg() only if a deep state chosen for 
cpu hotplug.
>
> >
> > Fixes: commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> > stop-api only on Hotplug")
> >
> > Reported-by: Pavithra Prakash <pavirampu@linux.vnet.ibm.com>
> > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> > ---
> >  arch/powerpc/platforms/powernv/idle.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/platforms/powernv/idle.c
> b/arch/powerpc/platforms/powernv/idle.c
> > index 9f59041..23f8fba 100644
> > --- a/arch/powerpc/platforms/powernv/idle.c
> > +++ b/arch/powerpc/platforms/powernv/idle.c
> > @@ -393,7 +393,13 @@ static void
> pnv_program_cpu_hotplug_lpcr(unsigned int cpu, u64 lpcr_val)
> >      u64 pir = get_hard_smp_processor_id(cpu);
> >
> >      mtspr(SPRN_LPCR, lpcr_val);
> > -    opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> > +
> > +    /*
> > +     * Program the LPCR via stop-api only for deepest stop state
> > +     * can lose hypervisor context.
> > +     */
> > +    if (supported_cpuidle_states & OPAL_PM_LOSE_FULL_CONTEXT)
> > +        opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> >  }
> >
> >  /*
>

[toc] | [prev] | [next] | [standalone]


#1724952 — Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline

FromNicholas Piggin <npiggin@gmail.com>
Date2017-09-01 12:40 +0200
SubjectRe: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline
Message-ID<ukRwK-2IO-17@gated-at.bofh.it>
In reply to#1724933
On Fri, 1 Sep 2017 15:38:59 +0530
Akshay Adiga <akshay.adiga@linux.vnet.ibm.com> wrote:

> On 08/31/2017 05:37 PM, Nicholas Piggin wrote:
> > On Thu, 31 Aug 2017 17:17:41 +0530
> > "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote:
> >  
> > > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> > >
> > > commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> > > stop-api only on Hotplug") clears the PECE1 bit of the LPCR via
> > > stop-api during CPU-Hotplug to prevent wakeup due to a decrementer on
> > > an offlined CPU which is in a deep stop state.
> > >
> > > In the case where the stop-api support is found to be lacking, the
> > > commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT
> > > states when stop-api fails") disables deep states that lose hypervisor
> > > context. Thus in this case, the offlined CPU will be put to some
> > > shallow idle state.
> > >
> > > However, we currently unconditionally clear the PECE1 in LPCR via
> > > stop-api during CPU-Hotplug even when deep states are disabled due to
> > > stop-api failure.
> > >
> > > Fix this by clearing PECE1 of LPCR via stop-api during CPU-Hotplug
> > > *only* when the offlined CPU will be put to a deep state that loses
> > > hypervisor context.  
> >
> > This looks okay to me. The bug is due to calling opal_slw_set_reg when
> > firmware has not enabled that feature, right?  
> Yes,
> 
> In the case where the stop-api support is found to be lacking, the 
> commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT 
> states when stop-api fails") disables deep states that lose hypervisor 
> context. Thus in this case, the offlined CPU will be put to some shallow 
> idle state.
> 
> If a shallow state ( < stop4 ) is being chosen for cpu hotplug, then :
> 1) this opal call is not required.
> 2) may not be supported.
> 
> Hence  should call opal_slw_set_reg() only if a deep state chosen for 
> cpu hotplug.

That makes sense, thanks for confirming.

> >  
> > >
> > > Fixes: commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> > > stop-api only on Hotplug")
> > >
> > > Reported-by: Pavithra Prakash <pavirampu@linux.vnet.ibm.com>
> > > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>


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


> > > ---
> > >  arch/powerpc/platforms/powernv/idle.c | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/powerpc/platforms/powernv/idle.c  
> > b/arch/powerpc/platforms/powernv/idle.c  
> > > index 9f59041..23f8fba 100644
> > > --- a/arch/powerpc/platforms/powernv/idle.c
> > > +++ b/arch/powerpc/platforms/powernv/idle.c
> > > @@ -393,7 +393,13 @@ static void  
> > pnv_program_cpu_hotplug_lpcr(unsigned int cpu, u64 lpcr_val)  
> > >      u64 pir = get_hard_smp_processor_id(cpu);
> > >
> > >      mtspr(SPRN_LPCR, lpcr_val);
> > > -    opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> > > +
> > > +    /*
> > > +     * Program the LPCR via stop-api only for deepest stop state
> > > +     * can lose hypervisor context.
> > > +     */
> > > +    if (supported_cpuidle_states & OPAL_PM_LOSE_FULL_CONTEXT)
> > > +        opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> > >  }
> > >
> > >  /*  
> >  
> 

[toc] | [prev] | [next] | [standalone]


#1727249 — Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline

Frompavrampu <pavrampu@linux.vnet.ibm.com>
Date2017-09-06 11:00 +0200
SubjectRe: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline
Message-ID<umElI-7Em-25@gated-at.bofh.it>
In reply to#1724127
On 2017-08-31 17:17, Gautham R. Shenoy wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
> 
> commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> stop-api only on Hotplug") clears the PECE1 bit of the LPCR via
> stop-api during CPU-Hotplug to prevent wakeup due to a decrementer on
> an offlined CPU which is in a deep stop state.
> 
> In the case where the stop-api support is found to be lacking, the
> commit 785a12afdb4a ("powerpc/powernv/idle: Disable LOSE_FULL_CONTEXT
> states when stop-api fails") disables deep states that lose hypervisor
> context. Thus in this case, the offlined CPU will be put to some
> shallow idle state.
> 
> However, we currently unconditionally clear the PECE1 in LPCR via
> stop-api during CPU-Hotplug even when deep states are disabled due to
> stop-api failure.
> 
> Fix this by clearing PECE1 of LPCR via stop-api during CPU-Hotplug
> *only* when the offlined CPU will be put to a deep state that loses
> hypervisor context.
> 
> Fixes: commit 24be85a23d1f ("powerpc/powernv: Clear PECE1 in LPCR via
> stop-api only on Hotplug")
> 
> Reported-by: Pavithra Prakash <pavirampu@linux.vnet.ibm.com>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>

Tested-by: Pavithra Prakash <pavrampu@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/powernv/idle.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/idle.c
> b/arch/powerpc/platforms/powernv/idle.c
> index 9f59041..23f8fba 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -393,7 +393,13 @@ static void pnv_program_cpu_hotplug_lpcr(unsigned
> int cpu, u64 lpcr_val)
>  	u64 pir = get_hard_smp_processor_id(cpu);
> 
>  	mtspr(SPRN_LPCR, lpcr_val);
> -	opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> +
> +	/*
> +	 * Program the LPCR via stop-api only for deepest stop state
> +	 * can lose hypervisor context.
> +	 */
> +	if (supported_cpuidle_states & OPAL_PM_LOSE_FULL_CONTEXT)
> +		opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
>  }
> 
>  /*

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web