From patchwork Sun Apr 1 10:36:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 893977 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40DX2Y66hZz9s1c for ; Sun, 1 Apr 2018 20:41:09 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSoKs/Bo"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40DX2Y4GvxzF216 for ; Sun, 1 Apr 2018 20:41:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSoKs/Bo"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::244; helo=mail-pl0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iSoKs/Bo"; dkim-atps=neutral Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40DWxF2C48zF20w for ; Sun, 1 Apr 2018 20:36:33 +1000 (AEST) Received: by mail-pl0-x244.google.com with SMTP id 61-v6so559430plb.2 for ; Sun, 01 Apr 2018 03:36:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=frJArl1G35L5ymBmGEFR/pp919Gxl4TtnXQictngwTM=; b=iSoKs/BoyqnCN3Q3pLwAZHXILV1XqeazGhN76Ul/SVK/+AoPe9SLN6YMuyUT8U/Ps4 vZCu58Q6a+jo0VAw7D75G2PNqZz5B/c9dswzsS9MwC39R8dllrMXturCb6zEF2s3tXH1 146Hg0HvxC265qxrmDQ/FXvm76+e45pvY9iNUO13iH+4W3wHYfpVmgUUx/bN/i1A1237 NuNnaQ8luYs63UIuCu+3PoFvw9pXp1sW0uZbFcyq5XOYu34OO5rcP/I+4urJrRX/xUAM 9JlBA6EQhHmpObVxfSvf3DCsbMcRQaOdiyXIkqJN3YbVkrxtJ+7QhB1qGJgMh8u7py2Q 5d5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=frJArl1G35L5ymBmGEFR/pp919Gxl4TtnXQictngwTM=; b=ew7vbekoEEi+1PAzRv733avh8QNa7E9PGGNCORrrRX9iGBMFpEcKgZUP0OwGEvPbC5 ugWq7txz7BAhpYgp8OU1rq6ZZ64UpJMvwhHCs8ypjrBJRBtaN1eR5Og5OWFOajMZhfqg XT13F0vcPfQbluDn6xab6UmvbUJhSyk6aiWvxuHzM7YFnqWYKuiIp3BJNkltTIIrEXDQ kdlYM7FuJkwx/qI5eeQeo1diDpyR+kbXP9CmhtYD+VXW37xmuZywZT/k0yWWbzq3f2l4 +plGP8PhahbxlkpsJqW6CP8n6f8kgDuIqPCHuTSbn4cCgsF/NbzM63m1v3TspA4ybMhI zWKg== X-Gm-Message-State: AElRT7Ga8VKIprPGRkvBieqG+lgYFtKjRKYKWBKjSN4RyZt4ZcuJ1Shy ehkwd/VPWw/egykjdereF1FGKw== X-Google-Smtp-Source: AIpwx4/KxocepIhZz6ZYpeNHpfvOHC5F+UF9r/QNakvRlxKJUWweJiQuB3exNHSCuWOmL5cCgzoqHg== X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr5764099pld.273.1522578991212; Sun, 01 Apr 2018 03:36:31 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id d83sm26977486pfl.176.2018.04.01.03.36.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Apr 2018 03:36:30 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 1/3] powerpc: use NMI IPI for smp_send_stop Date: Sun, 1 Apr 2018 20:36:13 +1000 Message-Id: <20180401103615.15454-2-npiggin@gmail.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180401103615.15454-1-npiggin@gmail.com> References: <20180401103615.15454-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Use the NMI IPI rather than smp_call_function for smp_send_stop. Have stopped CPUs hard disable interrupts rather than just soft disable. This function is used in crash/panic/shutdown paths to bring other CPUs down as quickly and reliably as possible, and minimizing their potential to cause trouble. Avoiding the Linux smp_call_function infrastructure and (if supported) using true NMI IPIs makes this more robust. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/smp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index cfc08b099c49..db88660bf6bd 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -565,7 +565,11 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) } #endif +#ifdef CONFIG_NMI_IPI +static void stop_this_cpu(struct pt_regs *regs) +#else static void stop_this_cpu(void *dummy) +#endif { /* Remove this CPU */ set_cpu_online(smp_processor_id(), false); @@ -577,7 +581,11 @@ static void stop_this_cpu(void *dummy) void smp_send_stop(void) { +#ifdef CONFIG_NMI_IPI + smp_send_nmi_ipi(NMI_IPI_ALL_OTHERS, stop_this_cpu, 1000000); +#else smp_call_function(stop_this_cpu, NULL, 0); +#endif } struct thread_info *current_set[NR_CPUS]; From patchwork Sun Apr 1 10:36:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 893978 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40DX5p1GxJz9s1c for ; Sun, 1 Apr 2018 20:43:58 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RJjKxJzn"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40DX5n6pYVzF1x5 for ; Sun, 1 Apr 2018 20:43:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RJjKxJzn"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::244; helo=mail-pl0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RJjKxJzn"; dkim-atps=neutral Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40DWxJ2zW3zF21n for ; Sun, 1 Apr 2018 20:36:36 +1000 (AEST) Received: by mail-pl0-x244.google.com with SMTP id m22-v6so2540609pls.5 for ; Sun, 01 Apr 2018 03:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sMFfbUtjL/zilH+QwP1ZUkWNjVmPsrSKEn3P37KsuvQ=; b=RJjKxJznw/E5WRaZDrdXgB9caPzfoA9I62jdEdBg4FAkobP6L1VbGNwJck6ACFdCCK rpES7Js7FYtwBDq72M1rwNaZ+SdGl6an/Coi6acIUnx9C1dy7eT6WbZD3BNDQVAeSg+n jBSzcYnagkNu0of9GB56Tqqzo5ZwJzC18uQ9nKH1sNWveGAz3ntR/vV9HuU0fzNgr3jw dzolQj1/3pfIjpZp028FAy7TBcoo127o6rDeA2th02OCTvkYtSDAHy6SCsKfAhtOS+Tf hxbPUVYCJC97jl6fQU03cXpXt3c+xwEQ1FHAUQLgtfpEUomd7rsBrgs375ePu+a26vnd Hqfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sMFfbUtjL/zilH+QwP1ZUkWNjVmPsrSKEn3P37KsuvQ=; b=HTURKFgu8FtI2GB2kFhS7SZctX3KYLo8I6S+HvKAiHdEnYpjAyUS0BTqNDH4pfyT5r Or7qtXQ4POCDw1N44aZsjyNiWxu5WMPkTLfLcHcExoK8zoqVdJ7igkspmAZIoVYSNLUN kv2aP8Rbq8noscqBdtimitIPeNZ5+eQOb8t4rEU54pVDpSlXRK9zqHcxX1dseye3zBu+ 0x4+TKpAUiDXLdjnujqEq1xbqTyUizZxH471qA+i0YcXbXD/LDUM+2W/da5RPiDqy1sZ Ua/n5jlvAsare4KVcg0VDylgAVXgilNxft0hFSDiM1GJlFFqmkKU5JkHu8STECW4Sy8u gaOg== X-Gm-Message-State: AElRT7EuZZpLMN40TYgczse07QGqmDS0XH6VD28uNz6bGP6P92Jcb+VJ jRzcKHJjeyTVno3etJ+uYtvrRw== X-Google-Smtp-Source: AIpwx49BslXU+jWXLBi+bgyW9GM5ZVE5VZ1I4RVQ7MQ4GhDN++MQOvgHtIzb5o/K9WqQ0wojdAppog== X-Received: by 2002:a17:902:7401:: with SMTP id g1-v6mr5967931pll.4.1522578994538; Sun, 01 Apr 2018 03:36:34 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id d83sm26977486pfl.176.2018.04.01.03.36.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Apr 2018 03:36:33 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 2/3] powerpc: hard disable irqs in smp_send_stop loop Date: Sun, 1 Apr 2018 20:36:14 +1000 Message-Id: <20180401103615.15454-3-npiggin@gmail.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180401103615.15454-1-npiggin@gmail.com> References: <20180401103615.15454-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The hard lockup watchdog can fire under local_irq_disable on platforms with irq soft masking. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/smp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index db88660bf6bd..e16ec7b3b427 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -574,9 +574,10 @@ static void stop_this_cpu(void *dummy) /* Remove this CPU */ set_cpu_online(smp_processor_id(), false); - local_irq_disable(); + hard_irq_disable(); + spin_begin(); while (1) - ; + spin_cpu_relax(); } void smp_send_stop(void) From patchwork Sun Apr 1 10:36:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 893979 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40DX8r0gm4z9s1c for ; Sun, 1 Apr 2018 20:46:36 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L8dAGbsZ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40DX8q68DfzF21J for ; Sun, 1 Apr 2018 20:46:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L8dAGbsZ"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::242; helo=mail-pl0-x242.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="L8dAGbsZ"; dkim-atps=neutral Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40DWxN3CtdzF22N for ; Sun, 1 Apr 2018 20:36:40 +1000 (AEST) Received: by mail-pl0-x242.google.com with SMTP id v5-v6so561390plo.4 for ; Sun, 01 Apr 2018 03:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U+QLRuPWjuiEL3qujtGiRMNDF9xfhqV5Ukv0/M8rDK4=; b=L8dAGbsZb0jFnK8Ttq/P6XHTvw+fRu96ZMj1KnT13vKW0hnjHHwEH7ZSYfLjGuOeMi 5FS7Y0hM9jm/GRb0+4UxeeNLJpTPA5LF7yUGMphMiqgJB9wZ0cMDXMw3TyyrFjlWC++I TYBjhMKPSyuJAWia5eDBLpW9ouTf3mKJAmQEigE3ttNAFxDoOUJ8uYh61bP2ffN2IfV4 Ve95ru9UmD3FYvBSo/nWNMk/FKPWSA29vopSMYbgU8kLtMsI1Tf0Gsd6bKZ1F6AQLeL/ Jx9cFgByRRTShaVbiQ5e7q8aTBoIRs633Vt8QyswBH8UsToQFwz8pXcm9hhtylqeL9Z8 nKew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U+QLRuPWjuiEL3qujtGiRMNDF9xfhqV5Ukv0/M8rDK4=; b=bmUIklNTUMeygmHfxW5xCcFn/vsSBr80poMrhXGaRpIRRA2OWGG8RRKDREFrh2VZ/t Ff5zAUunt8gPjrq7oSs56S6BVlxFuE6VUtSNShN3s2IOXghwBjJi1nKD/lVSoHDbT53k h2YuMrw8kPbDXEobYt694+CtClAKUY51JtmJmJDyaf0QdbGJDTxJixYGJ7U5KHjSr0HG dLSXRK7p7Ui2IEAPwXS8Cfca5nxAdvQ40jMmmNuRs4pbMWRHIK18cA4MiTwU9PX965VP oGP74znzYzLg4ShVUrP0RDFLJQzk/RGEGG72pH3lnFmzPmIUZEPXa3ewy8eGq6VBtUmZ KYpQ== X-Gm-Message-State: AElRT7EO6YSiz0FA/nU5nmeW1OCX/90/1EZ7gnB5yLYMWZejIk9sQusZ DuF9gWsM33AQ5/gzRXXy9zaKbw== X-Google-Smtp-Source: AIpwx489GmhDYo1Dck+UJQ2UQhs60WwYSddRujXPqolRJoc5nlEB3hPUe3xGorxtNg2Tw0ClBT5tvw== X-Received: by 2002:a17:902:60cf:: with SMTP id k15-v6mr5846747pln.44.1522578998544; Sun, 01 Apr 2018 03:36:38 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id d83sm26977486pfl.176.2018.04.01.03.36.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Apr 2018 03:36:37 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 3/3] powerpc/powernv: Always stop secondaries before reboot/shutdown Date: Sun, 1 Apr 2018 20:36:15 +1000 Message-Id: <20180401103615.15454-4-npiggin@gmail.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180401103615.15454-1-npiggin@gmail.com> References: <20180401103615.15454-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently powernv reboot and shutdown requests just leave secondaries to do their own things. This is undesirable because they can trigger any number of watchdogs while waiting for reboot, but also we don't know what else they might be doing -- they might be causing trouble, trampling memory, etc. The opal scheduled flash update code already ran into watchdog problems due to flashing taking a long time, and it was fixed with 2196c6f1ed ("powerpc/powernv: Return secondary CPUs to firmware before FW update"), which returns secondaries to opal. It's been found that regular reboots can take over 10 seconds, which can result in the hard lockup watchdog firing, reboot: Restarting system [ 360.038896709,5] OPAL: Reboot request... Watchdog CPU:0 Hard LOCKUP Watchdog CPU:44 detected Hard LOCKUP other CPUS:16 Watchdog CPU:16 Hard LOCKUP watchdog: BUG: soft lockup - CPU#16 stuck for 3s! [swapper/16:0] This patch removes the special case for flash update, and calls smp_send_stop in all cases before calling reboot/shutdown. smp_send_stop could return CPUs to OPAL, the main reason not to is that the request could come from a NMI that interrupts OPAL code, so re-entry to OPAL can cause a number of problems. Putting secondaries into simple spin loops improves the chances of a successful reboot. Cc: Vasant Hegde Signed-off-by: Nicholas Piggin Reviewed-by: Vasant Hegde --- arch/powerpc/include/asm/opal.h | 2 +- arch/powerpc/platforms/powernv/opal-flash.c | 28 +--------------------------- arch/powerpc/platforms/powernv/setup.c | 15 +++++---------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index dde60089d0d4..7159e1a6a61a 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -325,7 +325,7 @@ struct rtc_time; extern unsigned long opal_get_boot_time(void); extern void opal_nvram_init(void); extern void opal_flash_update_init(void); -extern void opal_flash_term_callback(void); +extern void opal_flash_update_print_message(void); extern int opal_elog_init(void); extern void opal_platform_dump_init(void); extern void opal_sys_param_init(void); diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c index 1cb0b895a236..b37015101bf6 100644 --- a/arch/powerpc/platforms/powernv/opal-flash.c +++ b/arch/powerpc/platforms/powernv/opal-flash.c @@ -303,26 +303,9 @@ static int opal_flash_update(int op) return rc; } -/* Return CPUs to OPAL before starting FW update */ -static void flash_return_cpu(void *info) -{ - int cpu = smp_processor_id(); - - if (!cpu_online(cpu)) - return; - - /* Disable IRQ */ - hard_irq_disable(); - - /* Return the CPU to OPAL */ - opal_return_cpu(); -} - /* This gets called just before system reboots */ -void opal_flash_term_callback(void) +void opal_flash_update_print_message(void) { - struct cpumask mask; - if (update_flash_data.status != FLASH_IMG_READY) return; @@ -333,15 +316,6 @@ void opal_flash_term_callback(void) /* Small delay to help getting the above message out */ msleep(500); - - /* Return secondary CPUs to firmware */ - cpumask_copy(&mask, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &mask); - if (!cpumask_empty(&mask)) - smp_call_function_many(&mask, - flash_return_cpu, NULL, false); - /* Hard disable interrupts */ - hard_irq_disable(); } /* diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 5f963286232f..ef8c9ce53a61 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -201,17 +201,12 @@ static void pnv_prepare_going_down(void) */ opal_event_shutdown(); - /* Soft disable interrupts */ - local_irq_disable(); + /* Print flash update message if one is scheduled. */ + opal_flash_update_print_message(); - /* - * Return secondary CPUs to firwmare if a flash update - * is pending otherwise we will get all sort of error - * messages about CPU being stuck etc.. This will also - * have the side effect of hard disabling interrupts so - * past this point, the kernel is effectively dead. - */ - opal_flash_term_callback(); + smp_send_stop(); + + hard_irq_disable(); } static void __noreturn pnv_restart(char *cmd)