Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752115AbdGSFFG (ORCPT ); Wed, 19 Jul 2017 01:05:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53891 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751968AbdGSFFE (ORCPT ); Wed, 19 Jul 2017 01:05:04 -0400 Date: Wed, 19 Jul 2017 10:34:59 +0530 From: Gautham R Shenoy To: Nicholas Piggin Cc: "Gautham R. Shenoy" , Michael Ellerman , Michael Neuling , Vaidyanathan Srinivasan , Shilpasri G Bhat , Akshay Adiga , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] powernv/powerpc: Clear PECE1 in LPCR via stop-api only on Hotplug Reply-To: ego@linux.vnet.ibm.com References: <20170719121412.1d89857c@roar.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170719121412.1d89857c@roar.ozlabs.ibm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 x-cbid: 17071905-0040-0000-0000-000003826E7A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007385; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00889654; UDB=6.00444408; IPR=6.00669826; BA=6.00005479; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016270; XFM=3.00000015; UTC=2017-07-19 05:05:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071905-0041-0000-0000-0000077682E6 Message-Id: <20170719050459.GA30836@in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-19_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707190081 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2925 Lines: 90 Hello Nicholas, On Wed, Jul 19, 2017 at 12:14:12PM +1000, Nicholas Piggin wrote: > Thanks for working on these patches. We really need to get this stuff > merged and tested asap :) > > On Tue, 18 Jul 2017 19:58:49 +0530 [..snip..] > > diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c > > index 40dae96..5f2a712 100644 > > --- a/arch/powerpc/platforms/powernv/smp.c > > +++ b/arch/powerpc/platforms/powernv/smp.c > > @@ -143,7 +143,8 @@ static void pnv_smp_cpu_kill_self(void) > > { > > unsigned int cpu; > > unsigned long srr1, wmask; > > - > > + uint64_t lpcr_val; > > + uint64_t pir; > > /* Standard hot unplug procedure */ > > /* > > * This hard disables local interurpts, ensuring we have no lazy > > @@ -164,13 +165,17 @@ static void pnv_smp_cpu_kill_self(void) > > if (cpu_has_feature(CPU_FTR_ARCH_207S)) > > wmask = SRR1_WAKEMASK_P8; > > > > + pir = get_hard_smp_processor_id(cpu); > > /* We don't want to take decrementer interrupts while we are offline, > > * so clear LPCR:PECE1. We keep PECE2 (and LPCR_PECE_HVEE on P9) > > * enabled as to let IPIs in. > > */ > > - mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1); > > + lpcr_val = mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1; > > + mtspr(SPRN_LPCR, lpcr_val); > > > > while (!generic_check_cpu_restart(cpu)) { > > + > > + > > /* > > * Clear IPI flag, since we don't handle IPIs while > > * offline, except for those when changing micro-threading > > @@ -180,8 +185,15 @@ static void pnv_smp_cpu_kill_self(void) > > */ > > kvmppc_set_host_ipi(cpu, 0); > > > > + /* > > + * If the CPU gets woken up by a special wakeup, > > + * ensure that the SLW engine sets LPCR with > > + * decrementer bit cleared, else we will get spurious > > + * wakeups. > > + */ > > + if (cpu_has_feature(CPU_FTR_ARCH_300)) > > + opal_slw_set_reg(pir, SPRN_LPCR, lpcr_val); > > Can you put these details into pnv_cpu_offline? Possibly even from there > into another special SPR save function? E.g., We could move this to pnv_cpu_offline. Except that if we do get spurious interrupts, we will end up programming the the LPCR via stop-api again which is not needed. Even this patch above can be optimized further. We need to program the LPCR with the PECE1 bit cleared only once, before the while loop, and once again program the LPCR with PECE1 bit set once we are out of the while loop. But then, perhaps getting spurious interrupts when the CPU is hotplugged is an unlikely event. So I will move this to pnv_cpu_offline. > > pnv_save_sprs_for_deep_state_decrementer_wakeup(bool decrementer_wakeup) > > I'd like to put the LPCR manipulation for idle wake settings into idle.c > as well (pnv_cpu_offline), I think it fits better in there. > I agree. Will respin this,test and send out the v2. > Thanks, Thanks for the review. > Nick > -- Thanks and Regards gautham.