x86/cpufreq: Various bits of cleanup
cover x86/cpufreq: Various bits of cleanup
Varios bits of cleanup uncovered while looking in to the Intel Turbo issues.
Andrew Cooper (3):
x86/cpufreq: Clean up powernow registration x86/cpufreq: Rework APERF/MPERF handling x86/cpufreq: Drop opencoded CPUID handling from powernow
tools/misc/xen-cpuid.c | 3 +- xen/arch/x86/acpi/cpufreq/cpufreq.c | 28 +++++++------- xen/arch/x86/acpi/cpufreq/powernow.c | 58 +++++------------------------ xen/drivers/cpufreq/utility.c | 9 ++--- xen/include/acpi/cpufreq/cpufreq.h | 2 - xen/include/asm-x86/cpufeature.h | 1 + xen/include/public/arch-x86/cpufeatureset.h | 2 + 7 files changed, 31 insertions(+), 72 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 x86/cpufreq: Clean up powernow registration
powernow_register_driver() is currently written with a K&R type definition; I'm surprised that compilers don't object to a mismatch with its declaration, which is written in an ANSI-C compatible way.
Furthermore, its sole caller is cpufreq_driver_init() which is a pre-smp initcall. There are no other online CPUs, and even if there were, checking the BSP's CPUID data $N times is pointless. Simplify registration to only look at the BSP.
While at it, drop obviously unused includes. Also rewrite the expression in cpufreq_driver_init() for clarity.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 20 +++++++++++++------- xen/arch/x86/acpi/cpufreq/powernow.c | 28 ++++++---------------------- 2 files changed, 19 insertions(+), 29 deletions(-)
xen/arch/x86/acpi/cpufreq/cpufreq.c +13 -7
@@ -640,13 +640,19 @@ static int __init cpufreq_driver_init(void) {int ret =0 ; -if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL )) - ret =cpufreq_register_driver (&acpi_cpufreq_driver); -else if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor & - (X86_VENDOR_AMD |X86_VENDOR_HYGON ))) - ret =powernow_register_driver (); +if ( cpufreq_controller == FREQCTL_xen ) + { +switch ( boot_cpu_data.x86_vendor ) + { +case X86_VENDOR_INTEL : + ret =cpufreq_register_driver (&acpi_cpufreq_driver); +break ; + +case X86_VENDOR_AMD |X86_VENDOR_HYGON : + ret =powernow_register_driver (); +break ; + } + }return ret; }
xen/arch/x86/acpi/cpufreq/powernow.c +6 -22
@@ -24,13 +24,9 @@#include <xen/types.h> #include <xen/errno.h> #include <xen/init.h> -#include <xen/delay.h> #include <xen/cpumask.h> -#include <xen/timer.h> #include <xen/xmalloc.h> -#include <asm/bug.h> #include <asm/msr.h> -#include <asm/io.h> #include <asm/processor.h> #include <asm/cpufeature.h> #include <acpi/acpi.h>
@@ -353,25 +349,13 @@ static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { .update = powernow_cpufreq_update }; -unsigned int __init powernow_register_driver () +unsigned int __init powernow_register_driver (void ) { -unsigned int i, ret =0 ; +if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON )) ) +return -ENODEV ; -for_each_online_cpu (i) { -struct cpuinfo_x86 *c = &cpu_data[i]; -if (!(c->x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON ))) - ret = -ENODEV ; -else - { -u32 eax, ebx, ecx, edx; -cpuid (CPUID_FREQ_VOLT_CAPABILITIES , &eax, &ebx, &ecx, &edx); -if ((edx &USE_HW_PSTATE ) !=USE_HW_PSTATE ) - ret = -ENODEV ; - } -if (ret) -return ret; - } +if ( !(cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES ) &USE_HW_PSTATE ) ) +return -ENODEV ; - ret =cpufreq_register_driver (&powernow_cpufreq_driver); -return ret; +return cpufreq_register_driver (&powernow_cpufreq_driver); }
Signature · 1 line
2.11.0
Re: [PATCH 1/3] x86/cpufreq: Clean up powernow registration
Quoted 8 lines · Andrew Cooper
powernow_register_driver()is currently written with a K&R type definition; I'm surprised that compilers don't object to a mismatch with its declaration, which is written in an ANSI-C compatible way.Furthermore, its sole caller is
cpufreq_driver_init()which is a pre-smp initcall. There are no other online CPUs, and even if there were, checking the BSP's CPUID data $N times is pointless. Simplify registration to only look at the BSP.
I guess an extra safety would be to add some check for the cpuid bit in the AP boot path if the cpufreq driver is enabled.
Quoted 28 lines
While at it, drop obviously unused includes. Also rewrite the expression in
cpufreq_driver_init()for clarity.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 20 +++++++++++++------- xen/arch/x86/acpi/cpufreq/powernow.c | 28 ++++++---------------------- 2 files changed, 19 insertions(+), 29 deletions(-)xen/arch/x86/acpi/cpufreq/cpufreq.c +0
-6@@ -640,13 +640,19 @@ static int __init cpufreq_driver_init(void) {int ret =0 ; -if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL )) - ret =cpufreq_register_driver (&acpi_cpufreq_driver); -else if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor & - (X86_VENDOR_AMD |X86_VENDOR_HYGON )))
xen/arch/x86/acpi/cpufreq/cpufreq.c static int __init cpufreq_driver_init(void) · line 651
Quoted 10 lines
xen/arch/x86/acpi/cpufreq/cpufreq.c +9
-1- ret =powernow_register_driver (); +if ( cpufreq_controller == FREQCTL_xen ) + { +switch ( boot_cpu_data.x86_vendor ) + { +case X86_VENDOR_INTEL : + ret =cpufreq_register_driver (&acpi_cpufreq_driver); +break ; + +case X86_VENDOR_AMD |X86_VENDOR_HYGON :
This should be two separate case statements.
With this fixed:
One rant below about getting rid of powernow_register_driver.
Quoted 42 lines
xen/arch/x86/acpi/cpufreq/cpufreq.c +4
-0+ ret =powernow_register_driver (); +break ; + } + }return ret; }xen/arch/x86/acpi/cpufreq/powernow.c +3
-12@@ -24,13 +24,9 @@#include <xen/types.h> #include <xen/errno.h> #include <xen/init.h> -#include <xen/delay.h> #include <xen/cpumask.h> -#include <xen/timer.h> #include <xen/xmalloc.h> -#include <asm/bug.h> #include <asm/msr.h> -#include <asm/io.h> #include <asm/processor.h> #include <asm/cpufeature.h> #include <acpi/acpi.h> @@ -353,25 +349,13 @@ static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { .update = powernow_cpufreq_update }; -unsigned int __init powernow_register_driver () +unsigned int __init powernow_register_driver (void ) { -unsigned int i, ret =0 ; +if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON )) ) +return -ENODEV ; -for_each_online_cpu (i) { -struct cpuinfo_x86 *c = &cpu_data[i]; -if (!(c->x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON ))) - ret = -ENODEV ; -else - {
xen/arch/x86/acpi/cpufreq/powernow.c static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { · line 358
Quoted 10 lines
xen/arch/x86/acpi/cpufreq/powernow.c +2
-8-u32 eax, ebx, ecx, edx; -cpuid (CPUID_FREQ_VOLT_CAPABILITIES , &eax, &ebx, &ecx, &edx); -if ((edx &USE_HW_PSTATE ) !=USE_HW_PSTATE ) - ret = -ENODEV ; - } -if (ret) -return ret; - } +if ( !(cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES ) &USE_HW_PSTATE ) ) +return -ENODEV ;
I wonder if we could move this check into cpufreq_driver_init and get rid of powernow_register_driver.
Thanks, Roger.
Re: [PATCH 1/3] x86/cpufreq: Clean up powernow registration
Quoted 23 lines · Roger Pau Monné
Quoted 22 lines · Andrew Cooper
xen/arch/x86/acpi/cpufreq/powernow.c +3
-13@@ -353,25 +349,13 @@ static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { .update = powernow_cpufreq_update }; -unsigned int __init powernow_register_driver () +unsigned int __init powernow_register_driver (void ) { -unsigned int i, ret =0 ; +if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON )) ) +return -ENODEV ; -for_each_online_cpu (i) { -struct cpuinfo_x86 *c = &cpu_data[i]; -if (!(c->x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON ))) - ret = -ENODEV ; -else - { -u32 eax, ebx, ecx, edx; -cpuid (CPUID_FREQ_VOLT_CAPABILITIES , &eax, &ebx, &ecx, &edx); -if ((edx &USE_HW_PSTATE ) !=USE_HW_PSTATE ) - ret = -ENODEV ; - }
Quoted 8 lines
xen/arch/x86/acpi/cpufreq/powernow.c static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { · line 358
Quoted 5 lines
xen/arch/x86/acpi/cpufreq/powernow.c +2
-3-if (ret) -return ret; - } +if ( !(cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES ) &USE_HW_PSTATE ) ) +return -ENODEV ;I wonder if we could move this check into
cpufreq_driver_initand get rid ofpowernow_register_driver.
That's a vendor specific leaf, so I'd prefer to keep checking it in vendor-specific code. Dropping the vendor check from here would seem reasonable, considering it's already done in the caller.
Jan
Re: [PATCH 1/3] x86/cpufreq: Clean up powernow registration
In reply to Roger Pau MonnéQuoted 11 lines · Roger Pau Monné
Quoted 8 lines · Andrew Cooper
powernow_register_driver()is currently written with a K&R type definition; I'm surprised that compilers don't object to a mismatch with its declaration, which is written in an ANSI-C compatible way.Furthermore, its sole caller is
cpufreq_driver_init()which is a pre-smp initcall. There are no other online CPUs, and even if there were, checking the BSP's CPUID data $N times is pointless. Simplify registration to only look at the BSP.I guess an extra safety would be to add some check for the cpuid bit in the AP boot path if the cpufreq driver is enabled.
We already have a number of cases where we expect the system to be reasonably homogeneous, microcode most notably.
Given that we don't currently check this, I don't think it is worth changing things.
Quoted 39 lines
Quoted 27 lines
While at it, drop obviously unused includes. Also rewrite the expression in
cpufreq_driver_init()for clarity.Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 20 +++++++++++++------- xen/arch/x86/acpi/cpufreq/powernow.c | 28 ++++++---------------------- 2 files changed, 19 insertions(+), 29 deletions(-)xen/arch/x86/acpi/cpufreq/cpufreq.c +0
-6@@ -640,13 +640,19 @@ static int __init cpufreq_driver_init(void) {int ret =0 ; -if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL )) - ret =cpufreq_register_driver (&acpi_cpufreq_driver); -else if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor & - (X86_VENDOR_AMD |X86_VENDOR_HYGON )))xen/arch/x86/acpi/cpufreq/cpufreq.c static int __init cpufreq_driver_init(void) · line 651
Quoted 10 lines
xen/arch/x86/acpi/cpufreq/cpufreq.c +9
-1- ret =powernow_register_driver (); +if ( cpufreq_controller == FREQCTL_xen ) + { +switch ( boot_cpu_data.x86_vendor ) + { +case X86_VENDOR_INTEL : + ret =cpufreq_register_driver (&acpi_cpufreq_driver); +break ; + +case X86_VENDOR_AMD |X86_VENDOR_HYGON :This should be two separate case statements.
Quoted 3 lines
With this fixed:
Reviewed-by Roger Pau Monné <[email protected]>
Thanks. I'd actually already found and fixed that bug - clearly I sent out an old version of the patch.
~Andrew
Re: [PATCH 1/3] x86/cpufreq: Clean up powernow registration
In reply to Andrew CooperQuoted 10 lines · Andrew Cooper
xen/arch/x86/acpi/cpufreq/cpufreq.c +0
-4@@ -640,13 +640,19 @@ static int __init cpufreq_driver_init(void) {int ret =0 ; -if ((cpufreq_controller == FREQCTL_xen) && - (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL )) - ret =cpufreq_register_driver (&acpi_cpufreq_driver); - else if ((cpufreq_controller == FREQCTL_xen) &&
xen/arch/x86/acpi/cpufreq/cpufreq.c static int __init cpufreq_driver_init(void) · line 649
Quoted 10 lines
xen/arch/x86/acpi/cpufreq/cpufreq.c +7
-3- (boot_cpu_data.x86_vendor & - (X86_VENDOR_AMD | X86_VENDOR_HYGON))) - ret =powernow_register_driver (); +if ( cpufreq_controller == FREQCTL_xen ) + { +switch ( boot_cpu_data.x86_vendor ) + { +case X86_VENDOR_INTEL : + ret =cpufreq_register_driver (&acpi_cpufreq_driver); +break ;
I've been wondering why we continue to tie this to Intel. I don't think there's much Intel specific in the ACPI driver, so I wonder whether this shouldn't use "default:" instead. But I can agree that's likely better to be done in a separate change.
xen/arch/x86/acpi/cpufreq/cpufreq.c static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { · line 355
Quoted 10 lines
xen/arch/x86/acpi/cpufreq/cpufreq.c +3
-2@@ -353,25 +349,13 @@ static const struct cpufreq_driver __initconstrel powernow_cpufreq_driver = { .update = powernow_cpufreq_update }; -unsigned int __init powernow_register_driver () +unsigned int __init powernow_register_driver (void ) { -unsigned int i, ret =0 ; +if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON )) ) +return -ENODEV ;
Ideally with this dropped (and of course with the issue pointed out by Roger taken care of)
Jan
PATCH 2/3 x86/cpufreq: Rework APERF/MPERF handling
In reply to Andrew CooperCurrently, each feature_detect() (called on CPU add) hook for both cpufreq drivers duplicates cpu_has_aperfmperf in a per-cpu datastructure, and edits cpufreq_driver.getavg to point at get_measured_perf().
As all parts of this are vendor-neutral, drop the function pointer and duplicated boolean, and call get_measured_perf() directly.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
Slightly RFC. This does introduce an arch-specific call into a nominally arch-neutral driver, but struct cpufreq_policy already had x86-specifics in it so this is apparently ok.
A (less desirable) alternative would be to keep the function pointer, and patch it in the BSP path, not every AP based on BSP data.
Either way, with patching moved out of feature_detect(), the main cpufreq_driver object can become __ro_after_init (in principle), and all calls optimised with alternative_call().
--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +------- xen/arch/x86/acpi/cpufreq/powernow.c | 6 ------ xen/drivers/cpufreq/utility.c | 9 +++------ xen/include/acpi/cpufreq/cpufreq.h | 2 -- 4 files changed, 4 insertions(+), 21 deletions(-)
xen/arch/x86/acpi/cpufreq/cpufreq.c +1 -7
@@ -275,7 +275,7 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)return 0 ; policy =per_cpu (cpufreq_cpu_policy, cpu); -if (!policy || !policy->aperf_mperf) +if ( !policy || !cpu_has_aperfmperf )return 0 ; switch (flag)
@@ -345,12 +345,6 @@ static void feature_detect(void *info)struct cpufreq_policy *policy = info;unsigned int eax; -if ( cpu_has_aperfmperf ) - { - policy->aperf_mperf =1 ; - cpufreq_driver.getavg = get_measured_perf; - } - eax =cpuid_eax (6 );if (eax &0x2 ) { policy->turbo =CPUFREQ_TURBO_ENABLED ;
xen/arch/x86/acpi/cpufreq/powernow.c +0 -6
@@ -205,12 +205,6 @@ static void feature_detect(void *info)struct cpufreq_policy *policy = info;unsigned int edx; -if ( cpu_has_aperfmperf ) - { - policy->aperf_mperf =1 ; - cpufreq_driver.getavg = get_measured_perf; - } - edx =cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES );if ((edx &CPB_CAPABLE ) ==CPB_CAPABLE ) { policy->turbo =CPUFREQ_TURBO_ENABLED ;
xen/drivers/cpufreq/utility.c +3 -6
@@ -381,12 +381,9 @@ int cpufreq_driver_getavg(unsigned int cpu, unsigned int flag)if (!cpu_online (cpu) || !(policy =per_cpu (cpufreq_cpu_policy, cpu)))return 0 ; -if (cpufreq_driver.getavg) - { - freq_avg = cpufreq_driver.getavg (cpu, flag); -if (freq_avg >0 ) -return freq_avg; - } + freq_avg =get_measured_perf (cpu, flag); +if ( freq_avg >0 ) +return freq_avg;return policy->cur; }
xen/include/acpi/cpufreq/cpufreq.h +0 -2
@@ -72,7 +72,6 @@ struct cpufreq_policy {s8 turbo;/* tristate flag: 0 for unsupported * -1 for disable, 1 for enabled * See CPUFREQ_TURBO_* below for defines */ -bool_t aperf_mperf;/* CPU has APERF/MPERF MSRs */ }; DECLARE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_policy);
@@ -162,7 +161,6 @@ struct cpufreq_driver {unsigned int target_freq, unsigned int relation);unsigned int (*get)(unsigned int cpu); -unsigned int (*getavg)(unsigned int cpu,unsigned int flag);int (*exit)(struct cpufreq_policy *policy); };
Signature · 1 line
2.11.0
Re: [PATCH 2/3] x86/cpufreq: Rework APERF/MPERF handling
Quoted 8 lines · Andrew Cooper
Currently, each
feature_detect()(called on CPU add) hook for both cpufreq drivers duplicatescpu_has_aperfmperfin a per-cpu datastructure, and edits cpufreq_driver.getavg to point atget_measured_perf().As all parts of this are vendor-neutral, drop the function pointer and duplicated boolean, and call
get_measured_perf()directly.Signed-off-by Andrew Cooper <[email protected]>
Quoted 8 lines
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>Slightly RFC. This does introduce an arch-specific call into a nominally arch-neutral driver, but struct
cpufreq_policyalready had x86-specifics in it so this is apparently ok.
That's fine for the time being; disentangling for another arch to use the driver would be quite a bit of work anyway.
Jan
PATCH 3/3 x86/cpufreq: Drop opencoded CPUID handling from powernow
In reply to Andrew CooperXen already collects CPUID.0x80000007.edx by default, meaning that we can refer to per-cpu data directly. This also avoids the need IPI the onlining CPU to identify whether Core Performance Boost is available.
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
I don't think the printk() is very helpful. I could be talked into retaining it as a prink_once(), but (irrespective of cpufreq_verbose), it doesn't want repeating on each CPU because it will either be all or none of them.
--- tools/misc/xen-cpuid.c | 3 ++- xen/arch/x86/acpi/cpufreq/powernow.c | 26 ++++---------------------- xen/include/asm-x86/cpufeature.h | 1 + xen/include/public/arch-x86/cpufeatureset.h | 2 ++ 4 files changed, 9 insertions(+), 23 deletions(-)
tools/misc/xen-cpuid.c +2 -1
@@ -139,7 +139,8 @@ static const char *const str_7c0[32] =static const char *const str_e7d[32 ] = { - [8 ] ="itsc" , +/* 6 */ [7 ] ="hw-pstate" , + [8 ] ="itsc" , [9 ] ="cpb" , [10 ] ="efro" , };
xen/arch/x86/acpi/cpufreq/powernow.c +4 -22
@@ -32,9 +32,6 @@#include <acpi/acpi.h> #include <acpi/cpufreq/cpufreq.h> -#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 -#define CPB_CAPABLE 0x00000200 -#define USE_HW_PSTATE 0x00000080#define HW_PSTATE_MASK 0x00000007#define HW_PSTATE_VALID_MASK 0x80000000#define HW_PSTATE_MAX_MASK 0x000000f0
@@ -200,21 +197,6 @@ static int powernow_cpufreq_verify(struct cpufreq_policy *policy)return cpufreq_frequency_table_verify (policy, data->freq_table); } -static void feature_detect (void *info) -{ -struct cpufreq_policy *policy = info; -unsigned int edx; - - edx =cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES ); -if ((edx &CPB_CAPABLE ) ==CPB_CAPABLE ) { - policy->turbo =CPUFREQ_TURBO_ENABLED ; -if (cpufreq_verbose) -printk (XENLOG_INFO -"CPU%u: Core Boost/Turbo detected and enabled\n" , -smp_processor_id ()); - } -} -static int powernow_cpufreq_cpu_init (struct cpufreq_policy *policy) {unsigned int i;
@@ -300,9 +282,9 @@ static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy)if (result) goto err_freqfree; -if (c->cpuid_level >=6 ) -on_selected_cpus (cpumask_of (cpu), feature_detect, policy,1 ); - +if (cpu_has (c,X86_FEATURE_CPB ) ) + policy->turbo =CPUFREQ_TURBO_ENABLED ; +/* * the first call to ->target() should result in us actually * writing something to the appropriate registers.
@@ -348,7 +330,7 @@ unsigned int __init powernow_register_driver(void)if ( !(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD |X86_VENDOR_HYGON )) )return -ENODEV ; -if ( !(cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES ) &USE_HW_PSTATE ) ) +if ( !cpu_has_hw_pstate )return -ENODEV ;return cpufreq_register_driver (&powernow_cpufreq_driver);
xen/include/asm-x86/cpufeature.h +1 -0
@@ -122,6 +122,7 @@#define cpu_has_enqcmd boot_cpu_has(X86_FEATURE_ENQCMD)/* CPUID level 0x80000007.edx */ +#define cpu_has_hw_pstate boot_cpu_has(X86_FEATURE_HW_PSTATE)#define cpu_has_itsc boot_cpu_has(X86_FEATURE_ITSC)/* CPUID level 0x80000008.ebx */
xen/include/public/arch-x86/cpufeatureset.h +2 -0
@@ -247,7 +247,9 @@ XEN_CPUFEATURE(MOVDIR64B, 6*32+28) /*a MOVDIR64B instruction */XEN_CPUFEATURE (ENQCMD ,6 *32 +29 )/* ENQCMD{,S} instructions */ /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */ +XEN_CPUFEATURE(HW_PSTATE, 7*32+ 7) /* Hardware Pstates */ XEN_CPUFEATURE(ITSC, 7*32+ 8) /*a Invariant TSC */ +XEN_CPUFEATURE(CPB, 7*32+ 9) /* Core Performance Boost (Turbo) */XEN_CPUFEATURE (EFRO ,7 *32 +10 )/* APERF/MPERF Read Only interface */ /* AMD-defined CPU features, CPUID level 0x80000008.ebx, word 8 */
Signature · 1 line
2.11.0
Re: [PATCH 3/3] x86/cpufreq: Drop opencoded CPUID handling from powernow
Quoted 5 lines · Andrew Cooper
Xen already collects CPUID.0x80000007.edx by default, meaning that we can refer to per-cpu data directly. This also avoids the need IPI the onlining CPU to identify whether Core Performance Boost is available.
Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH 3/3] x86/cpufreq: Drop opencoded CPUID handling from powernow
In reply to Andrew CooperQuoted 5 lines · Andrew Cooper
Xen already collects CPUID.0x80000007.edx by default, meaning that we can refer to per-cpu data directly. This also avoids the need IPI the onlining CPU to identify whether Core Performance Boost is available.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 8 lines
---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>I don't think the
printk()is very helpful. I could be talked into retaining it as aprink_once(), but (irrespective ofcpufreq_verbose), it doesn't want repeating on each CPU because it will either be all or none of them.
I should note that the printk() is also false. Nothing AFAICT synchronises the software turbo setting with hardware, until the next time set-turbo is called.
~Andrew