2 * linux/arch/i386/kerne/cpu/mcheck/therm_throt.c
4 * Thermal throttle event support code.
6 * Author: Dmitriy Zavin (dmitriyz@google.com)
8 * Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c.
12 #include <linux/percpu.h>
13 #include <linux/cpu.h>
15 #include <linux/notifier.h>
16 #include <asm/therm_throt.h>
18 /* How long to wait between reporting thermal events */
19 #define CHECK_INTERVAL (300 * HZ)
21 static DEFINE_PER_CPU(__u64
, next_check
);
24 * therm_throt_process - Process thermal throttling event
25 * @curr: Whether the condition is current or not (boolean), since the
26 * thermal interrupt normally gets called both when the thermal
27 * event begins and once the event has ended.
29 * This function is normally called by the thermal interrupt after the
30 * IRQ has been acknowledged.
32 * It will take care of rate limiting and printing messages to the syslog.
34 * Returns: 0 : Event should NOT be further logged, i.e. still in
35 * "timeout" from previous log message.
36 * 1 : Event should be logged further, and a message has been
37 * printed to the syslog.
39 int therm_throt_process(int curr
)
41 unsigned int cpu
= smp_processor_id();
42 __u64 tmp_jiffs
= get_jiffies_64();
44 if (time_before64(tmp_jiffs
, __get_cpu_var(next_check
)))
47 __get_cpu_var(next_check
) = tmp_jiffs
+ CHECK_INTERVAL
;
49 /* if we just entered the thermal event */
51 printk(KERN_CRIT
"CPU%d: Temperature above threshold, "
52 "cpu clock throttled\n", cpu
);
53 add_taint(TAINT_MACHINE_CHECK
);
55 printk(KERN_CRIT
"CPU%d: Temperature/speed normal\n", cpu
);
This page took 0.034703 seconds and 5 git commands to generate.