* [PATCH] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug
@ 2026-06-02 2:07 Guixiong Wei
2026-06-02 16:13 ` srinivas pandruvada
2026-06-10 13:29 ` Ilpo Järvinen
0 siblings, 2 replies; 3+ messages in thread
From: Guixiong Wei @ 2026-06-02 2:07 UTC (permalink / raw)
To: srinivas.pandruvada, hansg, ilpo.jarvinen, platform-driver-x86
Cc: linux-kernel, weiguixiong, stable
When the last CPU of a legacy uncore die goes offline,
uncore_freq_remove_die_entry() clears control_cpu. During CPU hotplug
re-add, uncore_freq_add_entry() still populates sysfs attributes before
assigning the new control CPU. As a result, the current frequency read
returns -ENXIO and current_freq_khz is omitted from the recreated sysfs
group.
Assign control_cpu before the initial read paths and before
create_attr_group() so sysfs recreation uses the new online CPU. If
sysfs creation fails, restore control_cpu to -1 to keep the error path
state consistent.
Fixes: 4d73c6772ab7 ("platform/x86: intel-uncore-freq: Conditionally create attribute for read frequency")
Cc: stable@vger.kernel.org
Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
---
.../x86/intel/uncore-frequency/uncore-frequency-common.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
index 7070c94324e0..f8137ee92e47 100644
--- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
+++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
@@ -275,15 +275,20 @@ int uncore_freq_add_entry(struct uncore_data *data, int cpu)
data->package_id, data->die_id);
}
+ /*
+ * Set the control CPU before any read path so entry recreation after CPU
+ * hotplug can populate read-only attributes from the new online CPU.
+ */
+ data->control_cpu = cpu;
uncore_read(data, &data->initial_min_freq_khz, UNCORE_INDEX_MIN_FREQ);
uncore_read(data, &data->initial_max_freq_khz, UNCORE_INDEX_MAX_FREQ);
ret = create_attr_group(data, data->name);
if (ret) {
+ data->control_cpu = -1;
if (data->domain_id != UNCORE_DOMAIN_ID_INVALID)
ida_free(&intel_uncore_ida, data->instance_id);
} else {
- data->control_cpu = cpu;
data->valid = true;
}
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug
2026-06-02 2:07 [PATCH] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug Guixiong Wei
@ 2026-06-02 16:13 ` srinivas pandruvada
2026-06-10 13:29 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: srinivas pandruvada @ 2026-06-02 16:13 UTC (permalink / raw)
To: Guixiong Wei, hansg, ilpo.jarvinen, platform-driver-x86
Cc: linux-kernel, stable
On Tue, 2026-06-02 at 10:07 +0800, Guixiong Wei wrote:
> When the last CPU of a legacy uncore die goes offline,
> uncore_freq_remove_die_entry() clears control_cpu. During CPU hotplug
> re-add, uncore_freq_add_entry() still populates sysfs attributes
> before
> assigning the new control CPU. As a result, the current frequency
> read
> returns -ENXIO and current_freq_khz is omitted from the recreated
> sysfs
> group.
>
> Assign control_cpu before the initial read paths and before
> create_attr_group() so sysfs recreation uses the new online CPU. If
> sysfs creation fails, restore control_cpu to -1 to keep the error
> path
> state consistent.
>
> Fixes: 4d73c6772ab7 ("platform/x86: intel-uncore-freq: Conditionally
> create attribute for read frequency")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> .../x86/intel/uncore-frequency/uncore-frequency-common.c | 7
> ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency-common.c b/drivers/platform/x86/intel/uncore-
> frequency/uncore-frequency-common.c
> index 7070c94324e0..f8137ee92e47 100644
> --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c
> +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-
> common.c
> @@ -275,15 +275,20 @@ int uncore_freq_add_entry(struct uncore_data
> *data, int cpu)
> data->package_id, data->die_id);
> }
>
> + /*
> + * Set the control CPU before any read path so entry
> recreation after CPU
> + * hotplug can populate read-only attributes from the new
> online CPU.
> + */
> + data->control_cpu = cpu;
> uncore_read(data, &data->initial_min_freq_khz,
> UNCORE_INDEX_MIN_FREQ);
> uncore_read(data, &data->initial_max_freq_khz,
> UNCORE_INDEX_MAX_FREQ);
>
> ret = create_attr_group(data, data->name);
> if (ret) {
> + data->control_cpu = -1;
> if (data->domain_id != UNCORE_DOMAIN_ID_INVALID)
> ida_free(&intel_uncore_ida, data-
> >instance_id);
> } else {
> - data->control_cpu = cpu;
> data->valid = true;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug
2026-06-02 2:07 [PATCH] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug Guixiong Wei
2026-06-02 16:13 ` srinivas pandruvada
@ 2026-06-10 13:29 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2026-06-10 13:29 UTC (permalink / raw)
To: srinivas.pandruvada, hansg, platform-driver-x86, Guixiong Wei
Cc: linux-kernel, stable
On Tue, 02 Jun 2026 10:07:52 +0800, Guixiong Wei wrote:
> When the last CPU of a legacy uncore die goes offline,
> uncore_freq_remove_die_entry() clears control_cpu. During CPU hotplug
> re-add, uncore_freq_add_entry() still populates sysfs attributes before
> assigning the new control CPU. As a result, the current frequency read
> returns -ENXIO and current_freq_khz is omitted from the recreated sysfs
> group.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug
commit: 6b63520ed14b17bbe9c2103debbd2152dde1fba3
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-10 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02 2:07 [PATCH] platform/x86/intel-uncore-freq: Fix current_freq_khz after CPU hotplug Guixiong Wei
2026-06-02 16:13 ` srinivas pandruvada
2026-06-10 13:29 ` Ilpo Järvinen
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®