On Dell Latitude C600 laptop with Pentium 3 850MHz processor, the
speedstep-smi driver sometimes loads and sometimes doesn't load with
"change to state X failed" message.
I found out that we need to enable interrupts while waiting. When we
enable interrupts, the blockage that prevents frequency transition
resolves and the transition is possible. With disabled interrupts, the
blockage doesn't resolve (no matter how long do we wait).
This patch enables interrupts in the function speedstep_set_state that can
be called with disabled interrupts. However, this function is called with
disabled interrupts only from speedstep_get_freqs, so it shouldn't cause
any problem.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
out:
local_irq_restore(flags);
+ preempt_check_resched();
return ret;
}
EXPORT_SYMBOL_GPL(speedstep_get_freqs);
if (retry) {
pr_debug("retry %u, previous result %u, waiting...\n",
retry, result);
+ /*
+ * We need to enable interrupts, otherwise the blockage
+ * won't resolve.
+ *
+ * We disable preemption so that other processes don't
+ * run. If other processes were running, they could
+ * submit more DMA requests, making the blockage worse.
+ */
+ preempt_disable();
+ local_irq_enable();
mdelay(retry * 50);
+ local_irq_disable();
+ preempt_enable_no_resched();
}
retry++;
__asm__ __volatile__(
/* enable IRQs */
local_irq_restore(flags);
+ preempt_check_resched();
if (new_state == state)
pr_debug("change to %u MHz succeeded after %u tries "