Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753370AbbHCLwM (ORCPT ); Mon, 3 Aug 2015 07:52:12 -0400 Received: from mail-by2on0106.outbound.protection.outlook.com ([207.46.100.106]:15953 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752833AbbHCLwK (ORCPT ); Mon, 3 Aug 2015 07:52:10 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; feescale.com; dkim=none (message not signed) header.d=none; Date: Mon, 3 Aug 2015 19:52:04 +0800 From: Chenhui Zhao Subject: Re: [PATCH 2/3] PowerPC/mpc85xx: Add hotplug support on E5500 and E500MC cores To: Scott Wood CC: , , , Tang Yuantian , Tang Yuantian Message-ID: <1438602724.7515.3@remotesmtp.freescale.net> In-Reply-To: <1438388082.19345.85.camel@freescale.com> References: <1438334444-31919-1-git-send-email-b29983@freescale.com> <1438334444-31919-2-git-send-email-b29983@freescale.com> <1438388082.19345.85.camel@freescale.com> X-Mailer: geary/0.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD026;1:xXGxu0NiUDE74+HUgzuXIK4Lh2Nr0mZPTUyNJqSTn3ahu9HF1v2UpvbULshocsY+f4O0TX3U+XsQMEqeGWbQ6AGwYcwWhhYxKHu6h4gKbPs87DATsTo1/cLbXUctvZVNW2YrNdDx3/xn6nzUt8PLcEHW2MF6mP0FX31MYzZIpgybA01Rn4nWP9hQStYeg85tmxhmMOc8YTHnp5HTcgJE12Qh9PqbriuXw+lG8Nv0Jq71lFmO390jF1F7X7pH4IMgt2N1rMi6YcEQwAtQt3PPnMaC4mvvztzIuE23gNK265Gym6RuM1dD6BZyeIEwAjHxHF+hmBS3v6SLis9CsloQfg== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(24454002)(377454003)(377424004)(189002)(189998001)(46102003)(92566002)(50986999)(76176999)(106466001)(50226001)(19580395003)(5001960100002)(88526003)(110136002)(4001450100002)(23676002)(6806004)(19580405001)(62966003)(77156002)(86362001)(575784001)(47776003)(77096005)(105606002)(50466002)(104016003)(87936001)(85426001)(2950100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB562;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB562;2:dKyt8S/nP9D5l+gJJeI+yYvfbLsA2MQ9gRT8H3YQLVEpaFvNO2xPtJ1NSL28D0nX7f3TU4DCSIrJN+RwBGjz8bBFUI36WzOBJuGzw8KkzaTiGVMRD3PHonkzmNLzMohQqZ7pCVT3kAyw0MLFHbCgNyt/aJBgO91ddLCaie9ebLM=;3:8xTo+NM/BkiyFiDaK0NNh7ueo37sKvU79CwF/pyha5OlRmNJkL0+5d9BGUWNRRPnIdMQ10UQoiySxePXKHUVlQ4HAXFJnPKx8fS+efStUE1IGiuvUVjJxjDaVlWw9jL1IaeGpQdkfPANOsaBYQVlDNxH1y32wMrnu4sKpViOxN6mr6a2/OLh1OqUwqvbh/Hh/9kJxF4iSlaM8XmgGhb0f0Q/KCKJ0aifCv+IsL3PBGA=;25:kTJ2LZZ3sbsiD3KiFnkt9xhaL/1HwYsTJ6Uwcx+5ls53KISkfihTJKKmOjw0G+PVyxp+91N4b1KF3Eg7VjXH4Kig/FJQxHESyp0zTaokMP8YBr1G8r4F7JEryCyB9tTtcS/E01JQS8EMWLGqeuPX3QEmS4NLjNpbCbT/5J2nERAZVw1yxFPGgpDRswwIgYnp0hQM6XQPrD9UAGNm8IiXgyqsOGxi9MDnuUHCw/NVCdzer0d0+EcnD+t7+TU6Mq5twonyb9OAAWS449TQAMN5Hw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB562; X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB562;20:SoUhGYE+93yeD4pBuWkTUq4kMMUgva4d0d8meACKEhWBEFvSYl5VNwrivntmAqN9/F/ZGuXeoZX/a04AfmvyuyOI2SEiDDkDcM6QZ/hqIRRRR5nJG3NB6qmvLT2gOSMQEpF2uQBoyspQSEPOPWuHflma24gefrpVWlJ8bFpJ77Fm0mKplN0/uilA04QeEkFK+bnJvbOAJPmI914R44uWvHr8GiK5t26jJNgA3+tDo1DqFOZtYyph7jGbsCEFRJasI5sQ7rlAzrg9jahqZoPza5tInIg8XOJsZxfq1hoLsisqA11/KL/l/xaZ/Na2Q/E8fBfBQmzlL8iGSl5N3pBJFy7eu29NL1PLSIWkL1hLFyQ=;4:g3t0qgvwDrehZz5famihEctU1oXnWAQTP4uTOlk77sw0pYw807hMzBsK/NlJUSbfNGR/31T7K/5vjO1YdlPKdtf7NwFG8qF15ZQNAciEUgz5nPnBpEfmufqY3lAViW5uCuBFLd76KEtoMPnauQpRuDs67XBiwi+gO+pS1awDb0seTZI5x6YES6ZDza09J6c9qlciaqShISFLfpJLcag/UZSQhKZXWE2VlyNtZOKa5vhu5OSOrA3HAw8Gy9W4xbQqipst1iDF4v2TbeIzUzvn2JGMPpoxjie0MFdR+xeoDFA= 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:BL2PR03MB562;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB562; X-Forefront-PRVS: 0657D528EC X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB562;23:CI1i2JWHNsWm9CCMz6pqxj68dhaBEa9eA8+AW6EEVd+UL5LPa8sslw8VbvpBYPpjTefx0pWDdGCxpezVN6j4+3EixaqXFO/ELsb7+0MmCivnU2IY6h6+LKsvhuB9epcuBAi4n9r24aChX8F7ApT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GkgTEXiCpWh/6ar6dtt1U6CwM372cxw4q8=;20:voG/zqORbNqZXwCAk5MDn5VDkq95rGIysnXXEe6ZqProUmZSgwv0SCiqnTC9YPXIAxPZMfG2egr0cGGxW9s04Q== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2015 11:52:06.9663 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB562 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5794 Lines: 197 On Sat, Aug 1, 2015 at 8:14 AM, Scott Wood wrote: > 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()? NO, just follow the name "generic_check_cpu_restart()". > > 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. OK. > > >> { >> 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...? It's hard to find a good name. :) > > >> +{ >> + 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()? The process is fast. Maybe 10 second is too large. > >> #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 For every platform running this code, should has a valid qoriq_pm_ops. If not valid, it's a bug. -Chenhui -- 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/