Commit 49fae454 authored by Ingo Molnar's avatar Ingo Molnar Committed by Greg Kroah-Hartman

x86: mce: Fix thermal throttling message storm

commit b417c9fd upstream.

If a system switches back and forth between hot and cold mode,
the MCE code will print a stream of critical kernel messages.

Extend the throttling code to properly notice this, by
only printing the first hot + cold transition and omitting
the rest up to CHECK_INTERVAL (5 minutes).

This way we'll only get a single incident of:

 [  102.356584] CPU0: Temperature above threshold, cpu clock throttled (total events = 1)
 [  102.357000] Disabling lock debugging due to kernel taint
 [  102.369223] CPU0: Temperature/speed normal

Every 5 minutes. The 'total events' count tells the number of cold/hot
transitions detected, should overheating occur after 5 minutes again:

[  402.357580] CPU0: Temperature above threshold, cpu clock throttled (total events = 24891)
[  402.358001] CPU0: Temperature/speed normal
[  450.704142] Machine check events logged

Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fe2414ca
...@@ -42,6 +42,7 @@ struct thermal_state { ...@@ -42,6 +42,7 @@ struct thermal_state {
u64 next_check; u64 next_check;
unsigned long throttle_count; unsigned long throttle_count;
unsigned long last_throttle_count;
}; };
static DEFINE_PER_CPU(struct thermal_state, thermal_state); static DEFINE_PER_CPU(struct thermal_state, thermal_state);
...@@ -120,11 +121,12 @@ static int therm_throt_process(bool is_throttled) ...@@ -120,11 +121,12 @@ static int therm_throt_process(bool is_throttled)
if (is_throttled) if (is_throttled)
state->throttle_count++; state->throttle_count++;
if (!(was_throttled ^ is_throttled) && if (time_before64(now, state->next_check) &&
time_before64(now, state->next_check)) state->throttle_count != state->last_throttle_count)
return 0; return 0;
state->next_check = now + CHECK_INTERVAL; state->next_check = now + CHECK_INTERVAL;
state->last_throttle_count = state->throttle_count;
/* if we just entered the thermal event */ /* if we just entered the thermal event */
if (is_throttled) { if (is_throttled) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment