Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2776749ybb; Mon, 30 Mar 2020 12:41:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsG567rc2GNI2VKQ321pZ7o55F+pD0Ab77BqoS9HFwhUlVQk1zqvRkQmOrYooPkX18xKbwk X-Received: by 2002:a9d:6303:: with SMTP id q3mr10684455otk.296.1585597295437; Mon, 30 Mar 2020 12:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585597295; cv=none; d=google.com; s=arc-20160816; b=V00+4yMaeSD6/WKxw/ubtixUcxQZqzSejxZqFEu4GJUrrRDwF3VptVYahrCZtJsr72 EJTQLbFgPfWtJ+Ctrp7c9V4wHxM0H0at/OsU/B8u3JxYsIN8ALfmvpx7QtMZwzhN1hGD pCyiW1MKxPoITaUeYqGrYCllzXesZA7WRiCoJlhIYsSYCJ4y/Xio/fQFY2YjJH6nETrK RoN95Tk7nPfHRgE4X9Rr4q/UHo2DTJ+lCQwHFApkG1tIZU+Wk7eFyjiattvjXqKNc4po P0x+sc72Qg+T4dissTpWp0JWYyHIg+E1uHYWdZo4LQ6fc7pz2vrEBTu+WST9f9v6/e2l IdlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=JbAhxvLj/PufsmchFU1NANrvcljjrP5n3Y0YkJJ1RCc=; b=ek3mz/BNQwE2bI8htYkNv4HxNa1AJesxC1AM72BkKCucLbEX3zbjBBIwsn3bxaz5IL ZSu8m7JDJkYoDaZPy6hI5RcahpH8ZU3qKbo67aj/GL+ZVdnaXsOKdbdJeRjhNtiVcn56 ikR6wdPpjuuDaRg/g0qiW1z75fD7m6SU2huJ7yAdYeIGcPjKq0c8mE1yTF/twXQVEaV5 T2b7q3fnn9AtlMyOZUNk3KgPCqB9owuf4LCRrzozBX7zwU7yXietokh50wEbNckOIOTo V8QcRt4h/5rSNJBjQq2fsJGZjnkbCYM5feSiOBEU40AvCjS2yLkPNT9UGg3JnNtWXQ7X A3qw== 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 z9si7546414otj.157.2020.03.30.12.41.22; Mon, 30 Mar 2020 12:41:35 -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 S1728537AbgC3TkT (ORCPT + 99 others); Mon, 30 Mar 2020 15:40:19 -0400 Received: from foss.arm.com ([217.140.110.172]:34028 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728165AbgC3TkT (ORCPT ); Mon, 30 Mar 2020 15:40:19 -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 9DCB81FB; Mon, 30 Mar 2020 12:40:18 -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 BE1F53F68F; Mon, 30 Mar 2020 12:40:16 -0700 (PDT) Date: Mon, 30 Mar 2020 20:40:14 +0100 From: Qais Yousef To: Thomas Gleixner Cc: Boqun Feng , peterz@infradead.org, linux-kernel@vger.kernel.org, len.brown@intel.com, pkondeti@codeaurora.org, jpoimboe@redhat.com, pavel@ucw.cz, konrad.wilk@oracle.com, mojha@codeaurora.org, jkosina@suse.cz, mingo@kernel.org, hpa@zytor.com, rjw@rjwysocki.net, linux-tip-commits@vger.kernel.org Subject: Re: [tip:smp/hotplug] cpu/hotplug: Abort disabling secondary CPUs if wakeup is pending Message-ID: <20200330194014.lwpmbv2zekfk6ywx@e107158-lin.cambridge.arm.com> References: <1559536263-16472-1-git-send-email-pkondeti@codeaurora.org> <20200327025311.GA58760@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> <874kuaxdiz.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <874kuaxdiz.fsf@nanos.tec.linutronix.de> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/27/20 12:06, Thomas Gleixner wrote: > Boqun Feng writes: > > From the commit message, it makes sense to add the pm_wakeup_pending() > > check if freeze_secondary_cpus() is used for system suspend. However, > > freeze_secondary_cpus() is also used in kexec path on arm64: > > Bah! > > > kernel_kexec(): > > machine_shutdown(): > > disable_nonboot_cpus(): > > freeze_secondary_cpus() > > > > , so I wonder whether the pm_wakeup_pending() makes sense in this > > situation? Because IIUC, in this case we want to reboot the system > > regardlessly, the pm_wakeup_pending() checking seems to be inappropriate > > then. > > Fix below. > > Thanks, > > tglx > > 8<------------ > > --- a/include/linux/cpu.h > +++ b/include/linux/cpu.h > @@ -133,12 +133,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); > } If I read the code correctly, arch/x86/power/cpu.c is calling disable_nonboot_cpus() from suspend resume, which is the only user in tip/smp/core after my series. This means you won't abort a suspend/hibernate if a late wakeup source happens? Or it might just mean that we'll wakeup slightly later than we would have done. Anyways. I think it would be better to kill off disable_nonboot_cpus() and directly call freeze_nonboot_cpus() in x86/power/cpu.c. I'd be happy to send a patch for this. Assuming that x86 is okay with the late(r) abort, this patch could stay as-is for stable trees. Otherwise, maybe we need to revert this and look for another option for stable trees? Thanks -- Qais Yousef > -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 > @@ -1200,7 +1200,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; > > @@ -1225,7 +1225,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;