|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] cpufreq: don't leave stale statistics pointer
commit a1ce987411f61dbf5fe64bba0cd3d36d7cc0311f
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Apr 30 08:47:49 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 30 08:47:49 2025 +0200
cpufreq: don't leave stale statistics pointer
Error paths of cpufreq_statistic_init() correctly free the base
structure pointer, but the per-CPU variable would still hold it, mis-
guiding e.g. cpufreq_statistic_update(). Defer installing of the pointer
there until the structure was fully populated.
Fixes: 755af07edba1 ("x86/cpufreq: don't use static array for large per-CPU
data structures")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/drivers/cpufreq/utility.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c
index ac2889d496..309c0682cf 100644
--- a/xen/drivers/cpufreq/utility.c
+++ b/xen/drivers/cpufreq/utility.c
@@ -113,7 +113,6 @@ int cpufreq_statistic_init(unsigned int cpu)
spin_unlock(cpufreq_statistic_lock);
return -ENOMEM;
}
- per_cpu(cpufreq_statistic_data, cpu) = pxpt;
pxpt->u.trans_pt = xzalloc_array(uint64_t, count * count);
if (!pxpt->u.trans_pt) {
@@ -139,6 +138,8 @@ int cpufreq_statistic_init(unsigned int cpu)
pxpt->prev_state_wall = NOW();
pxpt->prev_idle_wall = get_cpu_idle_time(cpu);
+ per_cpu(cpufreq_statistic_data, cpu) = pxpt;
+
spin_unlock(cpufreq_statistic_lock);
return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |