* [PATCH] x86, ucode-amd: Ensure ucode update on suspend/resume after CPU off/online cycle
@ 2009-11-11 19:03 Andreas Herrmann
2009-11-11 19:09 ` [tip:x86/microcode] " tip-bot for Andreas Herrmann
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Herrmann @ 2009-11-11 19:03 UTC (permalink / raw)
To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner; +Cc: linux-kernel, dimm
When switching a CPU offline/online and then doing suspend/resume,
ucode is not updated on this CPU.
This is due to the microcode_fini_cpu() call which frees uci->mc
when setting the CPU offline:
static void microcode_fini_cpu_amd(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
vfree(uci->mc);
uci->mc = NULL;
}
When the CPU is set online uci->mc is still NULL because no ucode
update is required.
Finally this prevents ucode update when resuming after suspend:
static enum ucode_state microcode_resume_cpu(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
if (!uci->mc)
return UCODE_NFOUND;
...
}
Fix is to check whether uci->mc is valid before microcode_resume_cpu()
is called.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
arch/x86/kernel/microcode_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 230fb09..e68aae3 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -391,7 +391,7 @@ static enum ucode_state microcode_update_cpu(int cpu)
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
enum ucode_state ustate;
- if (uci->valid)
+ if (uci->valid && uci->mc)
ustate = microcode_resume_cpu(cpu);
else
ustate = microcode_init_cpu(cpu);
--
1.6.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:x86/microcode] x86, ucode-amd: Ensure ucode update on suspend/resume after CPU off/online cycle
2009-11-11 19:03 [PATCH] x86, ucode-amd: Ensure ucode update on suspend/resume after CPU off/online cycle Andreas Herrmann
@ 2009-11-11 19:09 ` tip-bot for Andreas Herrmann
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Andreas Herrmann @ 2009-11-11 19:09 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, andreas.herrmann3, dmitry.adamushko,
herrmann.der.user, tglx, mingo
Commit-ID: 9f15226e75583547aaf542c6be4bdac1060dd425
Gitweb: http://git.kernel.org/tip/9f15226e75583547aaf542c6be4bdac1060dd425
Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
AuthorDate: Wed, 11 Nov 2009 20:03:29 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 11 Nov 2009 20:06:54 +0100
x86, ucode-amd: Ensure ucode update on suspend/resume after CPU off/online cycle
When switching a CPU offline/online and then doing
suspend/resume, ucode is not updated on this CPU.
This is due to the microcode_fini_cpu() call which frees uci->mc
when setting the CPU offline:
static void microcode_fini_cpu_amd(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
vfree(uci->mc);
uci->mc = NULL;
}
When the CPU is set online uci->mc is still NULL because no
ucode update is required.
Finally this prevents ucode update when resuming after suspend:
static enum ucode_state microcode_resume_cpu(int cpu)
{
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
if (!uci->mc)
return UCODE_NFOUND;
...
}
Fix is to check whether uci->mc is valid before
microcode_resume_cpu() is called.
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: dimm <dmitry.adamushko@gmail.com>
LKML-Reference: <20091111190329.GF18592@alberich.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/microcode_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index d2a8160..adf2340 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -393,7 +393,7 @@ static enum ucode_state microcode_update_cpu(int cpu)
struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
enum ucode_state ustate;
- if (uci->valid)
+ if (uci->valid && uci->mc)
ustate = microcode_resume_cpu(cpu);
else
ustate = microcode_init_cpu(cpu);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-11 19:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 19:03 [PATCH] x86, ucode-amd: Ensure ucode update on suspend/resume after CPU off/online cycle Andreas Herrmann
2009-11-11 19:09 ` [tip:x86/microcode] " tip-bot for Andreas Herrmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox