From patchwork Fri Jun 7 09:36:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 2685741 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 487183FC23 for ; Fri, 7 Jun 2013 09:38:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ukt7L-0006rT-3r; Fri, 07 Jun 2013 09:37:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ukt6y-0007OW-91; Fri, 07 Jun 2013 09:37:32 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ukt6s-0007My-1H for linux-arm-kernel@lists.infradead.org; Fri, 07 Jun 2013 09:37:30 +0000 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Fri, 07 Jun 2013 02:37:13 -0700 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp07.nvidia.com (PGP Universal service); Fri, 07 Jun 2013 02:36:14 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 07 Jun 2013 02:36:14 -0700 Received: from jlo-ubuntu-64.nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.298.1; Fri, 7 Jun 2013 02:37:00 -0700 From: Joseph Lo To: Stephen Warren Subject: [PATCH] ARM: tegra: disable nonboot CPUs when reboot Date: Fri, 7 Jun 2013 17:36:50 +0800 Message-ID: <1370597810-1153-1-git-send-email-josephl@nvidia.com> X-Mailer: git-send-email 1.8.3 X-NVConfidentiality: public MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130607_053726_201888_663FAD04 X-CRM114-Status: GOOD ( 12.41 ) X-Spam-Score: -7.4 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [216.228.121.35 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joseph Lo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The normal CPU hotplug flow in kernel and the flow for Tegra we expected, is checking the CPU ID is OK for hotplug by "tegra_cpu_disable", the CPU that would be hotplugged runs into a power-gate state by "tegra_cpu_die", then the other CPU waits for the CPU that was hotplugged in reset and clock gate it by "tegra_cpu_kill". That means we don't support the CPU being stopped or put into offline by trigger "tegra_cpu_kill" directly. It may cause a busy loop for waiting CPU in reset. After the commit "62e930e reboot: rigrate shutdown/reboot to boot cpu", we remove "disable_nonboot_cpus" when kernel_{restart,halt,power_off}. But the ARM kernel trigger "send_smp_stop" when machine_shutdown, that would cause the "tegra_cpu_kill" directly without "tegra_cpu_die" first. We hook "disable_nonboot_cpus" in "reboot_notifier" to avoid that happens. And it can work for reboot, shutdown, halt and kexec. Signed-off-by: Joseph Lo --- arch/arm/mach-tegra/hotplug.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index a52c10e..1676669 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include @@ -57,6 +59,21 @@ int tegra_cpu_disable(unsigned int cpu) } } +/* + * reboot notifier for avoid busy loop when trigger tegra_cpu_kill + * without tegra_cpu_die first + */ +static int tegra_cpu_kill_notify(struct notifier_block *nb, + unsigned long action, void *data) +{ + disable_nonboot_cpus(); + return NOTIFY_DONE; +} + +static struct notifier_block tegra_cpu_kill_nb = { + .notifier_call = tegra_cpu_kill_notify, +}; + void __init tegra_hotplug_init(void) { if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) @@ -68,4 +85,6 @@ void __init tegra_hotplug_init(void) tegra_hotplug_shutdown = tegra30_hotplug_shutdown; if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) tegra_hotplug_shutdown = tegra30_hotplug_shutdown; + + register_reboot_notifier(&tegra_cpu_kill_nb); }