Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751463AbdHaMIT (ORCPT ); Thu, 31 Aug 2017 08:08:19 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:33357 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750990AbdHaMIS (ORCPT ); Thu, 31 Aug 2017 08:08:18 -0400 X-Google-Smtp-Source: ADKCNb7xB9ooJavnqN6gMeJjikLt5TIsqjK3CZ3UChXyaemAYNLJHjvCfM5RSiB1oixX7fjbiqdkrg== Date: Thu, 31 Aug 2017 22:07:58 +1000 From: Nicholas Piggin To: "Gautham R. Shenoy" Cc: Michael Ellerman , Vaidyanathan Srinivasan , Shilpasri G Bhat , Akshay Adiga , Pavithra Prakash , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/powernv: Clear LPCR[PECE1] via stop-api only for deep state offline Message-ID: <20170831220758.5a5d2171@roar.ozlabs.ibm.com> In-Reply-To: <1504180061-32345-1-git-send-email-ego@linux.vnet.ibm.com> References: <1504180061-32345-1-git-send-email-ego@linux.vnet.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2180 Lines: 56 On Thu, 31 Aug 2017 17:17:41 +0530 "Gautham R. Shenoy" wrote: > From: "Gautham R. Shenoy" > > 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 > Signed-off-by: Gautham R. Shenoy > --- > 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); > } > > /*