Skip to content

Commit 12ebba4

Browse files
committed
cpufreq: intel_pstate: Simplify spinlock locking
Because intel_pstate_enable/disable_hwp_interrupt() are only called from thread context, they need not save the IRQ flags when using a spinlock as interrupts are guaranteed to be enabled when they run, so make them use spin_lock/unlock_irq(). Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent f186b2d commit 12ebba4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,30 +1682,26 @@ void notify_hwp_interrupt(void)
16821682

16831683
static void intel_pstate_disable_hwp_interrupt(struct cpudata *cpudata)
16841684
{
1685-
unsigned long flags;
1686-
16871685
if (!boot_cpu_has(X86_FEATURE_HWP_NOTIFY))
16881686
return;
16891687

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

1693-
spin_lock_irqsave(&hwp_notify_lock, flags);
1691+
spin_lock_irq(&hwp_notify_lock);
16941692
if (cpumask_test_and_clear_cpu(cpudata->cpu, &hwp_intr_enable_mask))
16951693
cancel_delayed_work(&cpudata->hwp_notify_work);
1696-
spin_unlock_irqrestore(&hwp_notify_lock, flags);
1694+
spin_unlock_irq(&hwp_notify_lock);
16971695
}
16981696

16991697
static void intel_pstate_enable_hwp_interrupt(struct cpudata *cpudata)
17001698
{
17011699
/* Enable HWP notification interrupt for guaranteed performance change */
17021700
if (boot_cpu_has(X86_FEATURE_HWP_NOTIFY)) {
1703-
unsigned long flags;
1704-
1705-
spin_lock_irqsave(&hwp_notify_lock, flags);
1701+
spin_lock_irq(&hwp_notify_lock);
17061702
INIT_DELAYED_WORK(&cpudata->hwp_notify_work, intel_pstate_notify_work);
17071703
cpumask_set_cpu(cpudata->cpu, &hwp_intr_enable_mask);
1708-
spin_unlock_irqrestore(&hwp_notify_lock, flags);
1704+
spin_unlock_irq(&hwp_notify_lock);
17091705

17101706
/* wrmsrl_on_cpu has to be outside spinlock as this can result in IPC */
17111707
wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x01);

0 commit comments

Comments
 (0)