From: Hugh Dickins <hugh@veritas.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Dmitry Adamushko <dmitry.adamushko@gmail.com>,
Peter Oruba <peter.oruba@amd.com>,
Arjan van de Ven <arjan@infradead.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] x86 microcode: revert some work_on_cpu
Date: Tue, 14 Apr 2009 19:25:42 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0904141919350.3124@blonde.anvils> (raw)
Revert part of af5c820a3169e81af869c113e18ec7588836cd50
x86: cpumask: use work_on_cpu in arch/x86/kernel/microcode_core.c
That change is causing only one Intel CPU's microcode to be updated e.g.
microcode: CPU3 updated from revision 0x9 to 0x17, date = 2005-04-22
where before it announced that also for CPU0 and CPU1 and CPU2.
We cannot use work_on_cpu() in the CONFIG_MICROCODE_OLD_INTERFACE code,
because Intel's request_microcode_user() involves a copy_from_user() from
/sbin/microcode_ctl, which therefore needs to be on that CPU at the time.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
This may be not the only problem with that commit: I've seen lockdep
warnings from s2ram when suspending; but I think there have been other
work_on_cpu() lockdep issues, and you may already be on to them?
arch/x86/kernel/microcode_core.c | 33 +++++++++--------------------
1 file changed, 11 insertions(+), 22 deletions(-)
--- 2.6.30-rc1/arch/x86/kernel/microcode_core.c 2009-04-08 18:19:28.000000000 +0100
+++ linux/arch/x86/kernel/microcode_core.c 2009-04-12 23:06:57.000000000 +0100
@@ -108,40 +108,29 @@ struct ucode_cpu_info ucode_cpu_info[NR
EXPORT_SYMBOL_GPL(ucode_cpu_info);
#ifdef CONFIG_MICROCODE_OLD_INTERFACE
-struct update_for_cpu {
- const void __user *buf;
- size_t size;
-};
-
-static long update_for_cpu(void *_ufc)
-{
- struct update_for_cpu *ufc = _ufc;
- int error;
-
- error = microcode_ops->request_microcode_user(smp_processor_id(),
- ufc->buf, ufc->size);
- if (error < 0)
- return error;
- if (!error)
- microcode_ops->apply_microcode(smp_processor_id());
- return error;
-}
-
static int do_microcode_update(const void __user *buf, size_t size)
{
+ cpumask_t old;
int error = 0;
int cpu;
- struct update_for_cpu ufc = { .buf = buf, .size = size };
+
+ old = current->cpus_allowed;
for_each_online_cpu(cpu) {
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
if (!uci->valid)
continue;
- error = work_on_cpu(cpu, update_for_cpu, &ufc);
+
+ set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
+ error = microcode_ops->request_microcode_user(cpu, buf, size);
if (error < 0)
- break;
+ goto out;
+ if (!error)
+ microcode_ops->apply_microcode(cpu);
}
+out:
+ set_cpus_allowed_ptr(current, &old);
return error;
}
next reply other threads:[~2009-04-14 18:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-14 18:25 Hugh Dickins [this message]
2009-04-15 4:44 ` Rusty Russell
2009-04-15 10:12 ` Dmitry Adamushko
2009-04-17 21:28 Dmitry Adamushko
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=Pine.LNX.4.64.0904141919350.3124@blonde.anvils \
--to=hugh@veritas.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=dmitry.adamushko@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peter.oruba@amd.com \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®