Skip to content

Commit 432acb2

Browse files
committed
cpufreq: intel_pstate: Wait for canceled delayed work to complete
Make intel_pstate_disable_hwp_interrupt() wait for canceled delayed work to complete to avoid leftover work items running when it returns which may be during driver unregistration and may confuse things going forward. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 12ebba4 commit 432acb2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,16 +1682,20 @@ void notify_hwp_interrupt(void)
16821682

16831683
static void intel_pstate_disable_hwp_interrupt(struct cpudata *cpudata)
16841684
{
1685+
bool cancel_work;
1686+
16851687
if (!boot_cpu_has(X86_FEATURE_HWP_NOTIFY))
16861688
return;
16871689

16881690
/* wrmsrl_on_cpu has to be outside spinlock as this can result in IPC */
16891691
wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00);
16901692

16911693
spin_lock_irq(&hwp_notify_lock);
1692-
if (cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask))
1693-
cancel_delayed_work(&cpudata->hwp_notify_work);
1694+
cancel_work = cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask);
16941695
spin_unlock_irq(&hwp_notify_lock);
1696+
1697+
if (cancel_work)
1698+
cancel_delayed_work_sync(&cpudata->hwp_notify_work);
16951699
}
16961700

16971701
static void intel_pstate_enable_hwp_interrupt(struct cpudata *cpudata)

0 commit comments

Comments
 (0)