Skip to content

Commit 52ac377

Browse files
committed
Merge tag 'ras-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RAS fixes from Thomas Gleixner: "Two RAS related fixes: - Shut down the per CPU thermal throttling poll work properly when a CPU goes offline. The missing shutdown caused the poll work to be migrated to a unbound worker which triggered warnings about the usage of smp_processor_id() in preemptible context - Fix the PPIN feature initialization which missed to enable the functionality when PPIN_CTL was enabled but the MSR locked against updates" * tag 'ras-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mce: Fix logic and comments around MSR_PPIN_CTL x86/mce/therm_throt: Undo thermal polling properly on CPU offline
2 parents b67775e + 59b5809 commit 52ac377

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

arch/x86/kernel/cpu/mce/intel.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,18 @@ static void intel_ppin_init(struct cpuinfo_x86 *c)
493493
return;
494494

495495
if ((val & 3UL) == 1UL) {
496-
/* PPIN available but disabled: */
496+
/* PPIN locked in disabled mode */
497497
return;
498498
}
499499

500-
/* If PPIN is disabled, but not locked, try to enable: */
501-
if (!(val & 3UL)) {
500+
/* If PPIN is disabled, try to enable */
501+
if (!(val & 2UL)) {
502502
wrmsrl_safe(MSR_PPIN_CTL, val | 2UL);
503503
rdmsrl_safe(MSR_PPIN_CTL, &val);
504504
}
505505

506-
if ((val & 3UL) == 2UL)
506+
/* Is the enable bit set? */
507+
if (val & 2UL)
507508
set_cpu_cap(c, X86_FEATURE_INTEL_PPIN);
508509
}
509510
}

arch/x86/kernel/cpu/mce/therm_throt.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,14 @@ static int thermal_throttle_offline(unsigned int cpu)
486486
{
487487
struct thermal_state *state = &per_cpu(thermal_state, cpu);
488488
struct device *dev = get_cpu_device(cpu);
489+
u32 l;
490+
491+
/* Mask the thermal vector before draining evtl. pending work */
492+
l = apic_read(APIC_LVTTHMR);
493+
apic_write(APIC_LVTTHMR, l | APIC_LVT_MASKED);
489494

490-
cancel_delayed_work(&state->package_throttle.therm_work);
491-
cancel_delayed_work(&state->core_throttle.therm_work);
495+
cancel_delayed_work_sync(&state->package_throttle.therm_work);
496+
cancel_delayed_work_sync(&state->core_throttle.therm_work);
492497

493498
state->package_throttle.rate_control_active = false;
494499
state->core_throttle.rate_control_active = false;

0 commit comments

Comments
 (0)