linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>,
	Pavithra Prakash <pavirampu@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org,
	"Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Subject: Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline
Date: Fri, 1 Sep 2017 15:38:59 +0530	[thread overview]
Message-ID: <e75eda1b-c6ae-fe74-d45c-2c98e366be2a@linux.vnet.ibm.com> (raw)
In-Reply-To: <>


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);
> >  }
> >
> >  /*
>

  parent reply	other threads:[~2017-09-01 10:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 11:47 [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline Gautham R. Shenoy
2017-08-31 12:07 ` Nicholas Piggin
2017-09-01 10:08 ` Akshay Adiga [this message]
2017-09-01 10:38   ` Nicholas Piggin
2017-09-06  9:02 ` pavrampu
2017-09-19 14:32   ` Akshay Adiga
2017-09-21  1:46 ` 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=e75eda1b-c6ae-fe74-d45c-2c98e366be2a@linux.vnet.ibm.com \
    --to=akshay.adiga@linux.vnet.ibm.com \
    --cc=ego@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    --cc=pavirampu@linux.vnet.ibm.com \
    --cc=shilpa.bhat@linux.vnet.ibm.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).