From: Nicholas Piggin <npiggin@gmail.com>
To: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Michael Neuling <mikey@neuling.org>,
Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>,
Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>,
Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] powernv:idle: Use Requested Level for restoring state on P9 DD1
Date: Tue, 30 May 2017 16:27:35 +1000 [thread overview]
Message-ID: <20170530162735.564f863e@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <70ede0d8bdcb14ea676c87f14a26788890a3ba4d.1494585671.git.ego@linux.vnet.ibm.com>
On Tue, 16 May 2017 14:19:47 +0530
"Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>
> On Power9 DD1 due to a hardware bug the Power-Saving Level Status
> field (PLS) of the PSSCR for a thread waking up from a deep state can
> under-report if some other thread in the core is in a shallow stop
> state. The scenario in which this can manifest is as follows:
>
> 1) All the threads of the core are in deep stop.
> 2) One of the threads is woken up. The PLS for this thread will
> correctly reflect that it is waking up from deep stop.
> 3) The thread that has woken up now executes a shallow stop.
> 4) When some other thread in the core is woken, its PLS will reflect
> the shallow stop state.
>
> Thus, the subsequent thread for which the PLS is under-reporting the
> wakeup state will not restore the hypervisor resources.
>
> Hence, on DD1 systems, use the Requested Level (RL) field as a
> workaround to restore the contents of the hypervisor resources on the
> wakeup from the stop state.
>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/paca.h | 2 ++
> arch/powerpc/kernel/asm-offsets.c | 1 +
> arch/powerpc/kernel/idle_book3s.S | 13 ++++++++++++-
> 3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
> index 1c09f8f..77f60a0 100644
> --- a/arch/powerpc/include/asm/paca.h
> +++ b/arch/powerpc/include/asm/paca.h
> @@ -177,6 +177,8 @@ struct paca_struct {
> * to the sibling threads' paca.
> */
> struct paca_struct **thread_sibling_pacas;
> + /* The PSSCR value that the kernel requested before going to stop */
> + u64 requested_psscr;
> #endif
>
> #ifdef CONFIG_PPC_STD_MMU_64
> diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
> index 709e234..e15c178 100644
> --- a/arch/powerpc/kernel/asm-offsets.c
> +++ b/arch/powerpc/kernel/asm-offsets.c
> @@ -742,6 +742,7 @@ int main(void)
> OFFSET(PACA_THREAD_MASK, paca_struct, thread_mask);
> OFFSET(PACA_SUBCORE_SIBLING_MASK, paca_struct, subcore_sibling_mask);
> OFFSET(PACA_SIBLING_PACA_PTRS, paca_struct, thread_sibling_pacas);
> + OFFSET(PACA_REQ_PSSCR, paca_struct, requested_psscr);
> #endif
>
> DEFINE(PPC_DBELL_SERVER, PPC_DBELL_SERVER);
> diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
> index 6c9920d..98a6d07 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -379,6 +379,7 @@ _GLOBAL(power9_idle_stop)
> mfspr r5,SPRN_PSSCR
> andc r5,r5,r4
> or r3,r3,r5
> + std r3, PACA_REQ_PSSCR(r13)
> mtspr SPRN_PSSCR,r3
> LOAD_REG_ADDR(r5,power_enter_stop)
> li r4,1
> @@ -498,12 +499,22 @@ pnv_restore_hyp_resource_arch300:
> LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state)
> ld r4,ADDROFF(pnv_first_deep_stop_state)(r5)
>
> - mfspr r5,SPRN_PSSCR
> +BEGIN_FTR_SECTION_NESTED(71)
> + /*
> + * Assume that we are waking up from the state
> + * same as the Requested Level (RL) in the PSSCR
> + * which are Bits 60-63
> + */
> + ld r5,PACA_REQ_PSSCR(r13)
> + rldicl r5,r5,0,60
> +FTR_SECTION_ELSE_NESTED(71)
> /*
> * 0-3 bits correspond to Power-Saving Level Status
> * which indicates the idle state we are waking up from
> */
> + mfspr r5, SPRN_PSSCR
> rldicl r5,r5,4,60
> +ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_POWER9_DD1, 71)
> cmpd cr4,r5,r4
> bge cr4,pnv_wakeup_tb_loss /* returns to caller */
>
next prev parent reply other threads:[~2017-05-30 6:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 8:49 [PATCH 0/6] Enable support for deep-stop states on POWER9 Gautham R. Shenoy
2017-05-16 8:49 ` [PATCH 1/6] powernv:idle: Correctly initialize core_idle_state_ptr Gautham R. Shenoy
2017-05-30 5:56 ` Nicholas Piggin
2017-05-30 10:23 ` Gautham R Shenoy
2017-05-30 9:11 ` [1/6] " Michael Ellerman
2017-05-16 8:49 ` [PATCH 2/6] powernv:idle: Decouple Timebase restore & Per-core SPRs restore Gautham R. Shenoy
2017-05-30 6:12 ` Nicholas Piggin
2017-05-30 10:28 ` Gautham R Shenoy
2017-05-16 8:49 ` [PATCH 3/6] powernv:idle: Restore LPCR on wakeup from deep-stop Gautham R. Shenoy
2017-05-30 6:17 ` Nicholas Piggin
2017-05-30 10:35 ` Gautham R Shenoy
2017-05-16 8:49 ` [PATCH 4/6] powernv:idle: Restore SPRs for deep idle states via stop API Gautham R. Shenoy
2017-05-16 8:49 ` [PATCH 5/6] powernv:idle: Use Requested Level for restoring state on P9 DD1 Gautham R. Shenoy
2017-05-30 6:27 ` Nicholas Piggin [this message]
2017-05-16 8:49 ` [PATCH 6/6] cpuidle-powernv: Allow Deep stop states that don't stop time Gautham R. Shenoy
2017-05-30 7:13 ` Nicholas Piggin
2017-05-30 10:50 ` Gautham R Shenoy
2017-05-30 11:10 ` Nicholas Piggin
2017-05-31 8:39 ` Gautham R Shenoy
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=20170530162735.564f863e@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=akshay.adiga@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=shilpa.bhat@linux.vnet.ibm.com \
--cc=svaidy@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).