Linux Power Management development
 help / color / mirror / Atom feed
From: Tianxiang Chen <nanmu@xiaomi.com>
To: <zhongqiu.han@oss.qualcomm.com>
Cc: <rafael@kernel.org>, <viresh.kumar@linaro.org>,
	<lingyue@xiaomi.com>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] cpufreq: Fix hotplug-suspend race during reboot
Date: Mon, 11 May 2026 19:14:07 +0800	[thread overview]
Message-ID: <20260511111407.455-1-nanmu@xiaomi.com> (raw)
In-Reply-To: <b3cabf3d-7672-4816-91f0-e6fafd9db4d0@oss.qualcomm.com>

On 4/14/2026 10:44 PM, Zhongqiu Han wrote:
> May I know did you test this with lockdep enabled? Specifically, does
> the new cpus_read_lock() -> policy->rwsem ordering in cpufreq_suspend()
> trigger any lockdep warnings? Thanks

Hi Zhongqiu,

Thanks for the review.

I did test v2 with lockdep enabled and was NOT able to reproduce any
warning. 

No circular-locking splat or "possible deadlock" report was observed
in dmesg across multiple runs.

My reasoning for why the new order should be safe:

  * The patch establishes  cpus_read_lock() -> policy->rwsem.
  * The hotplug path already holds cpu_hotplug_lock (write side,
    via the hotplug core) before taking policy->rwsem inside
    cpufreq_offline()/cpufreq_online(), i.e. the same direction.
  * I grep'd cpufreq and did not find an existing path that takes
    policy->rwsem first and then acquires cpus_read_lock()
    underneath. If I missed one, please point me at it.
  * cpus_read_lock() is a percpu-rwsem read side and is re-entrant,
    so even if an outer caller already holds it (e.g. via a pm
    notifier running inside a hotplug callback) this is safe.

May I ask whether you have actually observed a lockdep splat on this
change on any downstream tree, or is this a precautionary question?
If you have a specific call chain in mind, I would like to add
targeted coverage before v3 so we can nail it down definitively.

Thanks,
Tianxiang

      reply	other threads:[~2026-05-11 11:15 UTC|newest]

Thread overview: 7+ 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   ` [PATCH] cpufreq: fix race between hotplug and suspend Tianxiang Chen
2026-04-08 10:27     ` Rafael J. Wysocki
2026-04-08 14:19       ` [PATCH v2] cpufreq: Fix hotplug-suspend race during reboot Tianxiang Chen
2026-04-14 14:44         ` Zhongqiu Han
2026-05-11 11:14           ` Tianxiang Chen [this message]

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=20260511111407.455-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 \
    --cc=zhongqiu.han@oss.qualcomm.com \
    /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