summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-03-21 20:32:02 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-04-02 12:56:36 +0200
commit432acb219af4edecdd11d360f30b7cc643524db8 (patch)
tree14fb851f86d0c71690ef3f13666c6a4b9a7bf707
parentcpufreq: intel_pstate: Simplify spinlock locking (diff)
downloadlinux-432acb219af4edecdd11d360f30b7cc643524db8.tar.xz
linux-432acb219af4edecdd11d360f30b7cc643524db8.zip
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 <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/intel_pstate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index c0abf77c56ba..b702430dac29 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1682,6 +1682,8 @@ ack_intr:
static void intel_pstate_disable_hwp_interrupt(struct cpudata *cpudata)
{
+ bool cancel_work;
+
if (!boot_cpu_has(X86_FEATURE_HWP_NOTIFY))
return;
@@ -1689,9 +1691,11 @@ static void intel_pstate_disable_hwp_interrupt(struct cpudata *cpudata)
wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00);
spin_lock_irq(&hwp_notify_lock);
- if (cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask))
- cancel_delayed_work(&cpudata->hwp_notify_work);
+ cancel_work = cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask);
spin_unlock_irq(&hwp_notify_lock);
+
+ if (cancel_work)
+ cancel_delayed_work_sync(&cpudata->hwp_notify_work);
}
static void intel_pstate_enable_hwp_interrupt(struct cpudata *cpudata)