aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Adamushko <dmitry.adamushko@gmail.com>2008-10-02 16:56:19 +0300
committerIngo Molnar <mingo@elte.hu>2008-10-02 17:52:33 +0200
commitfd1452ebf257317f24e0e285a17a2ec2ce3e6df7 (patch)
tree315d1024bb974e8c20f2d451aefa23562e6f2be7
parent82b078659ed04e1ecdebf8326e189cf76ed361af (diff)
x86/microcode: fix sleeping function called from invalid context at kernel/mutex.c
Fix the following "sleeping function called from invalid context" bug: ... __might_sleep mutex_lock_nested microcode_update_cpu mc_sysdev_resume __sysdev_resume sysdev_resume device_power_up ... Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/microcode_core.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 8db2eb55e9e..936d8d55f23 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -324,10 +324,6 @@ void microcode_update_cpu(int cpu)
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
int err = 0;
- /* We should bind the task to the CPU */
- BUG_ON(raw_smp_processor_id() != cpu);
-
- mutex_lock(&microcode_mutex);
/*
* Check if the system resume is in progress (uci->valid != NULL),
* otherwise just request a firmware:
@@ -340,11 +336,8 @@ void microcode_update_cpu(int cpu)
err = microcode_ops->request_microcode_fw(cpu,
&microcode_pdev->dev);
}
-
if (!err)
microcode_ops->apply_microcode(cpu);
-
- mutex_unlock(&microcode_mutex);
}
static void microcode_init_cpu(int cpu)
@@ -352,7 +345,13 @@ static void microcode_init_cpu(int cpu)
cpumask_t old = current->cpus_allowed;
set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
+ /* We should bind the task to the CPU */
+ BUG_ON(raw_smp_processor_id() != cpu);
+
+ mutex_lock(&microcode_mutex);
microcode_update_cpu(cpu);
+ mutex_unlock(&microcode_mutex);
+
set_cpus_allowed_ptr(current, &old);
}