From: Kevin Hilman <khilman@baylibre.com>
To: "Rafael J. Wysocki (Intel)" <rafael@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
linux-pm@vger.kernel.org, Ulf Hansson <ulfh@kernel.org>,
Dhruva Gole <d-gole@ti.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/4] PM / QoS: add lockless read for flags
Date: Wed, 19 Aug 2026 09:27:56 -0700 [thread overview]
Message-ID: <7h8q62vzw3.fsf@baylibre.com> (raw)
In-Reply-To: <CAJZ5v0h15XmucddczVn8b4=T1axydUPB6J20uiOLEk794mjsiw@mail.gmail.com>
"Rafael J. Wysocki (Intel)" <rafael@kernel.org> writes:
> On Thu, Jun 11, 2026 at 9:59 PM Kevin Hilman (TI) <khilman@baylibre.com> wrote:
>>
>> Add a lockless read for QoS flags similar to the lockless read for
>> resume latency (dev_pm_qos_raw_resume_latency) which may be called
>> from atomic context (e.g. genpd governors running under a raw spinlock
>> or in the syscore suspend path), where taking that sleeping lock would
>> be invalid on PREEMPT_RT.
>>
>> Signed-off-by: Kevin Hilman (TI) <khilman@baylibre.com>
>> ---
>> include/linux/pm_qos.h | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
>> index aededda52b6b..439a9e779d81 100644
>> --- a/include/linux/pm_qos.h
>> +++ b/include/linux/pm_qos.h
>> @@ -219,6 +219,12 @@ static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev)
>> PM_QOS_RESUME_LATENCY_NO_CONSTRAINT :
>> pm_qos_read_value(&dev->power.qos->resume_latency);
>> }
>> +
>> +static inline s32 dev_pm_qos_raw_flags(struct device *dev)
>> +{
>> + return IS_ERR_OR_NULL(dev->power.qos) ?
>> + 0 : READ_ONCE(dev->power.qos->flags.effective_flags);
>
> So if you add READ_ONCE() on the reader side, all updates of it need
> to go under WRITE_ONCE(), or the READ_ONCE() may still not be
> effective.
>
> I don't think they are under WRITE_ONCE() ATM.
Ah, good catch. Thanks for the review, I'll fix that in v4.
Kevin
next prev parent reply other threads:[~2026-08-19 16:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 19:59 [PATCH v3 0/4] PM: QoS/pmdomains: support resume latencies for system-wide PM Kevin Hilman (TI)
2026-06-11 19:59 ` [PATCH v3 1/4] PM / QoS: add flag to indicate latency applies system-wide Kevin Hilman (TI)
2026-06-30 21:11 ` Kendall Willis
2026-06-11 19:59 ` [PATCH v3 2/4] PM / QoS: add lockless read for flags Kevin Hilman (TI)
2026-06-30 21:12 ` Kendall Willis
2026-07-10 10:42 ` Rafael J. Wysocki (Intel)
2026-08-19 16:27 ` Kevin Hilman [this message]
2026-06-11 19:59 ` [PATCH v3 3/4] pmdomain: core: add genpd_for_each_child() helper Kevin Hilman (TI)
2026-06-30 21:13 ` Kendall Willis
2026-06-11 19:59 ` [PATCH v3 4/4] pmdomain: add support system-wide resume latency constraints Kevin Hilman (TI)
2026-07-01 17:01 ` Kendall Willis
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=7h8q62vzw3.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=d-gole@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=ulfh@kernel.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
all inboxes | Powered by JetHome®