From: K Prateek Nayak <kprateek.nayak@amd.com>
To: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>,
Huang Rui <ray.huang@amd.com>,
"Gautham R. Shenoy" <gautham.shenoy@amd.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Len Brown <lenb@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
"Clark Williams" <clrkwllms@kernel.org>,
Bert Karwatzki <spasswolf@web.de>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-rt-devel@lists.linux.dev>
Cc: Perry Yuan <perry.yuan@amd.com>
Subject: Re: [RFC PATCH 2/2] cpufreq: Pass the policy to cpufreq_driver->adjust_perf()
Date: Wed, 7 Jan 2026 10:19:48 +0530 [thread overview]
Message-ID: <a29f0be2-5d8f-4585-8cf0-baabfd316e12@amd.com> (raw)
In-Reply-To: <1e51babe-d112-44fb-96e6-8ee7c8050302@kernel.org>
Hello Mario,
On 1/7/2026 1:01 AM, Mario Limonciello (AMD) (kernel.org) wrote:
>
>
> On 1/6/2026 1:36 AM, K Prateek Nayak wrote:
>> cpufreq_cpu_get() can sleep on PREEMPT_RT in presence of concurrent
>> writer(s), however amd-pstate depends on fetching the cpudata via the
>> policy's driver data which necessitates grabbing the reference.
>>
>> Since schedutil governor can call "cpufreq_driver->update_perf()"
>> during sched_tick/enqueue/dequeue with rq_lock held and IRQs disabled,
>> fetching the policy object using the cpufreq_cpu_get() helper in the
>> scheduler fast-path leads to "BUG: scheduling while atomic" on
>> PREEMPT_RT [1].
>>
>> Pass the cached cpufreq policy object in sg_policy to the update_perf()
>> instead of just the CPU. The CPU can be inferred using "policy->cpu".
>>
>> The lifetime of cpufreq_policy object outlasts that of the governor and
>> the cpufreq driver (allocated when the CPU is onlined and only reclaimed
>> when the CPU is offlined / the CPU device is removed) which makes it
>> safe to be referenced throughout the governor's lifetime.
>>
>> Link: https://lore.kernel.org/all/20250731092316.3191-1-spasswolf@web.de/ [1]
>
> I think you should have these tags instead:
> Reported-by: Bert Karwatzki <spasswolf@web.de>
> Closes:https://lore.kernel.org/all/20250731092316.3191-1-spasswolf@web.de/ [1]
Ack! I'll update it in the next version. Thank you for the review.
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2026-01-07 4:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 7:36 [RFC PATCH 0/2] cpufreq/amd-pstate: Prevent scheduling when atomic on PREEMPT_RT K Prateek Nayak
2026-01-06 7:36 ` [RFC PATCH 1/2] cpufreq/amd-pstate: Pass the policy to amd_pstate_update() K Prateek Nayak
2026-01-06 19:30 ` Mario Limonciello (AMD) (kernel.org)
2026-01-06 7:36 ` [RFC PATCH 2/2] cpufreq: Pass the policy to cpufreq_driver->adjust_perf() K Prateek Nayak
2026-01-06 19:31 ` Mario Limonciello (AMD) (kernel.org)
2026-01-07 4:49 ` K Prateek Nayak [this message]
2026-01-07 5:08 ` [RFC PATCH 0/2] cpufreq/amd-pstate: Prevent scheduling when atomic on PREEMPT_RT Viresh Kumar
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=a29f0be2-5d8f-4585-8cf0-baabfd316e12@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=gautham.shenoy@amd.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=perry.yuan@amd.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=spasswolf@web.de \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=superm1@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
all inboxes | Powered by JetHome®