mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Peter Oruba" <peter.oruba@amd.com>,
	"Sitsofe Wheeler" <sitsofe@yahoo.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: sleeping function called from invalid context at kernel/mutex.c
Date: Thu, 2 Oct 2008 17:01:22 +0300	[thread overview]
Message-ID: <b647ffbd0810020701l60ee69fx9360baa5a4b855e8@mail.gmail.com> (raw)
In-Reply-To: <b647ffbd0810020659j2e5d38c2v51847000de682492@mail.gmail.com>

[-- 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(&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);
 }
 

  reply	other threads:[~2008-10-02 14:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30 17:00 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 [this message]
2008-10-02 15:52               ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b647ffbd0810020701l60ee69fx9360baa5a4b855e8@mail.gmail.com \
    --to=dmitry.adamushko@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peter.oruba@amd.com \
    --cc=rjw@sisk.pl \
    --cc=sitsofe@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome