Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1981107ybz; Sun, 26 Apr 2020 08:29:17 -0700 (PDT) X-Google-Smtp-Source: APiQypJ/Eqxz3XHwPfHNLCA8fXTsPyA15I6SPtKZsr6bx7Ne3TYNFI0MbYOvjE1rFZndI53GJs3o X-Received: by 2002:a05:6402:b4e:: with SMTP id bx14mr5884557edb.1.1587914957101; Sun, 26 Apr 2020 08:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587914957; cv=none; d=google.com; s=arc-20160816; b=LLgOrsDTWGv9HDR47qzAO0o0+S46+6S6gM2ferVHDTSOE0IMcUG0oC7OD6WG1vMdnu 6taQ0n8YkWIXnkXbUEkSInXUM6bue9n3DHRds6Xt/6Wu0I1uDW0D0kx77VNZc/bQbq69 LKCw7uD9bV/GO2Wt5UrG6h+pc6oNhgkiNNywFosX5GqGVABVoGIoe69xuz0G97onrf9K x2cLN9CW+PHbjDTJrdKxQIzeM0egAxDL3k+QIy2VHhpLHMFH58715h55rfoOBUGXgSLT zY1CW9pTZi0ajQunpv3yxhPHaRXWyU56BaLl3dIZgPT19iLzrh4GqoZo5pmcfMrn4cHx 2S2Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=StZPSqCz/KRK0BKvKQNNVAWwOKe+XdHAmj9BOq5sewk=; b=aXNDQUQIDFar0sFX3Pot+oJvRxvw5hlUDIPn3dx1F7rpDi7rLa2rxLuldgIr0eHViL 81Sw1w3bx8V6IP9RkHhmGRXW/ZddzX21XCBAHVMJ9gmKPP5cHnGDNmUB8e0qcKW9t92O qQOIhfB8m4T8wl5CBjj2URYf23M2fSgmtbabD5s4zCOIobEUsfZCFkxM0WaVLxqUT8Ss H6vUUOd07MzUr/pO5SItg8U1sQcGbaNpYf1OXkS2ZZkgRcm+mluIwqJjACb3iyXM4Y/B raCHNIy5JWJEm1/jUubUmB5pPL8rl3kRuwytSWRvMuS7m9xFTLotbNvCl8M1Z99ZMvlQ VfQw== ARC-Authentication-Results: i=1; mx.google.com; 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 e17si7174865edr.16.2020.04.26.08.28.53; Sun, 26 Apr 2020 08:29:17 -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; 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 S1726171AbgDZPZB (ORCPT + 99 others); Sun, 26 Apr 2020 11:25:01 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:49150 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbgDZPZB (ORCPT ); Sun, 26 Apr 2020 11:25:01 -0400 Received: from 185.80.35.16 (185.80.35.16) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.415) id 4bbe76b27600f444; Sun, 26 Apr 2020 17:24:59 +0200 From: "Rafael J. Wysocki" To: Qais Yousef Cc: Thomas Gleixner , 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: Re: [PATCH 1/3] Revert "cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus()" Date: Sun, 26 Apr 2020 17:24:58 +0200 Message-ID: <26038947.HFycnDbHsR@kreacher> In-Reply-To: <20200409112742.3581-1-qais.yousef@arm.com> References: <20200409112742.3581-1-qais.yousef@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, April 9, 2020 1:27:40 PM CEST Qais Yousef wrote: > 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; > I would do this the other way around: 1. Make x86 call freeze_secondary_cpus() directly, rename enable_nonboot_cpus() and drop disable_nonboot_cpus(). 2. Get rid of __freeze_secondary_cpus().