Intel Hardware P-States (HWP) support
v3 cover Intel Hardware P-States (HWP) support
Hi,
This patch series adds Hardware-Controlled Performance States (HWP) for Intel processors to Xen.
v2 was only partially reviewed, so v3 is mostly a reposting of v2. In v2 & v3, I think I addressed all comments for v1. I kept patch 11 "xenpm:
Factor out a non-fatal cpuid_parse variant", with a v2 comment explaining why I keep it.
v3 adds "xen/x86: Tweak PDC bits when using HWP". Qubes testing revealed an issue where enabling HWP can crash firwmare code (maybe SMM). This requires a Linux change to get the PDC bits from Xen and pass them to ACPI. Roger has a patch [0] to set the PDC bits. Roger's 3 patch series was tested with "xen/x86: Tweak PDC bits when using HWP" on affected hardware and allowed proper operation.
Previous cover letter:
With HWP, the processor makes its own determinations for frequency selection, though users can set some parameters and preferences. There is also Turbo Boost which dynamically pushes the max frequency if possible.
The existing governors don't work with HWP since they select frequencies and HWP doesn't expose those. Therefore a dummy hwp-interal governor is used that doesn't do anything.
xenpm get-cpufreq-para is extended to show HWP parameters, and set-cpufreq-hwp is added to set them.
A lightly loaded OpenXT laptop showed ~1W power savings according to powertop. A mostly idle Fedora system (dom0 only) showed a more modest power savings.
This for for a 10th gen 6-core 1600 MHz base 4900 MHZ max cpu. In the default balance mode, Turbo Boost doesn't exceed 4GHz. Tweaking the energy_perf preference with xenpm set-cpufreq-hwp balance ene:64, I've seen the CPU hit 4.7GHz before throttling down and bouncing around between 4.3 and 4.5 GHz. Curiously the other cores read ~4GHz when turbo boost takes affect. This was done after pinning all dom0 cores, and using taskset to pin to vCPU/pCPU 11 and running a bash tightloop.
HWP defaults to disabled and running with the existing HWP configuration
- it doesn't reconfigure by default. It can be enabled with cpufreq=xen:hwp.
Hardware Duty Cycling (HDC) is another feature to autonomously powerdown things. It defaults to enabled when HWP is enabled, but HDC can be disabled on the command line. cpufreq=xen:hwp,no-hdc
I've only tested on 8th gen and 10th gen systems with activity window and energy_perf support. So the pathes for CPUs lacking those features are untested.
Fast MSR support was removed in v2. The model specific checking was not done properly, and I don't have hardware to test with. Since writes are expected to be infrequent, I just removed the code.
This changes the systcl_pm_op hypercall, so that wants review.
Regards,
Jason
[0] https://lore.kernel.org/xen-devel/[email protected]/
Jason Andryuk (14):
cpufreq: Allow restricting to internal governors only
cpufreq: Add perf_freq to cpuinfo
cpufreq: Export intel_feature_detect
cpufreq: Add Hardware P-State (HWP) driver
xenpm: Change get-cpufreq-para output for internal xen/x86: Tweak PDC bits when using HWP
cpufreq: Export HWP parameters to userspace
libxc: Include hwp_para in definitions
xenpm: Print HWP parameters
xen: Add SET_CPUFREQ_HWP xen_sysctl_pm_op
libxc: Add xc_set_cpufreq_hwp
xenpm: Factor out a non-fatal cpuid_parse variant
xenpm: Add set-cpufreq-hwp subcommand
CHANGELOG: Add Intel HWP entry
CHANGELOG.md | 1 + docs/misc/xen-command-line.pandoc | 8 +- tools/include/xenctrl.h | 6 + tools/libs/ctrl/xc_pm.c | 18 + tools/misc/xenpm.c | 355 +++++++++++- xen/arch/x86/acpi/cpufreq/Makefile | 1 + xen/arch/x86/acpi/cpufreq/cpufreq.c | 15 +- xen/arch/x86/acpi/cpufreq/hwp.c | 633 ++++++++++++++++++++++ xen/arch/x86/acpi/lib.c | 5 + xen/arch/x86/cpu/mcheck/mce_intel.c | 6 + xen/arch/x86/include/asm/cpufeature.h | 13 +- xen/arch/x86/include/asm/msr-index.h | 14 + xen/drivers/acpi/pmstat.c | 23 + xen/drivers/cpufreq/cpufreq.c | 40 ++ xen/drivers/cpufreq/utility.c | 1 + xen/include/acpi/cpufreq/cpufreq.h | 14 + xen/include/acpi/cpufreq/processor_perf.h | 4 + xen/include/acpi/pdc_intel.h | 1 + xen/include/public/sysctl.h | 57 ++ 19 files changed, 1187 insertions(+), 28 deletions(-) create mode 100644 xen/arch/x86/acpi/cpufreq/hwp.c
Signature · 1 line
2.40.0
PATCH v3 1/14 cpufreq: Allow restricting to internal governors only
For hwp, the standard governors are not usable, and only the internal one is applicable. Add the cpufreq_governor_internal boolean to indicate when an internal governor, like hwp-internal, will be used. This is set during presmp_initcall, so that it can suppress governor registration during initcall. Only a governor with a name containing "-internal" will be allowed in that case.
This way, the unuseable governors are not registered, so the internal one is the only one returned to userspace. This means incompatible governors won't be advertised to userspace.
---
v3:
Switch to initdata
Add Jan Acked-by
Commit message s/they/the/ typo
Don't register hwp-internal when running non-hwp - Marek
v2:
Switch to "-internal"
Add blank line in header
--- xen/drivers/cpufreq/cpufreq.c | 8 ++++++++ xen/include/acpi/cpufreq/cpufreq.h | 2 ++ 2 files changed, 10 insertions(+)
xen/drivers/cpufreq/cpufreq.c +8 -0
@@ -56,6 +56,7 @@ struct cpufreq_dom { };static LIST_HEAD_READ_MOSTLY (cpufreq_dom_list_head); +bool __initdata cpufreq_governor_internal;struct cpufreq_governor *__read_mostly cpufreq_opt_governor;LIST_HEAD_READ_MOSTLY (cpufreq_governor_list);
@@ -121,6 +122,13 @@ int __init cpufreq_register_governor(struct cpufreq_governor *governor)if (!governor)return -EINVAL ; +if (cpufreq_governor_internal && +strstr (governor->name,"-internal" ) ==NULL ) +return -EINVAL ; + +if (!cpufreq_governor_internal &&strstr (governor->name,"-internal" )) +return -EINVAL ; +if (__find_governor (governor->name) !=NULL )return -EEXIST ;
xen/include/acpi/cpufreq/cpufreq.h +2 -0
@@ -114,6 +114,8 @@ extern struct cpufreq_governor cpufreq_gov_userspace;extern struct cpufreq_governor cpufreq_gov_performance;extern struct cpufreq_governor cpufreq_gov_powersave; +extern bool cpufreq_governor_internal; +extern struct list_head cpufreq_governor_list;extern int cpufreq_register_governor (struct cpufreq_governor *governor);
Signature · 1 line
2.40.0
PATCH v3 2/14 cpufreq: Add perf_freq to cpuinfo
In reply to Jason Andryukacpi-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.
---
v3:
Add Jan's Ack
I don't like this, but it seems the best way to re-use the common aperf/mperf code. The other option would be to add wrappers that then do the acpi vs. hwp scaling.
--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 +- xen/drivers/cpufreq/utility.c | 1 + xen/include/acpi/cpufreq/cpufreq.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-)
xen/arch/x86/acpi/cpufreq/cpufreq.c +1 -1
@@ -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)
xen/drivers/cpufreq/utility.c +1 -0
@@ -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 )
xen/include/acpi/cpufreq/cpufreq.h +3 -0
@@ -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 */ };
Signature · 1 line
2.40.0
PATCH v3 3/14 cpufreq: Export intel_feature_detect
In reply to Jason AndryukExport feature_detect as intel_feature_detect so it can be re-used by HWP.
---
v3:
Remove void * cast when calling intel_feature_detect
v2:
export intel_feature_detect with typed pointer
Move intel_feature_detect to acpi/cpufreq/cpufreq.h since the declaration now contains struct cpufreq_policy *.
--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 ++++++-- xen/include/acpi/cpufreq/cpufreq.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
xen/arch/x86/acpi/cpufreq/cpufreq.c +6 -2
@@ -339,9 +339,8 @@ static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu)return extract_freq (get_cur_val (cpumask_of (cpu)), data); } -static void cf_check feature_detect(void *info) +void intel_feature_detect (struct cpufreq_policy *policy) { -struct cpufreq_policy *policy = info;unsigned int eax; eax =cpuid_eax (6 );
@@ -353,6 +352,11 @@ static void cf_check feature_detect(void *info) } } +static void cf_check feature_detect(void *info) +{ +intel_feature_detect (info); +} +static unsigned int check_freqs (const cpumask_t *mask,unsigned int freq,struct acpi_cpufreq_data *data) {
xen/include/acpi/cpufreq/cpufreq.h +2 -0
@@ -243,4 +243,6 @@ int write_userspace_scaling_setspeed(unsigned int cpu, unsigned int freq);void cpufreq_dbs_timer_suspend (void );void cpufreq_dbs_timer_resume (void ); +void intel_feature_detect (struct cpufreq_policy *policy); +#endif /* __XEN_CPUFREQ_PM_H__ */
Signature · 1 line
2.40.0
PATCH v3 4/14 cpufreq: Add Hardware P-State (HWP) driver
In reply to Jason AndryukFrom the Intel SDM: "Hardware-Controlled Performance States (HWP), which autonomously selects performance states while utilizing OS supplied performance guidance hints."
Enable HWP to run in autonomous mode by poking the correct MSRs. cpufreq=xen:hwp enables and cpufreq=xen:hwp=0 disables. The same for hdc.
There is no interface to configure - xen_sysctl_pm_op/xenpm will be to be extended to configure in subsequent patches. It will run with the default values, which should be the default 0x80 (out
of 0x0-0xff) energy/performance preference.
Unscientific powertop measurement of an mostly idle, customized OpenXT install:
A 10th gen 6-core laptop showed battery discharge drop from ~9.x to ~7.x watts.
A 8th gen 4-core laptop dropped from ~10 to ~9
Power usage depends on many factors, especially display brightness, but this does show an power saving in balanced mode when CPU utilization is low.
HWP isn't compatible with an external governor - it doesn't take explicit frequency requests. Therefore a minimal internal governor, hwp-internal, is also added as a placeholder.
While adding to the xen-command-line.pandoc entry, un-nest verbose from minfreq. They are independent.
---
We disable on cpuid_level < 0x16. cpuid(0x16) is used to get the cpu frequencies for calculating the APERF/MPERF. Without it, things would still work, but the averge cpufrequency output would be wrong.
My 8th & 10th gen test systems both report:
(XEN) HWP: 1 notify: 1 act_window: 1 energy_perf: 1 pkg_level: 0 peci: 0 (XEN) HWP: Hardware Duty Cycling (HDC) supported
(XEN) HWP: HW_FEEDBACK not supported
IA32_ENERGY_PERF_BIAS has not been tested.
For cpufreq=xen:hwp, placing the option inside the governor wouldn't work. Users would have to select the hwp-internal governor to turn off hwp support. hwp-internal isn't usable without hwp, and users wouldn't be able to select a different governor. That doesn't matter while hwp defaults off, but it would if or when hwp defaults to enabled.
We can't use parse_boolean() since it requires a single name=val string and cpufreq_handle_common_option is provided two strings. Use parse_bool() and manual handle no-hwp.
Write to disable the interrupt - the linux pstate driver does this. We don't use the interrupts, so we can just turn them off. We aren't ready to handle them, so we don't want any. Unclear if this is necessary. SDM says it's default disabled.
FAST_IA32_HWP_REQUEST was removed in v2. The check in v1 was wrong, it's a model specific feature and the CPUID bit is only available after enabling via the MSR. Support was untested since I don't have hardware with the feature. Writes are expected to be infrequent, so just leave it out.
---
v2:
Alphabetize headers
Re-work driver registration
name hwp_drv_data anonymous union "hw"
Drop hwp_verbose_cont
style cleanups
Condense hwp_governor switchhwp_cpufreq_target remove .raw from hwp_req assignment Use typed-pointer in a few functions
Pass type to xzalloc
Add HWP_ENERGY_PERF_BALANCE/IA32_ENERGY_BIAS_BALANCE defines Add XEN_HWP_GOVERNOR define for "hwp-internal" Capitalize CPUID and MSR defines
Change '_' to '-' for energy-perf & act-window Read-modify-write MSRs updates
Use FAST_IA32_HWP_REQUEST_MSR_ENABLE define
constify pointer in hwp_set_misc_turbo
Add space after non-fallthrough break in governor switch Add IA32_ENERGY_BIAS_MASK define
Check CPUID_PM_LEAK for energy bias when needed
Fail initialization with curr_req = -1
Fold hwp_read_capabilities into hwp_init_msrs
Add command line cpufreq=xen:hwp
Add command line cpufreq=xen:hdc
Use per_cpu for hwp_drv_data pointers
Move hwp_energy_perf_bias call into hwp_write_request energy_perf 0 is valid, so hwp_energy_perf_bias cannot be skipped Ensure we don't generate interrupts
Remove Fast Write of Uncore MSR
Initialize hwp_drv_data from curr_req
Use SPDX line instead of license text in hwp.c
v3:
Add cf_check to cpufreq_gov_hwp_init() - Marek
Print cpuid_level with %#x - Marek
--- docs/misc/xen-command-line.pandoc | 8 +- xen/arch/x86/acpi/cpufreq/Makefile | 1 + xen/arch/x86/acpi/cpufreq/cpufreq.c | 5 +- xen/arch/x86/acpi/cpufreq/hwp.c | 506 ++++++++++++++++++++++ xen/arch/x86/include/asm/cpufeature.h | 13 +- xen/arch/x86/include/asm/msr-index.h | 13 + xen/drivers/cpufreq/cpufreq.c | 32 ++ xen/include/acpi/cpufreq/cpufreq.h | 3 + xen/include/acpi/cpufreq/processor_perf.h | 3 + xen/include/public/sysctl.h | 1 + 10 files changed, 581 insertions(+), 4 deletions(-) create mode 100644 xen/arch/x86/acpi/cpufreq/hwp.c
docs/misc/xen-command-line.pandoc +7 -1
@@ -499,7 +499,7 @@ If set, force use of the performance counters for oprofile, rather than detectin available support. ### cpufreq -> `= none | {{ <boolean> | xen } [:[powersave|performance|ondemand|userspace][,<maxfreq>][,[<minfreq>][,[verbose]]]]} | dom0-kernel` +> `= none | {{ <boolean> | xen } [:[powersave|performance|ondemand|userspace][,<hdc>][,[<hwp>]][,[<maxfreq>]][,[<minfreq>]][,[verbose]]]} | dom0-kernel` > Default: `xen`
@@ -510,6 +510,12 @@ choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels. * `<maxfreq>` and `<minfreq>` are integers which represent max and min processor frequencies respectively. * `verbose` option can be included as a string or also as `verbose=<integer>` +* `<hwp>` is a boolean to enable Hardware-Controlled Performance States (HWP) + on supported Intel hardware. HWP is a Skylake+ feature which provides better + CPU power management. The default is disabled. +* `<hdc>` is a boolean to enable Hardware Duty Cycling (HDC). HDC enables the + processor to autonomously force physical package components into idle state. + The default is enabled, but the option only applies when `<hwp>` is enabled. ### cpuid (x86) > `= List of comma separated booleans`
xen/arch/x86/acpi/cpufreq/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-y += cpufreq.o +obj-y += hwp.o obj-y += powernow.o
xen/arch/x86/acpi/cpufreq/cpufreq.c +4 -1
@@ -642,7 +642,10 @@ static int __init cf_check cpufreq_driver_init(void)switch ( boot_cpu_data.x86_vendor ) {case X86_VENDOR_INTEL : - ret =cpufreq_register_driver (&acpi_cpufreq_driver); +if (hwp_available () ) + ret =hwp_register_driver (); +else + ret =cpufreq_register_driver (&acpi_cpufreq_driver);break ;case X86_VENDOR_AMD :
xen/arch/x86/acpi/cpufreq/hwp.c new file +506 -0
506 lines not on this page · raw message
xen/arch/x86/include/asm/cpufeature.h +11 -2
@@ -46,8 +46,17 @@ extern struct cpuinfo_x86 boot_cpu_data;#define cpu_has (c, bit) test_bit(bit, (c)->x86_capability)#define boot_cpu_has (bit) test_bit(bit, boot_cpu_data.x86_capability) -#define CPUID_PM_LEAF 6 -#define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1 +#define CPUID_PM_LEAF 6 +#define CPUID6_EAX_HWP (_AC(1, U) << 7) +#define CPUID6_EAX_HWP_NOTIFICATION (_AC(1, U) << 8) +#define CPUID6_EAX_HWP_ACTIVITY_WINDOW (_AC(1, U) << 9) +#define CPUID6_EAX_HWP_ENERGY_PERFORMANCE_PREFERENCE (_AC(1, U) << 10) +#define CPUID6_EAX_HWP_PACKAGE_LEVEL_REQUEST (_AC(1, U) << 11) +#define CPUID6_EAX_HDC (_AC(1, U) << 13) +#define CPUID6_EAX_HWP_PECI (_AC(1, U) << 16) +#define CPUID6_EAX_HW_FEEDBACK (_AC(1, U) << 19) +#define CPUID6_ECX_APERFMPERF_CAPABILITY 0x1 +#define CPUID6_ECX_IA32_ENERGY_PERF_BIAS 0x8/* CPUID level 0x00000001.edx */ #define cpu_has_fpu 1
xen/arch/x86/include/asm/msr-index.h +13 -0
@@ -151,6 +151,13 @@#define MSR_PKRS 0x000006e1 +#define MSR_IA32_PM_ENABLE 0x00000770 +#define IA32_PM_ENABLE_HWP_ENABLE (_AC(1, ULL) << 0) + +#define MSR_IA32_HWP_CAPABILITIES 0x00000771 +#define MSR_IA32_HWP_INTERRUPT 0x00000773 +#define MSR_IA32_HWP_REQUEST 0x00000774 +#define MSR_X2APIC_FIRST 0x00000800#define MSR_X2APIC_LAST 0x000008ff
@@ -165,6 +172,11 @@#define PASID_PASID_MASK 0x000fffff#define PASID_VALID (_AC(1, ULL) << 31) +#define MSR_IA32_PKG_HDC_CTL 0x00000db0 +#define IA32_PKG_HDC_CTL_HDC_PKG_ENABLE (_AC(1, ULL) << 0) +#define MSR_IA32_PM_CTL1 0x00000db1 +#define IA32_PM_CTL1_HDC_ALLOW_BLOCK (_AC(1, ULL) << 0) +#define MSR_UARCH_MISC_CTRL 0x00001b01#define UARCH_CTRL_DOITM (_AC(1, ULL) << 0)
@@ -500,6 +512,7 @@#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1<<22)#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1<<23)#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34) +#define MSR_IA32_MISC_ENABLE_TURBO_DISENGAGE (1ULL << 38)#define MSR_IA32_TSC_DEADLINE 0x000006E0#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0
xen/drivers/cpufreq/cpufreq.c +32 -0
@@ -565,6 +565,38 @@ static void cpufreq_cmdline_common_para(struct cpufreq_policy *new_policy)static int __init cpufreq_handle_common_option (const char *name,const char *val) { +if (!strcmp (name,"hdc" )) { +if (val) { +int ret =parse_bool (val,NULL ); +if (ret !=-1 ) { + opt_cpufreq_hdc = ret; +return 1 ; + } + }else { + opt_cpufreq_hdc = true; +return 1 ; + } + }else if (!strcmp (name,"no-hdc" )) { + opt_cpufreq_hdc = false; +return 1 ; + } + +if (!strcmp (name,"hwp" )) { +if (val) { +int ret =parse_bool (val,NULL ); +if (ret !=-1 ) { + opt_cpufreq_hwp = ret; +return 1 ; + } + }else { + opt_cpufreq_hwp = true; +return 1 ; + } + }else if (!strcmp (name,"no-hwp" )) { + opt_cpufreq_hwp = false; +return 1 ; + } +if (!strcmp (name,"maxfreq" ) && val) { usr_max_freq =simple_strtoul (val,NULL ,0 );return 1 ;
xen/include/acpi/cpufreq/cpufreq.h +3 -0
@@ -245,4 +245,7 @@ void cpufreq_dbs_timer_resume(void);void intel_feature_detect (struct cpufreq_policy *policy); +extern bool opt_cpufreq_hwp; +extern bool opt_cpufreq_hdc; +#endif /* __XEN_CPUFREQ_PM_H__ */
xen/include/acpi/cpufreq/processor_perf.h +3 -0
@@ -7,6 +7,9 @@#define XEN_PX_INIT 0x80000000 +bool hwp_available (void ); +int hwp_register_driver (void ); +int powernow_cpufreq_init (void );unsigned int powernow_register_driver (void );unsigned int get_measured_perf (unsigned int cpu,unsigned int flag);
xen/include/public/sysctl.h +1 -0
@@ -292,6 +292,7 @@ struct xen_ondemand {uint32_t up_threshold; }; +#define XEN_HWP_GOVERNOR "hwp-internal"/* * cpufreq para name of this structure named * same as sysfs file name of native linux
Signature · 1 line
2.40.0
PATCH v3 5/14 xenpm: Change get-cpufreq-para output for internal
In reply to Jason AndryukWhen using HWP, some of the returned data is not applicable. In that case, we should just omit it to avoid confusing the user. So switch to printing the base and turbo frequencies since those are relevant to HWP. Similarly, stop printing the CPU frequencies since those do not apply.
---
v2:
Use full governor name XEN_HWP_GOVERNOR to change output Style fixes
--- tools/misc/xenpm.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-)
tools/misc/xenpm.c +25 -16
@@ -711,6 +711,7 @@ void start_gather_func(int argc, char *argv[])/* print out parameters about cpu frequency */ static void print_cpufreq_para (int cpuid,struct xc_get_cpufreq_para *p_cpufreq) { +bool internal =strstr (p_cpufreq->scaling_governor,XEN_HWP_GOVERNOR );int i;printf ("cpu id : %d\n" , cpuid);
@@ -720,10 +721,15 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq)printf (" %d" , p_cpufreq->affected_cpus[i]);printf ("\n" ); -printf ("cpuinfo frequency : max [%u] min [%u] cur [%u]\n" , - p_cpufreq->cpuinfo_max_freq, - p_cpufreq->cpuinfo_min_freq, - p_cpufreq->cpuinfo_cur_freq); +if ( internal ) +printf ("cpuinfo frequency : base [%u] turbo [%u]\n" , + p_cpufreq->cpuinfo_min_freq, + p_cpufreq->cpuinfo_max_freq); +else +printf ("cpuinfo frequency : max [%u] min [%u] cur [%u]\n" , + p_cpufreq->cpuinfo_max_freq, + p_cpufreq->cpuinfo_min_freq, + p_cpufreq->cpuinfo_cur_freq);printf ("scaling_driver : %s\n" , p_cpufreq->scaling_driver);
@@ -750,19 +756,22 @@ static void print_cpufreq_para(int cpuid, struct xc_get_cpufreq_para *p_cpufreq) p_cpufreq->u.ondemand.up_threshold); } -printf ("scaling_avail_freq :" ); -for ( i =0 ; i < p_cpufreq->freq_num; i++ ) -if ( p_cpufreq->scaling_available_frequencies[i] == - p_cpufreq->scaling_cur_freq ) -printf (" *%d" , p_cpufreq->scaling_available_frequencies[i]); -else -printf (" %d" , p_cpufreq->scaling_available_frequencies[i]); -printf ("\n" ); +if ( !internal ) + { +printf ("scaling_avail_freq :" ); +for ( i =0 ; i < p_cpufreq->freq_num; i++ ) +if ( p_cpufreq->scaling_available_frequencies[i] == + p_cpufreq->scaling_cur_freq ) +printf (" *%d" , p_cpufreq->scaling_available_frequencies[i]); +else +printf (" %d" , p_cpufreq->scaling_available_frequencies[i]); +printf ("\n" ); -printf ("scaling frequency : max [%u] min [%u] cur [%u]\n" , - p_cpufreq->scaling_max_freq, - p_cpufreq->scaling_min_freq, - p_cpufreq->scaling_cur_freq); +printf ("scaling frequency : max [%u] min [%u] cur [%u]\n" , + p_cpufreq->scaling_max_freq, + p_cpufreq->scaling_min_freq, + p_cpufreq->scaling_cur_freq); + }printf ("turbo mode : %s\n" , p_cpufreq->turbo_enabled ?"enabled" :"disabled or n/a" );
Signature · 1 line
2.40.0