From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>,
Qais Yousef <qyousef@layalina.io>,
LKML <linux-kernel@vger.kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Prashanth Prakash <pprakash@codeaurora.org>,
Pierre Gondois <pierre.gondois@arm.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Linux ACPI <linux-acpi@vger.kernel.org>
Subject: [PATCH v1 2/4] cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay
Date: Thu, 25 Sep 2025 17:44:47 +0200 [thread overview]
Message-ID: <22867781.EfDdHjke4D@rafael.j.wysocki> (raw)
In-Reply-To: <8605612.T7Z3S40VBb@rafael.j.wysocki>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
If cppc_get_transition_latency() returns CPUFREQ_ETERNAL to indicate a
failure to retrieve the transition latency value from the platform
firmware, the CPPC cpufreq driver will use that value (converted to
microseconds) as the policy transition delay, but it is way too large
for any practical use.
Address this by making the driver use the cpufreq's default
transition latency value (in microseconds) as the transition delay
if CPUFREQ_ETERNAL is returned by cppc_get_transition_latency().
Fixes: d4f3388afd48 ("cpufreq / CPPC: Set platform specific transition_delay_us")
Cc: 5.19+ <stable@vger.kernel.org> # 5.19
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/cpufreq/cppc_cpufreq.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -308,6 +308,16 @@ static int cppc_verify_policy(struct cpu
return 0;
}
+static unsigned int get_transition_latency_from_cppc(unsigned int cpu)
+{
+ unsigned int transition_latency_ns = cppc_get_transition_latency(cpu);
+
+ if (transition_latency_ns == CPUFREQ_ETERNAL)
+ return CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS / NSEC_PER_USEC;
+
+ return transition_latency_ns / NSEC_PER_USEC;
+}
+
/*
* The PCC subspace describes the rate at which platform can accept commands
* on the shared PCC channel (including READs which do not count towards freq
@@ -330,12 +340,12 @@ static unsigned int cppc_cpufreq_get_tra
return 10000;
}
}
- return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
+ return get_transition_latency_from_cppc(cpu);
}
#else
static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
{
- return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
+ return get_transition_latency_from_cppc(cpu);
}
#endif
next prev parent reply other threads:[~2025-09-25 15:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 15:42 [PATCH v1 0/4] cpufreq: Fixes and cleanups related to CPUFREQ_ETERNAL Rafael J. Wysocki
2025-09-25 15:44 ` [PATCH v1 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency Rafael J. Wysocki
2025-09-25 16:37 ` Mario Limonciello
2025-09-26 9:46 ` Jie Zhan
2025-09-25 15:44 ` Rafael J. Wysocki [this message]
2025-09-25 16:36 ` [PATCH v1 2/4] cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay Mario Limonciello
2025-09-26 9:41 ` Jie Zhan
2025-09-25 15:46 ` [PATCH v1 3/4] ACPI: CPPC: Replace CPUFREQ_ETERNAL with CPPC-specific symbol Rafael J. Wysocki
2025-09-25 16:35 ` Mario Limonciello
2025-09-25 16:57 ` Rafael J. Wysocki
2025-09-25 17:23 ` [PATCH v2 3/4] ACPI: CPPC: Do not use CPUFREQ_ETERNAL as an error value Rafael J. Wysocki
2025-09-25 18:33 ` Mario Limonciello (AMD) (kernel.org)
2025-09-26 9:30 ` Jie Zhan
2025-09-26 10:22 ` Rafael J. Wysocki
2025-09-25 15:47 ` [PATCH v1 4/4] cpufreq: Drop unused symbol CPUFREQ_ETERNAL Rafael J. Wysocki
2025-09-25 16:36 ` Mario Limonciello (AMD) (kernel.org)
2025-09-26 9:47 ` Jie Zhan
2025-09-29 7:28 ` [PATCH v1 0/4] cpufreq: Fixes and cleanups related to CPUFREQ_ETERNAL 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=22867781.EfDdHjke4D@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=pierre.gondois@arm.com \
--cc=pprakash@codeaurora.org \
--cc=qyousef@layalina.io \
--cc=shawnguo@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