From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org,
"Gautham R . Shenoy" <ego@linux.vnet.ibm.com>,
Paul Mackerras <paulus@ozlabs.org>
Subject: Re: [PATCH 1/3] powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug
Date: Wed, 28 Feb 2018 23:54:13 +0530 [thread overview]
Message-ID: <20180228182413.GB20168@drishya.in.ibm.com> (raw)
In-Reply-To: <20171117140807.22105-2-npiggin@gmail.com>
* Nicholas Piggin <npiggin@gmail.com> [2017-11-18 00:08:05]:
> Implement a new function to invoke stop, power9_offline_stop, which is
> like power9_idle_stop but used by the cpu hotplug code.
>
> Move KVM secondary state manipulation code to the offline case.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
> ---
> arch/powerpc/include/asm/processor.h | 1 +
> arch/powerpc/kernel/idle_book3s.S | 24 ++++++++++++++++++------
> arch/powerpc/platforms/powernv/idle.c | 2 +-
> 3 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
> index bdab3b74eb98..0ebdb58460ce 100644
> --- a/arch/powerpc/include/asm/processor.h
> +++ b/arch/powerpc/include/asm/processor.h
> @@ -500,6 +500,7 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */
> extern unsigned long power7_idle_insn(unsigned long type); /* PNV_THREAD_NAP/etc*/
> extern void power7_idle_type(unsigned long type);
> extern unsigned long power9_idle_stop(unsigned long psscr_val);
> +extern unsigned long power9_offline_stop(unsigned long psscr_val);
> extern void power9_idle_type(unsigned long stop_psscr_val,
> unsigned long stop_psscr_mask);
>
> diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
> index 01e1c1997893..2f8364e7b489 100644
> --- a/arch/powerpc/kernel/idle_book3s.S
> +++ b/arch/powerpc/kernel/idle_book3s.S
> @@ -325,12 +325,6 @@ enter_winkle:
> * r3 - PSSCR value corresponding to the requested stop state.
> */
> power_enter_stop:
> -#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
> - /* Tell KVM we're entering idle */
> - li r4,KVM_HWTHREAD_IN_IDLE
> - /* DO THIS IN REAL MODE! See comment above. */
> - stb r4,HSTATE_HWTHREAD_STATE(r13)
> -#endif
> /*
> * Check if we are executing the lite variant with ESL=EC=0
> */
> @@ -435,6 +429,24 @@ _GLOBAL(power9_idle_stop)
> b pnv_powersave_common
> /* No return */
>
> +/*
> + * Entered with MSR[EE]=0 and no soft-masked interrupts pending.
> + * r3 contains desired PSSCR register value.
> + */
> +_GLOBAL(power9_offline_stop)
> + std r3, PACA_REQ_PSSCR(r13)
> + mtspr SPRN_PSSCR,r3
> +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
> + /* Tell KVM we're entering idle */
> + li r4,KVM_HWTHREAD_IN_IDLE
> + /* DO THIS IN REAL MODE! See comment above. */
> + stb r4,HSTATE_HWTHREAD_STATE(r13)
> +#endif
> + LOAD_REG_ADDR(r4,power_enter_stop)
> + b pnv_powersave_common
> + /* No return */
> +
Good optimization. This code is needed only when an offline thread is
wokenup at 0x100 to get into guest. Can be skipped in idle wakeup
case.
> +
> /*
> * On waking up from stop 0,1,2 with ESL=1 on POWER9 DD1,
> * HSPRG0 will be set to the HSPRG0 value of one of the
> diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
> index 443d5ca71995..a921d5428d76 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -434,7 +434,7 @@ unsigned long pnv_cpu_offline(unsigned int cpu)
> psscr = mfspr(SPRN_PSSCR);
> psscr = (psscr & ~pnv_deepest_stop_psscr_mask) |
> pnv_deepest_stop_psscr_val;
> - srr1 = power9_idle_stop(psscr);
> + srr1 = power9_offline_stop(psscr);
>
> } else if ((idle_states & OPAL_PM_WINKLE_ENABLED) &&
> (idle_states & OPAL_PM_LOSE_FULL_CONTEXT)) {
> --
> 2.15.0
>
next prev parent reply other threads:[~2018-02-28 18:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 14:08 [PATCH 0/3] one more try at idle improvements Nicholas Piggin
2017-11-17 14:08 ` [PATCH 1/3] powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug Nicholas Piggin
2018-02-28 18:24 ` Vaidyanathan Srinivasan [this message]
2018-04-03 16:03 ` [1/3] " Michael Ellerman
2018-04-03 17:13 ` Nicholas Piggin
2018-04-04 12:52 ` Michael Ellerman
2017-11-17 14:08 ` [PATCH 2/3] powerpc/64s/idle: avoid sync for KVM state when waking from idle Nicholas Piggin
2018-02-28 18:16 ` Vaidyanathan Srinivasan
2018-03-01 11:38 ` Nicholas Piggin
2018-04-03 16:03 ` [2/3] " Michael Ellerman
2017-11-17 14:08 ` [PATCH 3/3] powerpc/64s/idle: POWER9 ESL=0 stop avoid save/restore overhead Nicholas Piggin
2018-02-28 18:34 ` Vaidyanathan Srinivasan
2018-03-01 11:57 ` Nicholas Piggin
2018-03-04 23:01 ` Paul Mackerras
2018-03-05 9:59 ` Nicholas Piggin
2018-03-31 11: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=20180228182413.GB20168@drishya.in.ibm.com \
--to=svaidy@linux.vnet.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=paulus@ozlabs.org \
/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).