-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] x86: Refactor thermal throttle processing
Refactor the event processing (syslog messaging and rate limiting) into separate file therm_throt.c. This allows consistent reporting of CPU thermal throttle events. After ACK'ing the interrupt, if the event is current, the user (p4.c/mce_intel.c) calls therm_throt_process to log (and rate limit) the event. If that function returns 1, the user has the option to log things further (such as to mce_log in x86_64). AK: minor cleanup Signed-off-by: Dmitriy Zavin <dmitriyz@google.com> Signed-off-by: Andi Kleen <ak@suse.de>
- Loading branch information
Dmitriy Zavin
authored and
Andi Kleen
committed
Sep 26, 2006
1 parent
3b17167
commit 15d5f83
Showing
9 changed files
with
109 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
obj-y = mce.o k7.o p4.o p5.o p6.o winchip.o | ||
obj-y = mce.o k7.o p4.o p5.o p6.o winchip.o therm_throt.o | ||
obj-$(CONFIG_X86_MCE_NONFATAL) += non-fatal.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* linux/arch/i386/kerne/cpu/mcheck/therm_throt.c | ||
* | ||
* Thermal throttle event support code. | ||
* | ||
* Author: Dmitriy Zavin (dmitriyz@google.com) | ||
* | ||
* Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c. | ||
* | ||
*/ | ||
|
||
#include <linux/percpu.h> | ||
#include <linux/cpu.h> | ||
#include <asm/cpu.h> | ||
#include <linux/notifier.h> | ||
#include <asm/therm_throt.h> | ||
|
||
/* How long to wait between reporting thermal events */ | ||
#define CHECK_INTERVAL (300 * HZ) | ||
|
||
static DEFINE_PER_CPU(unsigned long, next_check); | ||
|
||
/*** | ||
* therm_throt_process - Process thermal throttling event | ||
* @curr: Whether the condition is current or not (boolean), since the | ||
* thermal interrupt normally gets called both when the thermal | ||
* event begins and once the event has ended. | ||
* | ||
* This function is normally called by the thermal interrupt after the | ||
* IRQ has been acknowledged. | ||
* | ||
* It will take care of rate limiting and printing messages to the syslog. | ||
* | ||
* Returns: 0 : Event should NOT be further logged, i.e. still in | ||
* "timeout" from previous log message. | ||
* 1 : Event should be logged further, and a message has been | ||
* printed to the syslog. | ||
*/ | ||
int therm_throt_process(int curr) | ||
{ | ||
unsigned int cpu = smp_processor_id(); | ||
|
||
if (time_before(jiffies, __get_cpu_var(next_check))) | ||
return 0; | ||
|
||
__get_cpu_var(next_check) = jiffies + CHECK_INTERVAL; | ||
|
||
/* if we just entered the thermal event */ | ||
if (curr) { | ||
printk(KERN_CRIT "CPU%d: Temperature above threshold, " | ||
"cpu clock throttled\n", cpu); | ||
add_taint(TAINT_MACHINE_CHECK); | ||
} else { | ||
printk(KERN_CRIT "CPU%d: Temperature/speed normal\n", cpu); | ||
} | ||
|
||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef __ASM_I386_THERM_THROT_H__ | ||
#define __ASM_I386_THERM_THROT_H__ 1 | ||
|
||
int therm_throt_process(int curr); | ||
|
||
#endif /* __ASM_I386_THERM_THROT_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <asm-i386/therm_throt.h> |