]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
speedstep-smi: enable interrupts when waiting
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 12 Dec 2013 00:55:40 +0000 (19:55 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 6 Jan 2014 14:54:05 +0000 (15:54 +0100)
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>
drivers/cpufreq/speedstep-lib.c
drivers/cpufreq/speedstep-smi.c

index 7047821a7f8a5fd966521ba5a8d48bf7664d2d54..0b12ab9ae0e6d67e60a895a648389efae8b2d890 100644 (file)
@@ -464,6 +464,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor,
 
 out:
        local_irq_restore(flags);
+       preempt_check_resched();
        return ret;
 }
 EXPORT_SYMBOL_GPL(speedstep_get_freqs);
index 0f5326d6f79ffef866957b26acdd18bf866bd0a9..4d04770cf4f2a7ff8eabb1dfd2e9e47ce047ce02 100644 (file)
@@ -200,7 +200,19 @@ static void speedstep_set_state(unsigned int state)
                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__(
@@ -217,6 +229,7 @@ static void speedstep_set_state(unsigned int state)
 
        /* enable IRQs */
        local_irq_restore(flags);
+       preempt_check_resched();
 
        if (new_state == state)
                pr_debug("change to %u MHz succeeded after %u tries "