Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/power x86_energy_perf_policy: Enhance HWP enable

On enabling HWP, preserve the reserved bits in MSR_PM_ENABLE.

Also, skip writing the MSR_PM_ENABLE if HWP is already enabled.

Signed-off-by: Len Brown <len.brown@intel.com>

Len Brown c97c057d b6b42a60

+9 -4
+9 -4
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
··· 1166 1166 1167 1167 int enable_hwp_on_cpu(int cpu) 1168 1168 { 1169 - unsigned long long msr; 1169 + unsigned long long old_msr, new_msr; 1170 1170 1171 - get_msr(cpu, MSR_PM_ENABLE, &msr); 1172 - put_msr(cpu, MSR_PM_ENABLE, 1); 1171 + get_msr(cpu, MSR_PM_ENABLE, &old_msr); 1172 + 1173 + if (old_msr & 1) 1174 + return 0; /* already enabled */ 1175 + 1176 + new_msr = old_msr | 1; 1177 + put_msr(cpu, MSR_PM_ENABLE, new_msr); 1173 1178 1174 1179 if (verbose) 1175 - printf("cpu%d: MSR_PM_ENABLE old: %d new: %d\n", cpu, (unsigned int) msr, 1); 1180 + printf("cpu%d: MSR_PM_ENABLE old: %llX new: %llX\n", cpu, old_msr, new_msr); 1176 1181 1177 1182 return 0; 1178 1183 }