Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp486336ybb; Sat, 28 Mar 2020 03:48:48 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtA+B0S2xaxGVEqznfCCBszGtpgSvKAnDJLcfd55K9bGh8rTeMceI8rOQFSZuzwl8FdDSOX X-Received: by 2002:a05:6830:2391:: with SMTP id l17mr2326058ots.339.1585392527935; Sat, 28 Mar 2020 03:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585392527; cv=none; d=google.com; s=arc-20160816; b=nuz2iwafp34nT+Qo9/EdDkxzF409YfW0edbE6mFKTrEqM8VwywYdtywexV74IaB9Ch xOYC9NslvUATwinU/FO2y/7o859ncdTc5z3eKZ16uoMzI9eI3StN28tgOqw8CUAUy9tE SdV4QF+Lb3ugIskoD8NYWZzd4SKlcnK/Y2P2Y5baoJmxlT5VLlaCEP1o74bVfITpFEFv vkKeQbrBJrMjPX91P7jmUOPr63w6aZdWJTYPNU9IofTIFdDHXqatP3/c4emkOp4KT6gm H1Gi/FUb5DRZFdHcV+nn2/Di+OVcBdFh++7Q5oNK7h6MXAQ9K7zNxMK3J+61JTJ5kmkS Hz7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=rP6eTQDuo7pqZN2CESfKINkq/elpUZtwJZufZVkRqKI=; b=d+TnODr6VCENt9ls93xb9s+fEJ2Ia3/CJkEZTgtcbFa1CrYSFnrEar1iIw7nrXipIn nI8gPkBzIOiCN1ugnvGmAETLH6Je3oeiIAeDDGt2Dy+2z76L5Dwr44cOqogAvt6WrCAb aLEKaHlIEM/BDhuzxr4VJ3iKFDL0EANTgoN43AwXltpoDP82yI/jwR4Temc0wHoLczoa Fi9Ef/cGAfzhJWFrAWG0S1Q1pniNhY7ja5AKZOvZs7zYcUQ9rBe/8fBoHlPZKgBgEytu LKrojV4QT+rjDmPp+9JxdZUo0qtYrQZ549S1cd0mZjrN6/hhr/jDyE8yyOBKR/bWkNhd DGnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si3189266oou.47.2020.03.28.03.48.34; Sat, 28 Mar 2020 03:48:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726269AbgC1KsT (ORCPT + 99 others); Sat, 28 Mar 2020 06:48:19 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:55476 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgC1KsT (ORCPT ); Sat, 28 Mar 2020 06:48:19 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jI90g-0003T6-0F; Sat, 28 Mar 2020 11:48:14 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 932E11C03A9; Sat, 28 Mar 2020 11:48:13 +0100 (CET) Date: Sat, 28 Mar 2020 10:48:13 -0000 From: "tip-bot2 for Thomas Gleixner" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: smp/core] cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus() Cc: Boqun Feng , Thomas Gleixner , Pavankumar Kondeti , stable@vger.kernel.org, x86 , LKML In-Reply-To: <874kuaxdiz.fsf@nanos.tec.linutronix.de> References: <874kuaxdiz.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Message-ID: <158539249320.28353.17099278442328307370.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the smp/core branch of tip: Commit-ID: e98eac6ff1b45e4e73f2e6031b37c256ccb5d36b Gitweb: https://git.kernel.org/tip/e98eac6ff1b45e4e73f2e6031b37c256ccb5d36b Author: Thomas Gleixner AuthorDate: Fri, 27 Mar 2020 12:06:44 +01:00 Committer: Thomas Gleixner CommitterDate: Sat, 28 Mar 2020 11:42:55 +01:00 cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus() A recent change to freeze_secondary_cpus() which added an early abort if a wakeup is pending missed the fact that the function is also invoked for shutdown, reboot and kexec via disable_nonboot_cpus(). In case of disable_nonboot_cpus() the wakeup event needs to be ignored as the purpose is to terminate the currently running kernel. Add a 'suspend' argument which is only set when the freeze is in context of a suspend operation. If not set then an eventually pending wakeup event is ignored. Fixes: a66d955e910a ("cpu/hotplug: Abort disabling secondary CPUs if wakeup is pending") Reported-by: Boqun Feng Signed-off-by: Thomas Gleixner Cc: Pavankumar Kondeti Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/874kuaxdiz.fsf@nanos.tec.linutronix.de --- include/linux/cpu.h | 12 +++++++++--- kernel/cpu.c | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 9ead281..beaed2d 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -144,12 +144,18 @@ static inline void get_online_cpus(void) { cpus_read_lock(); } static inline void put_online_cpus(void) { cpus_read_unlock(); } #ifdef CONFIG_PM_SLEEP_SMP -extern int freeze_secondary_cpus(int primary); +int __freeze_secondary_cpus(int primary, bool suspend); +static inline int freeze_secondary_cpus(int primary) +{ + return __freeze_secondary_cpus(primary, true); +} + static inline int disable_nonboot_cpus(void) { - return freeze_secondary_cpus(0); + return __freeze_secondary_cpus(0, false); } -extern void enable_nonboot_cpus(void); + +void enable_nonboot_cpus(void); static inline int suspend_disable_secondary_cpus(void) { diff --git a/kernel/cpu.c b/kernel/cpu.c index 3084849..12ae636 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1327,7 +1327,7 @@ void bringup_nonboot_cpus(unsigned int setup_max_cpus) #ifdef CONFIG_PM_SLEEP_SMP static cpumask_var_t frozen_cpus; -int freeze_secondary_cpus(int primary) +int __freeze_secondary_cpus(int primary, bool suspend) { int cpu, error = 0; @@ -1352,7 +1352,7 @@ int freeze_secondary_cpus(int primary) if (cpu == primary) continue; - if (pm_wakeup_pending()) { + if (suspend && pm_wakeup_pending()) { pr_info("Wakeup pending. Abort CPU freeze\n"); error = -EBUSY; break;