Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1548426ybb; Thu, 9 Apr 2020 04:28:58 -0700 (PDT) X-Google-Smtp-Source: APiQypKPOAY+GfaCleKOZNtUfa3Ku1GtBAJI+CMa4AR235frW6b15GA46HtclKOpD1s5SAGnjc5t X-Received: by 2002:a05:6830:2318:: with SMTP id u24mr9101172ote.106.1586431738367; Thu, 09 Apr 2020 04:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586431738; cv=none; d=google.com; s=arc-20160816; b=EusZnAibG+SqjiZQZ+QPYFCffmnbSepvWfDpfJrX3JAJsVgVpIcjC7tBHMtU6NhvI5 OteNirRhHH08vplWOhSTe5V/Zr8oMZ+gmb1NMYPM1hgTaFKI2pbOCFnkVvAGi+Fqzm4X WHRKeqlSjn8vnqGpv62Y/tN7R97T+MjIsAdg1e6ZwqX5GGupSRUrWYO4o/f+BqS1DMja awSoz4crJaqCF/Xo5qzLdXPZbUTvLWoWqsIACaJXcU6d4dGENLPk/n84DT4Zhin2+ln4 VvwfQrowYjSTpLEwJNwGuAr3cD+626b+XXcxcNG2V/dQk9FS0WOq9VfIEWjX8LupXh5b FFlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=/maoHJf2rYX6abBcxJKV2fDHSvB8PLx2Tv+ewt7EZ9I=; b=b2qTuoll9wGoHIvnbm0P9iREUZjT5ygP/Zn0Am4BRYVThL13ltCZb6LqbNSoSEAp34 P1/F2gGOfzobpIIhn69zIgsAqhTH1q7tdAirQJX1srZNSznDka/WwH0XGKseRa7htwRj AnwAnzr0I8gMayBnbpKV7T7EOauDBSRrsg3JUMbpqXcDIJfNFrERn2g1jOnCccIIJ6gZ YQr7E6Vx/21m5Upbesnc5QTYXlewRrcMFBS5dsflBnjZjO+U2YLUklFxYA1QFLaexjL+ JGBsGOU7SZ5m0fBODQyPj//F1AgQIfhvLUfYLPUdDNLm/KyCaoAR3QfJ4J8wROUG3jRZ YG4g== 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 u66si3122096oib.159.2020.04.09.04.28.43; Thu, 09 Apr 2020 04:28:58 -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 S1726597AbgDIL2K (ORCPT + 99 others); Thu, 9 Apr 2020 07:28:10 -0400 Received: from foss.arm.com ([217.140.110.172]:48898 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgDIL2K (ORCPT ); Thu, 9 Apr 2020 07:28:10 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3614031B; Thu, 9 Apr 2020 04:28:08 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A21003F73D; Thu, 9 Apr 2020 04:28:06 -0700 (PDT) From: Qais Yousef To: Thomas Gleixner Cc: Qais Yousef , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Todd E Brandt , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] Revert "cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus()" Date: Thu, 9 Apr 2020 12:27:40 +0100 Message-Id: <20200409112742.3581-1-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This issue was fixed already by: commit d66b16f5df4b ("arm64: Don't use disable_nonboot_cpus()") commit dddf3578e0d4 ("ARM: Don't use disable_nonboot_cpus()") The only caller of disable_nonboot_cpus() is x86, which is in a proper suspend/resume path and due to the reverted patch lost its ability to early abort due to a pending wakeup. The fix that is being reverted is arguably a better one to backport to stable trees. But it highlights the confusion about using disable_nonboot_cpus() API. This is a preparation to remove disable_nonboot_cpus() in favor of freeze_secondary_cpus(). This reverts commit e98eac6ff1b45e4e73f2e6031b37c256ccb5d36b. Signed-off-by: Qais Yousef CC: "Rafael J. Wysocki" CC: Len Brown CC: Pavel Machek CC: Ingo Molnar CC: Borislav Petkov CC: "H. Peter Anvin" CC: x86@kernel.org CC: Todd E Brandt CC: linux-pm@vger.kernel.org CC: linux-kernel@vger.kernel.org --- include/linux/cpu.h | 12 +++--------- kernel/cpu.c | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index beaed2dc269e..9ead281157d3 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -144,18 +144,12 @@ 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 -int __freeze_secondary_cpus(int primary, bool suspend); -static inline int freeze_secondary_cpus(int primary) -{ - return __freeze_secondary_cpus(primary, true); -} - +extern int freeze_secondary_cpus(int primary); static inline int disable_nonboot_cpus(void) { - return __freeze_secondary_cpus(0, false); + return freeze_secondary_cpus(0); } - -void enable_nonboot_cpus(void); +extern void enable_nonboot_cpus(void); static inline int suspend_disable_secondary_cpus(void) { diff --git a/kernel/cpu.c b/kernel/cpu.c index 12ae636e9cb6..30848496cbc7 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, bool suspend) +int freeze_secondary_cpus(int primary) { int cpu, error = 0; @@ -1352,7 +1352,7 @@ int __freeze_secondary_cpus(int primary, bool suspend) if (cpu == primary) continue; - if (suspend && pm_wakeup_pending()) { + if (pm_wakeup_pending()) { pr_info("Wakeup pending. Abort CPU freeze\n"); error = -EBUSY; break; -- 2.17.1