Skip to content

Commit d364847

Browse files
KAGA-KOKOsuryasaimadhu
authored andcommitted
x86/mce/therm_throt: Undo thermal polling properly on CPU offline
Chris Wilson reported splats from running the thermal throttling workqueue callback on offlined CPUs. The problem is that that callback should not even run on offlined CPUs but it happens nevertheless because the offlining callback thermal_throttle_offline() does not symmetrically undo the setup work done in its onlining counterpart. IOW, 1. The thermal interrupt vector should be masked out before ... 2. ... cancelling any pending work synchronously so that no new work is enqueued anymore. Do those things and fix the issue properly. [ bp: Write commit message. ] Fixes: f665620 ("x86/mce/therm_throt: Optimize notifications of thermal throttle") Reported-by: Chris Wilson <[email protected]> Tested-by: Pandruvada, Srinivas <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/158120068234.18291.7938335950259651295@skylake-alporthouse-com
1 parent f8788d8 commit d364847

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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)