diff options
author | Fenghua Yu <fenghua.yu@intel.com> | 2013-05-21 15:35:17 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2013-06-14 17:49:00 -0400 |
commit | 6bb2ff846f24fa6efee756e5e2a2b8433d65671e (patch) | |
tree | 5228c5cf075acac76a7043ec418da33056743678 /arch/x86/kernel | |
parent | c81147483e525e4a471d581877d7d634591246e1 (diff) |
x86 thermal: Disable power limit notification interrupt by default
The package power limit notification interrupt is primarily for
system diagnosis, and should not be blindly enabled on every
system by default -- particuarly since Linux does nothing in the
handler except count how many times it has been called...
Add a new kernel cmdline parameter "int_pln_enable" for situations where
users want to oberve these events via existing system counters:
$ grep TRM /proc/interrupts
$ grep . /sys/devices/system/cpu/cpu*/thermal_throttle/*
https://bugzilla.kernel.org/show_bug.cgi?id=36182
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/therm_throt.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index 68fa89043abf..f7feb2e9ed17 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -210,6 +210,15 @@ static int thresh_event_valid(int event) | |||
210 | return 1; | 210 | return 1; |
211 | } | 211 | } |
212 | 212 | ||
213 | static bool int_pln_enable; | ||
214 | static int __init int_pln_enable_setup(char *s) | ||
215 | { | ||
216 | int_pln_enable = true; | ||
217 | |||
218 | return 1; | ||
219 | } | ||
220 | __setup("int_pln_enable", int_pln_enable_setup); | ||
221 | |||
213 | #ifdef CONFIG_SYSFS | 222 | #ifdef CONFIG_SYSFS |
214 | /* Add/Remove thermal_throttle interface for CPU device: */ | 223 | /* Add/Remove thermal_throttle interface for CPU device: */ |
215 | static __cpuinit int thermal_throttle_add_dev(struct device *dev, | 224 | static __cpuinit int thermal_throttle_add_dev(struct device *dev, |
@@ -222,7 +231,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev, | |||
222 | if (err) | 231 | if (err) |
223 | return err; | 232 | return err; |
224 | 233 | ||
225 | if (cpu_has(c, X86_FEATURE_PLN)) | 234 | if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable) |
226 | err = sysfs_add_file_to_group(&dev->kobj, | 235 | err = sysfs_add_file_to_group(&dev->kobj, |
227 | &dev_attr_core_power_limit_count.attr, | 236 | &dev_attr_core_power_limit_count.attr, |
228 | thermal_attr_group.name); | 237 | thermal_attr_group.name); |
@@ -230,7 +239,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev, | |||
230 | err = sysfs_add_file_to_group(&dev->kobj, | 239 | err = sysfs_add_file_to_group(&dev->kobj, |
231 | &dev_attr_package_throttle_count.attr, | 240 | &dev_attr_package_throttle_count.attr, |
232 | thermal_attr_group.name); | 241 | thermal_attr_group.name); |
233 | if (cpu_has(c, X86_FEATURE_PLN)) | 242 | if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable) |
234 | err = sysfs_add_file_to_group(&dev->kobj, | 243 | err = sysfs_add_file_to_group(&dev->kobj, |
235 | &dev_attr_package_power_limit_count.attr, | 244 | &dev_attr_package_power_limit_count.attr, |
236 | thermal_attr_group.name); | 245 | thermal_attr_group.name); |
@@ -343,7 +352,7 @@ static void intel_thermal_interrupt(void) | |||
343 | CORE_LEVEL) != 0) | 352 | CORE_LEVEL) != 0) |
344 | mce_log_therm_throt_event(msr_val); | 353 | mce_log_therm_throt_event(msr_val); |
345 | 354 | ||
346 | if (this_cpu_has(X86_FEATURE_PLN)) | 355 | if (this_cpu_has(X86_FEATURE_PLN) && int_pln_enable) |
347 | therm_throt_process(msr_val & THERM_STATUS_POWER_LIMIT, | 356 | therm_throt_process(msr_val & THERM_STATUS_POWER_LIMIT, |
348 | POWER_LIMIT_EVENT, | 357 | POWER_LIMIT_EVENT, |
349 | CORE_LEVEL); | 358 | CORE_LEVEL); |
@@ -353,7 +362,7 @@ static void intel_thermal_interrupt(void) | |||
353 | therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT, | 362 | therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT, |
354 | THERMAL_THROTTLING_EVENT, | 363 | THERMAL_THROTTLING_EVENT, |
355 | PACKAGE_LEVEL); | 364 | PACKAGE_LEVEL); |
356 | if (this_cpu_has(X86_FEATURE_PLN)) | 365 | if (this_cpu_has(X86_FEATURE_PLN) && int_pln_enable) |
357 | therm_throt_process(msr_val & | 366 | therm_throt_process(msr_val & |
358 | PACKAGE_THERM_STATUS_POWER_LIMIT, | 367 | PACKAGE_THERM_STATUS_POWER_LIMIT, |
359 | POWER_LIMIT_EVENT, | 368 | POWER_LIMIT_EVENT, |
@@ -461,9 +470,13 @@ void intel_init_thermal(struct cpuinfo_x86 *c) | |||
461 | apic_write(APIC_LVTTHMR, h); | 470 | apic_write(APIC_LVTTHMR, h); |
462 | 471 | ||
463 | rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); | 472 | rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); |
464 | if (cpu_has(c, X86_FEATURE_PLN)) | 473 | if (cpu_has(c, X86_FEATURE_PLN) && !int_pln_enable) |
474 | wrmsr(MSR_IA32_THERM_INTERRUPT, | ||
475 | (l | (THERM_INT_LOW_ENABLE | ||
476 | | THERM_INT_HIGH_ENABLE)) & ~THERM_INT_PLN_ENABLE, h); | ||
477 | else if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable) | ||
465 | wrmsr(MSR_IA32_THERM_INTERRUPT, | 478 | wrmsr(MSR_IA32_THERM_INTERRUPT, |
466 | l | (THERM_INT_LOW_ENABLE | 479 | l | (THERM_INT_LOW_ENABLE |
467 | | THERM_INT_HIGH_ENABLE | THERM_INT_PLN_ENABLE), h); | 480 | | THERM_INT_HIGH_ENABLE | THERM_INT_PLN_ENABLE), h); |
468 | else | 481 | else |
469 | wrmsr(MSR_IA32_THERM_INTERRUPT, | 482 | wrmsr(MSR_IA32_THERM_INTERRUPT, |
@@ -471,9 +484,14 @@ void intel_init_thermal(struct cpuinfo_x86 *c) | |||
471 | 484 | ||
472 | if (cpu_has(c, X86_FEATURE_PTS)) { | 485 | if (cpu_has(c, X86_FEATURE_PTS)) { |
473 | rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h); | 486 | rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h); |
474 | if (cpu_has(c, X86_FEATURE_PLN)) | 487 | if (cpu_has(c, X86_FEATURE_PLN) && !int_pln_enable) |
475 | wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, | 488 | wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, |
476 | l | (PACKAGE_THERM_INT_LOW_ENABLE | 489 | (l | (PACKAGE_THERM_INT_LOW_ENABLE |
490 | | PACKAGE_THERM_INT_HIGH_ENABLE)) | ||
491 | & ~PACKAGE_THERM_INT_PLN_ENABLE, h); | ||
492 | else if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable) | ||
493 | wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, | ||
494 | l | (PACKAGE_THERM_INT_LOW_ENABLE | ||
477 | | PACKAGE_THERM_INT_HIGH_ENABLE | 495 | | PACKAGE_THERM_INT_HIGH_ENABLE |
478 | | PACKAGE_THERM_INT_PLN_ENABLE), h); | 496 | | PACKAGE_THERM_INT_PLN_ENABLE), h); |
479 | else | 497 | else |