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>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [v2 PATCH 2/2] powernv/powerpc: Clear PECE1 in LPCR via stop-api only on Hotplug
Date: Wed, 19 Jul 2017 19:09:13 +1000 [thread overview]
Message-ID: <20170719190913.18ca21e5@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <4142c685fd33835db00eaecedf69186458c1c039.1500452107.git.ego@linux.vnet.ibm.com>
On Wed, 19 Jul 2017 13:48:50 +0530
"Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote:
> From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
>
> Currently we use the stop-api provided by the firmware to program the
> SLW engine to restore the values of hypervisor resources that get lost
> on deeper idle states (such as winkle). Since the deep states were
> only used for CPU-Hotplug on POWER8 systems, we would program the LPCR
> to have the PECE1 bit since Hotplugged CPUs shouldn't be spuriously
> woken up by decrementer.
>
> On POWER9, some of the deep platform idle states such as stop4 can be
> used in cpuidle as well. In this case, we want the CPU in stop4 to be
> woken up by the decrementer when some timer on the CPU expires.
>
> In this patch, for POWER9, we program the stop-api for LPCR with PECE1
> bit cleared only when we are offlining the CPU.
>
> Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> ---
> arch/powerpc/platforms/powernv/idle.c | 45 ++++++++++++++++++++++++++++++++++-
> arch/powerpc/platforms/powernv/smp.c | 10 --------
> 2 files changed, 44 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
> index 2abee07..a6c69b7 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -68,7 +68,7 @@ static int pnv_save_sprs_for_deep_states(void)
> * all cpus at boot. Get these reg values of current cpu and use the
> * same across all cpus.
> */
> - uint64_t lpcr_val = mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1;
> + uint64_t lpcr_val = mfspr(SPRN_LPCR);
> uint64_t hid0_val = mfspr(SPRN_HID0);
> uint64_t hid1_val = mfspr(SPRN_HID1);
> uint64_t hid4_val = mfspr(SPRN_HID4);
> @@ -85,6 +85,16 @@ static int pnv_save_sprs_for_deep_states(void)
> if (rc != 0)
> return rc;
>
> + /*
> + * On POWER8, the only state that uses SLW engine is
> + * winkle. This is only used for CPU-Hotplug. So we
> + * clear the decrementer bit from LPCR since we
> + * don't want to be woken up on decrementer when in
> + * winkle.
> + */
> + if (!cpu_has_feature(CPU_FTR_ARCH_300))
> + lpcr_val = lpcr_val & ~(u64)LPCR_PECE1;
> +
> rc = opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
> if (rc != 0)
> return rc;
> @@ -355,6 +365,15 @@ void power9_idle(void)
> }
>
> #ifdef CONFIG_HOTPLUG_CPU
> +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);
> + if (cpu_has_feature(CPU_FTR_ARCH_300))
> + opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val);
Is opal_slw_set_reg very heavyweight? If not, I would just remove the
POWER9 special casing entirely from both these functions, which follows
the principle of least surprise. Otherwise I guess it's reasonable.
Thanks for making those other changes, it looks good.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
prev parent reply other threads:[~2017-07-19 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 8:18 [v2 PATCH 0/2] powerpc: powernv: Enable stop4 via cpuidle Gautham R. Shenoy
2017-07-19 8:18 ` [v2 PATCH 1/2] powernv/powerpc:Save/Restore additional SPRs for stop4 cpuidle Gautham R. Shenoy
2017-07-19 9:03 ` Nicholas Piggin
2017-07-19 12:07 ` Michael Ellerman
2017-07-19 12:43 ` Gautham R Shenoy
2017-07-19 8:18 ` [v2 PATCH 2/2] powernv/powerpc: Clear PECE1 in LPCR via stop-api only on Hotplug Gautham R. Shenoy
2017-07-19 9:09 ` Nicholas Piggin [this message]
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=20170719190913.18ca21e5@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=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=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).