Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751235AbbHAA3R (ORCPT ); Fri, 31 Jul 2015 20:29:17 -0400 Received: from mail-bn1on0138.outbound.protection.outlook.com ([157.56.110.138]:26896 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750804AbbHAA3Q (ORCPT ); Fri, 31 Jul 2015 20:29:16 -0400 Authentication-Results: freescale.com; dkim=none (message not signed) header.d=none; Message-ID: <1438388082.19345.85.camel@freescale.com> Subject: Re: [PATCH 2/3] PowerPC/mpc85xx: Add hotplug support on E5500 and E500MC cores From: Scott Wood To: CC: , , Tang Yuantian , Chenhui Zhao , Tang Yuantian Date: Fri, 31 Jul 2015 19:14:42 -0500 In-Reply-To: <1438334444-31919-2-git-send-email-b29983@freescale.com> References: <1438334444-31919-1-git-send-email-b29983@freescale.com> <1438334444-31919-2-git-send-email-b29983@freescale.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.0-fta1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:448:8100:f9f:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: BY2PR21CA0023.namprd21.prod.outlook.com (25.162.74.161) To BLUPR03MB1473.namprd03.prod.outlook.com (25.163.81.158) X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1473;2:5O7D6VIg8N0jmEykeOWM1kRUDElmwd7UdgSqOzChJZSA5nhNASh+C2VdcNxHn6vyZmZAMx3D5DGobMwWuWbnzgl7NaGaVyOjD7R000KJGn85oDIU/7L6Q54MPVAVf+x+MgewKp7JUbyQDGniD1h2K3uUsTLQLiqJeRE8dQu6Cas=;3:UQwpxq87jTIcepLmRbV+bd44Elx0H8NyoZ6R5b7izy/bLOZGJJnu34cAIDTj42AV+0wqsgygnSA1YLqNv9ZMsI6pPcDN+jGKpEUiiLotbq7xNHovhyJ5wF8L4mQ3SENANHZ8uTkzl3Zn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OdVr/hxgdqPpaZNYMu6F3f9ebN/sumF+yR/pQyvQDfBWplo6BYNb88yjSKAkaoG+y4SkEB0B15SqkoLMqoNArEvwp5VTliWvHOMQgPyNXOD2VqRI1Ste0OyaabFVe0I3bkGmojtM0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BLUPR03MB1473;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1473; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(377424004)(110136002)(36756003)(189998001)(62966003)(103116003)(5001960100002)(50466002)(50226001)(77096005)(92566002)(77156002)(5820100001)(122386002)(575784001)(4001450100002)(2351001)(86362001)(50986999)(2950100001)(76176999)(47776003)(33646002)(46102003)(19580405001)(2371004)(23676002)(42186005)(40100003)(19580395003)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1473;H:[IPv6:2601:448:8100:f9f:12bf:48ff:fe84:c9a0];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1473;23:z7H6bIYyuZQEy8OSuVK9raXTsJeqNRKPPbl8vClJ79a1ckwhm/8K7iptHa1h7pdFWVwgabjkKyMQi8EesFdv5MaXaHfRsYMqPF4olAfHXdH2IAHNPqH/lFRsymHmaesdDCUPyYmR2c3hfYw7jWy2xLYNMOcnY8BWCAeZVZ9hoOtc/2SY1mO4Sph22pqBPr0ipKrFWjZ0rgisNz8bHvZH3FpBYATd80/M2KGIrbAnGOh+sa1s8ZF7pf4eBNeCCsy3oJa2SqNrMVyiH6CIhS/xFHt3Ifd7nd9xfdzyw9u8rUuUN09Orqr/cqK+J/GENpglxfcYMqHZByt8R9pbDUE/br33aYataSbEve4m3OfzuZoSvQoEE1ppPMbrMKu1aDKucWx7KwLV3wXSM1jS4k+wjMPOhHFUujRPpEZyUHn0w0Rvh71lXQ5mbEwCw4cRpfHqA0D4vKKhlUCGPZR2SFfk5FgiB4teihIorzErZ37cmBUV7OaGSsYGv3pu08fiPaGK/irsJB+WdWpGGP+cqYdjctGBGvRLO/w6Y0KOL+FnbRF3B3HshksPnIFOnH3eqe6fhWABwms9TEVQl6PpWO1X8+z3wzWDyoWsS1Rn2uW5H3cIejXyLfhg8M/Y2cSid0fYfB2IdW/W7maIsPPv4491nkd6BI9Rf/jZ9XnoE8vPjjwfkNHShMNdSOJdx03ml2v5daHRIwCQEmc7FS9y9Ico7+ULSh9FF/xYS13nXMHXLgCbbLv2Z5DbZzJhVR4ypx2SiOcQIx03KzD8T5FLSZvN/Sd5e8RvEjOhK8AJpH6Xa3t7kKtbGgyL4QGZWJA1E5Wo4MZ3z4LCn2r0DcZiLleYk0YxkUNuJ554AbQ+jiXCxbYhpRQkExh5pE5QscV4uXhCJ9d9jD8CLX7JgqyXypOlRA== X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB1473;5:1LBTrxplwcJHCkR5N80boTLmlUKkQMTFgEl2CiJecDgwcfAG/l0XqoXXTtBtHVvxYPpOUJ+DyKUoqvCQL9tjzY1PR6KyFh2ZNCrD89lOfF1cWe9C2P0uNWIvcpXZpsU7pkND5NHO+Fa/o58f8vHmAA==;24:QcK9VZF9HfSo5Cy+8kpEpdzol3fJ383vVLweFsVo+MSZDzcq++U+5hG8Q2wjIldnpkzaL+zGhYXZPRJ3tS2ZtxJPwS0OrPrkBiFmPbgmvGg=;20:CYrSmZSQb404Ge+zT8Bh/r4GuUlhR5+/ghBKGNoW8Ip2TrzxOzbDLXVbSAPGhAPuYFv1P1MUL+/fidU/VfFSag== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2015 00:14:49.8198 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1473 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5130 Lines: 168 On Fri, 2015-07-31 at 17:20 +0800, b29983@freescale.com wrote: > From: Tang Yuantian > > Freescale E500MC and E5500 core-based platforms, like P4080, T1040, > support disabling/enabling CPU dynamically. > This patch adds this feature on those platforms. > > Signed-off-by: Chenhui Zhao > Signed-off-by: Tang Yuantian > --- > arch/powerpc/Kconfig | 2 +- > arch/powerpc/include/asm/smp.h | 1 + > arch/powerpc/kernel/smp.c | 5 +++++ > arch/powerpc/platforms/85xx/smp.c | 39 ++++++++++++++++++++++++++++++++---- > --- > 4 files changed, 39 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index 5ef2711..dd9e252 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -386,7 +386,7 @@ config SWIOTLB > config HOTPLUG_CPU > bool "Support for enabling/disabling CPUs" > depends on SMP && (PPC_PSERIES || \ > - PPC_PMAC || PPC_POWERNV || (PPC_85xx && !PPC_E500MC)) > + PPC_PMAC || PPC_POWERNV || FSL_SOC_BOOKE) > ---help--- > Say Y here to be able to disable and re-enable individual > CPUs at runtime on SMP machines. > diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h > index 825663c..bf37d17 100644 > --- a/arch/powerpc/include/asm/smp.h > +++ b/arch/powerpc/include/asm/smp.h > @@ -67,6 +67,7 @@ void generic_cpu_die(unsigned int cpu); > void generic_set_cpu_dead(unsigned int cpu); > void generic_set_cpu_up(unsigned int cpu); > int generic_check_cpu_restart(unsigned int cpu); > +int generic_check_cpu_dead(unsigned int cpu); > #endif > > #ifdef CONFIG_PPC64 > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c > index ec9ec20..2cca27a 100644 > --- a/arch/powerpc/kernel/smp.c > +++ b/arch/powerpc/kernel/smp.c > @@ -454,6 +454,11 @@ int generic_check_cpu_restart(unsigned int cpu) > return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; > } > > +int generic_check_cpu_dead(unsigned int cpu) > +{ > + return per_cpu(cpu_state, cpu) == CPU_DEAD; > +} Is there a non-generic check_cpu_dead()? It gets open-coded in generic_cpu_die()... Either open-code it elsewhere, or call it check_cpu_dead() and use it everywhere there's a CPU_DEAD check. > + > static bool secondaries_inhibited(void) > { > return kvm_hv_mode_active(); > diff --git a/arch/powerpc/platforms/85xx/smp.c > b/arch/powerpc/platforms/85xx/smp.c > index 6811a5b..7f0dadb 100644 > --- a/arch/powerpc/platforms/85xx/smp.c > +++ b/arch/powerpc/platforms/85xx/smp.c > @@ -42,6 +42,7 @@ struct epapr_spin_table { > u32 pir; > }; > > +#ifdef CONFIG_HOTPLUG_CPU > static u64 timebase; > static int tb_req; > static int tb_valid; > @@ -111,7 +112,7 @@ static void mpc85xx_take_timebase(void) > local_irq_restore(flags); > } > > -#ifdef CONFIG_HOTPLUG_CPU > +#ifndef CONFIG_PPC_E500MC > static void e500_cpu_idle(void) What happens if we bisect to patch 1/3 and run this on e500mc? Please move the ifdef to that patch. > { > u32 tmp; > @@ -127,6 +128,7 @@ static void e500_cpu_idle(void) > mtmsr(tmp); > isync(); > } > +#endif > > static void qoriq_cpu_dying(void) > { > @@ -144,11 +146,30 @@ static void qoriq_cpu_dying(void) > > generic_set_cpu_dead(cpu); > > +#ifndef CONFIG_PPC_E500MC > e500_cpu_idle(); > +#endif > > while (1) > ; > } > + > +static void qoriq_real_cpu_die(unsigned int cpu) Real as opposed to...? > +{ > + int i; > + > + for (i = 0; i < 50000; i++) { > + if (generic_check_cpu_dead(cpu)) { > + qoriq_pm_ops->cpu_die(cpu); > +#ifdef CONFIG_PPC64 > + paca[cpu].cpu_start = 0; > +#endif > + return; > + } > + udelay(10); > + } > + pr_err("%s: CPU%d didn't die...\n", __func__, cpu); > +} Only 500ms timeout, versus 10sec in generic_cpu_die()? > #endif > > static inline void flush_spin_table(void *spin_table) > @@ -246,11 +267,7 @@ static int smp_85xx_kick_cpu(int nr) > spin_table = phys_to_virt(*cpu_rel_addr); > > local_irq_save(flags); > -#ifdef CONFIG_PPC32 > #ifdef CONFIG_HOTPLUG_CPU > - /* Corresponding to generic_set_cpu_dead() */ > - generic_set_cpu_up(nr); > - > if (system_state == SYSTEM_RUNNING) { > /* > * To keep it compatible with old boot program which uses > @@ -263,6 +280,7 @@ static int smp_85xx_kick_cpu(int nr) > out_be32(&spin_table->addr_l, 0); > flush_spin_table(spin_table); > > + qoriq_pm_ops->cpu_up(nr); Again, is it possible to get here without a valid qoriq_pm_ops (i.e. is there anything stopping the user from trying to initiate CPU hotplug)? -Scott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/