]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
cpufreq: Add perf_freq to cpuinfo
authorJason Andryuk <jandryuk@gmail.com>
Mon, 7 Aug 2023 18:51:06 +0000 (14:51 -0400)
committerJan Beulich <jbeulich@suse.com>
Wed, 23 Aug 2023 08:04:04 +0000 (10:04 +0200)
acpi-cpufreq scales the aperf/mperf measurements by max_freq, but HWP
needs to scale by base frequency.  Settings max_freq to base_freq
"works" but the code is not obvious, and returning values to userspace
is tricky.  Add an additonal perf_freq member which is used for scaling
aperf/mperf measurements.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/acpi/cpufreq/cpufreq.c
xen/drivers/cpufreq/utility.c
xen/include/acpi/cpufreq/cpufreq.h

index 2e0067fbe54b6588765cd2b8b62e140ba0520e7c..6c70d043951a9529cc93c6cce1daac85764133d4 100644 (file)
@@ -316,7 +316,7 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
     else
         perf_percent = 0;
 
-    return policy->cpuinfo.max_freq * perf_percent / 100;
+    return policy->cpuinfo.perf_freq * perf_percent / 100;
 }
 
 static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu)
index 9eb7ecedcd29ba0a5c4c764a3de06f151e487357..6831f62851cd424148607aadae11c249b20c3497 100644 (file)
@@ -236,6 +236,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
 
     policy->min = policy->cpuinfo.min_freq = min_freq;
     policy->max = policy->cpuinfo.max_freq = max_freq;
+    policy->cpuinfo.perf_freq = max_freq;
     policy->cpuinfo.second_max_freq = second_max_freq;
 
     if (policy->min == ~0)
index 44fc4c58fc086fd3407c3d05990894ebe549783e..1f1898d8117486ea8686df9d0a1d58e6e34f6a34 100644 (file)
@@ -37,6 +37,9 @@ extern struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS];
 struct cpufreq_cpuinfo {
     unsigned int        max_freq;
     unsigned int        second_max_freq;    /* P1 if Turbo Mode is on */
+    unsigned int        perf_freq; /* Scaling freq for aperf/mpref.
+                                      acpi-cpufreq uses max_freq, but HWP uses
+                                      base_freq.*/
     unsigned int        min_freq;
     unsigned int        transition_latency; /* in 10^(-9) s = nanoseconds */
 };