* sleeping function called from invalid context at kernel/mutex.c
@ 2008-09-30 17:00 Sitsofe Wheeler
[not found] ` <20081001071004.GA9366@elte.hu>
0 siblings, 1 reply; 4+ messages in thread
From: Sitsofe Wheeler @ 2008-09-30 17:00 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton
This turned up in a linux-tip from yesterday after resuming from a
suspend on an EeePC 900:
[ 1176.720189] ACPI: Preparing to enter system sleep state S3
[ 1176.745011] Intel machine check architecture supported.
[ 1176.745011] Intel machine check reporting enabled on CPU#0.
[ 1176.745011] Back to C!
[ 1176.745011] BUG: sleeping function called from invalid context at
kernel/mutex.c:207
[ 1176.745011] in_atomic(): 0, irqs_disabled(): 1, pid: 4513, name:
pm-suspend
[ 1176.745011] 3 locks held by pm-suspend/4513:
[ 1176.745011] #0: (&buffer->mutex){--..}, at: [<c01b89c0>]
sysfs_write_file+0x30/0x100
[ 1176.745011] #1: (pm_mutex){--..}, at: [<c014ef5a>]
enter_state+0x4a/0x140
[ 1176.745011] #2: (dpm_list_mtx){--..}, at: [<c029c254>]
device_pm_lock+0x14/0x20
[ 1176.745011] irq event stamp: 28504
[ 1176.745011] hardirqs last enabled at (28503): [<c014a92b>]
trace_hardirqs_on+0xb/0x10
[ 1176.745011] hardirqs last disabled at (28504): [<c014593b>]
trace_hardirqs_off+0xb/0x10
[ 1176.745011] softirqs last enabled at (27690): [<c012bd53>]
__do_softirq+0xa3/0xc0
[ 1176.745011] softirqs last disabled at (27685): [<c012bdc5>]
do_softirq+0x55/0x60
[ 1176.745011] Pid: 4513, comm: pm-suspend Not tainted
2.6.27-rc7-tipskw-00976-g30d1868-dirty #25
[ 1176.745011] [<c012bdc5>] ? do_softirq+0x55/0x60
[ 1176.745011] [<c011fe74>] __might_sleep+0xe4/0x110
[ 1176.745011] [<c03cfd44>] mutex_lock_nested+0x24/0x50
[ 1176.745011] [<c0116772>] microcode_update_cpu+0x22/0xf0
[ 1176.745011] [<c014593b>] ? trace_hardirqs_off+0xb/0x10
[ 1176.745011] [<c03d178c>] ? _spin_unlock_irqrestore+0x3c/0x60
[ 1176.745011] [<c0116855>] mc_sysdev_resume+0x15/0x20
[ 1176.745011] [<c029754b>] __sysdev_resume+0x3b/0x50
[ 1176.745011] [<c0297997>] sysdev_resume+0x57/0x90
[ 1176.745011] [<c029cf00>] device_power_up+0x10/0x20
[ 1176.745011] [<c014ee8f>] suspend_devices_and_enter+0x11f/0x140
[ 1176.745011] [<c014efbb>] enter_state+0xab/0x140
[ 1176.745011] [<c014f0f4>] state_store+0xa4/0xe0
[ 1176.745011] [<c014f050>] ? state_store+0x0/0xe0
[ 1176.745011] [<c0205934>] kobj_attr_store+0x24/0x30
[ 1176.745011] [<c01b8a37>] sysfs_write_file+0xa7/0x100
[ 1176.745011] [<c017b4da>] vfs_write+0x9a/0x120
[ 1176.745011] [<c01b8990>] ? sysfs_write_file+0x0/0x100
[ 1176.745011] [<c017b622>] sys_write+0x42/0x70
[ 1176.745011] [<c010334d>] sysenter_do_call+0x12/0x35
[ 1176.745011] =======================
[ 1176.745011] Force enabled HPET at resume
[ 1176.748667] ACPI: Waking up from system sleep state S3
[ 1176.801657] ACPI: EC: non-query interrupt received, switching to
interrupt mode
--
Sitsofe | http://sucs.org/~sits/
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <20081001071004.GA9366@elte.hu>]
[parent not found: <b647ffbd0810020029v1fd59d85u8d8048aebe3e4d55@mail.gmail.com>]
[parent not found: <48E4882E.5000100@amd.com>]
[parent not found: <20081002085529.GB3550@elte.hu>]
[parent not found: <b647ffbd0810020656l48eba7bdt8cd8e4cd47a8a95b@mail.gmail.com>]
* Re: sleeping function called from invalid context at kernel/mutex.c [not found] ` <b647ffbd0810020656l48eba7bdt8cd8e4cd47a8a95b@mail.gmail.com> @ 2008-10-02 13:59 ` Dmitry Adamushko 2008-10-02 14:01 ` Dmitry Adamushko 0 siblings, 1 reply; 4+ messages in thread From: Dmitry Adamushko @ 2008-10-02 13:59 UTC (permalink / raw) To: Ingo Molnar Cc: Peter Oruba, Sitsofe Wheeler, Rafael J. Wysocki, Andrew Morton, linux-kernel [ cc'd: lkml ] On 02/10/2008, Dmitry Adamushko <dmitry.adamushko@gmail.com> wrote: > On 02/10/2008, Ingo Molnar <mingo@elte.hu> wrote: > > > > * Peter Oruba <peter.oruba@amd.com> wrote: > > > > > microcode_update_cpu() is still there, being called from > > > microcode_init_cpu() and mc_sysdev_resume(). > > > > > > ah, microcode_update_cpu, not update_microcode_cpu. So yes, the problem > > is still there with the latest code. > Right, I've been looking at the wrong tree. Please find the fix enclosed. Compiles ok, shouldn't break anything else. > > Ingo > -- Best regards, Dmitry Adamushko ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sleeping function called from invalid context at kernel/mutex.c 2008-10-02 13:59 ` Dmitry Adamushko @ 2008-10-02 14:01 ` Dmitry Adamushko 2008-10-02 15:52 ` Ingo Molnar 0 siblings, 1 reply; 4+ messages in thread From: Dmitry Adamushko @ 2008-10-02 14:01 UTC (permalink / raw) To: Ingo Molnar Cc: Peter Oruba, Sitsofe Wheeler, Rafael J. Wysocki, Andrew Morton, linux-kernel [-- Attachment #1: Type: text/plain, Size: 782 bytes --] err... I appologize for spamming. I've forgot to attach the fix. > > > On 02/10/2008, Dmitry Adamushko <dmitry.adamushko@gmail.com> wrote: > > On 02/10/2008, Ingo Molnar <mingo@elte.hu> wrote: > > > > > > * Peter Oruba <peter.oruba@amd.com> wrote: > > > > > > > microcode_update_cpu() is still there, being called from > > > > microcode_init_cpu() and mc_sysdev_resume(). > > > > > > > > > ah, microcode_update_cpu, not update_microcode_cpu. So yes, the problem > > > is still there with the latest code. > > > > Right, I've been looking at the wrong tree. Please find the fix > enclosed. Compiles ok, shouldn't break anything else. > > > > > Ingo > > > > > > -- > Best regards, > Dmitry Adamushko > -- Best regards, Dmitry Adamushko [-- Attachment #2: ucode-fix.patch --] [-- Type: application/octet-stream, Size: 1520 bytes --] Subject: x86-microcode: update locking scheme Fix the following "sleeping function called from invalid context" warning: ... __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> diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index 8db2eb5..936d8d5 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(µcode_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, µcode_pdev->dev); } - if (!err) microcode_ops->apply_microcode(cpu); - - mutex_unlock(µcode_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(µcode_mutex); microcode_update_cpu(cpu); + mutex_unlock(µcode_mutex); + set_cpus_allowed_ptr(current, &old); } ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: sleeping function called from invalid context at kernel/mutex.c 2008-10-02 14:01 ` Dmitry Adamushko @ 2008-10-02 15:52 ` Ingo Molnar 0 siblings, 0 replies; 4+ messages in thread From: Ingo Molnar @ 2008-10-02 15:52 UTC (permalink / raw) To: Dmitry Adamushko Cc: Peter Oruba, Sitsofe Wheeler, Rafael J. Wysocki, Andrew Morton, linux-kernel * Dmitry Adamushko <dmitry.adamushko@gmail.com> wrote: > > Right, I've been looking at the wrong tree. Please find the fix > > enclosed. Compiles ok, shouldn't break anything else. applied to tip/x86/microcode, thanks Dmitry! Ingo ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-02 15:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-30 17:00 sleeping function called from invalid context at kernel/mutex.c Sitsofe Wheeler
[not found] ` <20081001071004.GA9366@elte.hu>
[not found] ` <b647ffbd0810020029v1fd59d85u8d8048aebe3e4d55@mail.gmail.com>
[not found] ` <48E4882E.5000100@amd.com>
[not found] ` <20081002085529.GB3550@elte.hu>
[not found] ` <b647ffbd0810020656l48eba7bdt8cd8e4cd47a8a95b@mail.gmail.com>
2008-10-02 13:59 ` Dmitry Adamushko
2008-10-02 14:01 ` Dmitry Adamushko
2008-10-02 15:52 ` Ingo Molnar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox