Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1395651ybz; Thu, 16 Apr 2020 08:26:01 -0700 (PDT) X-Google-Smtp-Source: APiQypLAilTMoPQM6w9bwdGtOvXHZr1w3p8Sx4KKRDGAeTcTdQ4qcbUioV4y872fcetZzxnemfvn X-Received: by 2002:a50:9547:: with SMTP id v7mr19165881eda.324.1587050760739; Thu, 16 Apr 2020 08:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587050760; cv=none; d=google.com; s=arc-20160816; b=qZ6GmmbZkw2cbl7ZJyafWDtSjiUmSOL0BP4xEE6KUaqdFp2Su7WrNv6o7EIFqAAxhy aNiDJJM6tJg1BSJZY6iu6WpG4ICi+v8PtMtWqWJEduHIKSsHNG/PQ1sMM8s+NvpP8yo1 rgPBn/ZcHrxJoXD8ebck3+/N5gH8JomZqcbTrdiTaZIVhyOd0rJBcn5WOBJ/uwGcLpYa Bqdas5vu/A05XLdMYLTnCNMGxPdWkCt2iyCRa/tuCmCQ3gIzNh1K5XJqp9e4ZP9u0SLG jYK20D7+Cm/Su6Hc2O555z1i5G5BR7/nW7DUFXlww9m7WneUSxRBWzo1BzbusWUnXOr0 BDug== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lq7yhElxpwcsHfjT6qjxrqOCZyuJWUwgtK6IW9T0UsY=; b=zcRPKThM6Keoz8p06s1wKT8fTCU37okN8aeZhYFhIyC40/IMKFASn72xIJF/DyNgHd bfTvL0buro0NCD1IOMjYJVAFNgOEdyr5HGCCn1yxKX3p0RiKVSuaykh4Hdzn8V0cgpry uXeDisJtO5liErXVEMlQEo/izRJJ3KhBUXHQxG7Xw5RHj02xUW787/ZOlLxS6HCxd70C KB/bu4dQiLhRPfaX9aQewPzG2wB3yQBwlAJRok+cRgeTnQSjG+0Tnue3CyFeXZbCbruC IQRZBH6dxDlv/+24gAwaOG5JKN8WSC7lpA294DscjR3QHgBZSkhVO4jZQ/+yTRM3EWqb pzow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b1nj8Rda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si7650868ejg.474.2020.04.16.08.25.36; Thu, 16 Apr 2020 08:26:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b1nj8Rda; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405656AbgDPPVS (ORCPT + 99 others); Thu, 16 Apr 2020 11:21:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:60938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898627AbgDPNqr (ORCPT ); Thu, 16 Apr 2020 09:46:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 17F5C208E4; Thu, 16 Apr 2020 13:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044806; bh=YvEO37qKCjWeczjWU6192GteB1w/O74tNl8rInnF+to=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b1nj8Rdabzv399htP5Gu8MUs/8t2uTpLWzogsQz8V33OpEtbXo5GEy0DdOrBSu61+ PYkUdAt0JvuEvzYz/rfgqdbs5ijfqq/ZrHmapQE5ZLQimgA9xLwZ9Y+gPW88WtC2Sh A+VEYXApTRyBSrLf2d01FGnkZUHBpasgrFXYiDMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boqun Feng , Thomas Gleixner , Pavankumar Kondeti Subject: [PATCH 5.4 109/232] cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus() Date: Thu, 16 Apr 2020 15:23:23 +0200 Message-Id: <20200416131328.777564526@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131316.640996080@linuxfoundation.org> References: <20200416131316.640996080@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner commit e98eac6ff1b45e4e73f2e6031b37c256ccb5d36b upstream. 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 Signed-off-by: Greg Kroah-Hartman --- include/linux/cpu.h | 12 +++++++++--- kernel/cpu.c | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -138,12 +138,18 @@ static inline void get_online_cpus(void) 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) { --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1212,7 +1212,7 @@ EXPORT_SYMBOL_GPL(cpu_up); #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; @@ -1237,7 +1237,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;