public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Tianxiang Chen <nanmu@xiaomi.com>
To: <rafael@kernel.org>
Cc: <viresh.kumar@linaro.org>, <lingyue@xiaomi.com>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: fix race between hotplug and suspend
Date: Wed, 8 Apr 2026 09:46:40 +0800	[thread overview]
Message-ID: <20260408014640.174420-1-nanmu@xiaomi.com> (raw)
In-Reply-To: <CAJZ5v0hzhgf3mvdtHgT4Hwiqv22=P=xsWO8QZpeSGayOP-HO3w@mail.gmail.com>

On Tue, 7 Apr 2026, Rafael J. Wysocki wrote:
> So how exactly would CPU hotplug be started during a system suspend or resume?

Hi Rafael,

Thank you for your question. Let me explain the two scenarios:

1. cpufreq_suspend() During Reboot (Confirmed Issue)

The real and reproducible race I encountered occurs during system reboot.

Call chain:
  kernel_restart() -> kernel_restart_prepare() 
            -> device_shutdown() -> cpufreq_suspend()

Different from the regular suspend path, the reboot path does NOT call
freeze_processes() at all.

All userspace processes, drivers and kernel threads are
still running when cpufreq_suspend() executes. This allows CPU hotplug
(offline/online) operations to run concurrently with cpufreq_suspend().

2. System suspend/resume (Less Likely but Possible)

CPU hotplug is less likely during system suspend/resume. However,
non-freezable kernel threads may keep running throughout the entire
process, which may still trigger CPU hotplug in theory.

So I added cpus_read_lock()/cpus_read_unlock() to block CPU hotplug
while resume is in progress.


-- 
Thx and BRs,
Tianxiang Chen

  reply	other threads:[~2026-04-08  1:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  9:35 [PATCH] cpufreq: Fix race between suspend/resume and CPU hotplug Tianxiang Chen
2026-04-07 11:50 ` Rafael J. Wysocki
2026-04-08  1:46   ` Tianxiang Chen [this message]
2026-04-08 10:27     ` [PATCH] cpufreq: fix race between hotplug and suspend Rafael J. Wysocki
2026-04-08 14:19       ` [PATCH v2] cpufreq: Fix hotplug-suspend race during reboot Tianxiang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260408014640.174420-1-nanmu@xiaomi.com \
    --to=nanmu@xiaomi.com \
    --cc=lingyue@xiaomi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox