Commit d14c7e92 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] throttle P4 thermal warnings

From: Zwane Mwaikambo <zwane@linuxpower.ca>

In really bad conditions this can keep printing for a while, throttle the
output somewhat.  Also change the "CPU%d" formatting to better match the
other boot output.
parent b4ad84fc
...@@ -38,7 +38,8 @@ static int mce_num_extended_msrs = 0; ...@@ -38,7 +38,8 @@ static int mce_num_extended_msrs = 0;
#ifdef CONFIG_X86_MCE_P4THERMAL #ifdef CONFIG_X86_MCE_P4THERMAL
static void unexpected_thermal_interrupt(struct pt_regs *regs) static void unexpected_thermal_interrupt(struct pt_regs *regs)
{ {
printk(KERN_ERR "CPU#%d: Unexpected LVT TMR interrupt!\n", smp_processor_id()); printk(KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n",
smp_processor_id());
} }
/* P4/Xeon Thermal transition interrupt handler */ /* P4/Xeon Thermal transition interrupt handler */
...@@ -46,15 +47,21 @@ static void intel_thermal_interrupt(struct pt_regs *regs) ...@@ -46,15 +47,21 @@ static void intel_thermal_interrupt(struct pt_regs *regs)
{ {
u32 l, h; u32 l, h;
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
static unsigned long next[NR_CPUS];
ack_APIC_irq(); ack_APIC_irq();
rdmsr (MSR_IA32_THERM_STATUS, l, h); if (time_after(next[cpu], jiffies))
if (l & 1) { return;
printk(KERN_EMERG "CPU#%d: Temperature above threshold\n", cpu);
printk(KERN_EMERG "CPU#%d: Running in modulated clock mode\n", cpu); next[cpu] = jiffies + HZ*5;
rdmsr(MSR_IA32_THERM_STATUS, l, h);
if (l & 0x1) {
printk(KERN_EMERG "CPU%d: Temperature above threshold\n", cpu);
printk(KERN_EMERG "CPU%d: Running in modulated clock mode\n",
cpu);
} else { } else {
printk(KERN_INFO "CPU#%d: Temperature/speed normal\n", cpu); printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu);
} }
} }
...@@ -89,13 +96,15 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c) ...@@ -89,13 +96,15 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c)
rdmsr (MSR_IA32_MISC_ENABLE, l, h); rdmsr (MSR_IA32_MISC_ENABLE, l, h);
h = apic_read(APIC_LVTTHMR); h = apic_read(APIC_LVTTHMR);
if ((l & (1<<3)) && (h & APIC_DM_SMI)) { if ((l & (1<<3)) && (h & APIC_DM_SMI)) {
printk(KERN_DEBUG "CPU#%d: Thermal monitoring handled by SMI\n", cpu); printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n",
cpu);
return; /* -EBUSY */ return; /* -EBUSY */
} }
/* check whether a vector already exists, temporarily masked? */ /* check whether a vector already exists, temporarily masked? */
if (h & APIC_VECTOR_MASK) { if (h & APIC_VECTOR_MASK) {
printk(KERN_DEBUG "CPU#%d: Thermal LVT vector (%#x) already installed\n", printk(KERN_DEBUG "CPU%d: Thermal LVT vector (%#x) already "
"installed\n",
cpu, (h & APIC_VECTOR_MASK)); cpu, (h & APIC_VECTOR_MASK));
return; /* -EBUSY */ return; /* -EBUSY */
} }
...@@ -116,7 +125,7 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c) ...@@ -116,7 +125,7 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c)
l = apic_read (APIC_LVTTHMR); l = apic_read (APIC_LVTTHMR);
apic_write_around (APIC_LVTTHMR, l & ~APIC_LVT_MASKED); apic_write_around (APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
printk (KERN_INFO "CPU#%d: Thermal monitoring enabled\n", cpu); printk (KERN_INFO "CPU%d: Thermal monitoring enabled\n", cpu);
return; return;
} }
#endif /* CONFIG_X86_MCE_P4THERMAL */ #endif /* CONFIG_X86_MCE_P4THERMAL */
...@@ -247,7 +256,8 @@ void __init intel_p4_mcheck_init(struct cpuinfo_x86 *c) ...@@ -247,7 +256,8 @@ void __init intel_p4_mcheck_init(struct cpuinfo_x86 *c)
rdmsr (MSR_IA32_MCG_CAP, l, h); rdmsr (MSR_IA32_MCG_CAP, l, h);
if (l & (1<<9)) {/* MCG_EXT_P */ if (l & (1<<9)) {/* MCG_EXT_P */
mce_num_extended_msrs = (l >> 16) & 0xff; mce_num_extended_msrs = (l >> 16) & 0xff;
printk (KERN_INFO "CPU#%d: Intel P4/Xeon Extended MCE MSRs (%d) available\n", printk (KERN_INFO "CPU%d: Intel P4/Xeon Extended MCE MSRs (%d)"
" available\n",
smp_processor_id(), mce_num_extended_msrs); smp_processor_id(), mce_num_extended_msrs);
#ifdef CONFIG_X86_MCE_P4THERMAL #ifdef CONFIG_X86_MCE_P4THERMAL
......
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