diff options
author | Borislav Petkov <bp@suse.de> | 2015-02-11 08:54:42 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2015-03-02 14:32:34 -0500 |
commit | a858b5e50442579a73112c7c79bf6096e96de535 (patch) | |
tree | d7bdac16619a432de06bc3b50a566a1d7f4b3651 | |
parent | 4f1f605cfe3046c4c9f07920c47d3f801d31c0ba (diff) |
x86/microcode/intel: Fix printing of microcode blobs in show_saved_mc()
When doing
echo 1 > /sys/devices/system/cpu/microcode/reload
in order to reload microcode, I get:
microcode: Total microcode saved: 1
BUG: using smp_processor_id() in preemptible [00000000] code: bash/2606
caller is debug_smp_processor_id+0x17/0x20
CPU: 1 PID: 2606 Comm: bash Not tainted 3.19.0-rc7+ #9
Hardware name: LENOVO 2320CTO/2320CTO, BIOS G2ET86WW (2.06 ) 11/13/2012
ffffffff81a4266d ffff8802131db808 ffffffff81666588 0000000000000007
0000000000000001 ffff8802131db838 ffffffff812e6eef ffff8802131db868
00000000000306a9 0000000000000010 0000000000000015 ffff8802131db848
Call Trace:
dump_stack
check_preemption_disabled
debug_smp_processor_id
show_saved_mc
? save_microcode.constprop.8
save_mc_for_early
? print_context_stack
? dump_trace
? __bfs
? mark_held_locks
? get_page_from_freelist
? trace_hardirqs_on_caller
? trace_hardirqs_on
? __alloc_pages_nodemask
? __get_vm_area_node
? map_vm_area
? __vmalloc_node_range
? generic_load_microcode
generic_load_microcode
? microcode_fini_cpu
request_microcode_fw
reload_store
dev_attr_store
sysfs_kf_write
kernfs_fop_write
vfs_write
? sysret_check
SyS_write
system_call_fastpath
microcode: CPU1: sig=0x306a9, pf=0x10, rev=0x15
microcode: mc_saved[0]: sig=0x306a9, pf=0x12, rev=0x1b, toal size=0x3000, date = 2014-05-29
because we're using smp_processor_id() in preemtible context. And we
don't really need to use it there because the microcode container we're
dumping is global and CPU-specific info is irrelevant.
While at it, make pr_* stuff use "microcode: " prefix for easier
grepping and document how to enable the DEBUG build.
Signed-off-by: Borislav Petkov <bp@suse.de>
-rw-r--r-- | arch/x86/kernel/cpu/microcode/intel_early.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c index 88a0348f455c..2f49ab4ac0ae 100644 --- a/arch/x86/kernel/cpu/microcode/intel_early.c +++ b/arch/x86/kernel/cpu/microcode/intel_early.c | |||
@@ -16,6 +16,14 @@ | |||
16 | * as published by the Free Software Foundation; either version | 16 | * as published by the Free Software Foundation; either version |
17 | * 2 of the License, or (at your option) any later version. | 17 | * 2 of the License, or (at your option) any later version. |
18 | */ | 18 | */ |
19 | |||
20 | /* | ||
21 | * This needs to be before all headers so that pr_debug in printk.h doesn't turn | ||
22 | * printk calls into no_printk(). | ||
23 | * | ||
24 | *#define DEBUG | ||
25 | */ | ||
26 | |||
19 | #include <linux/module.h> | 27 | #include <linux/module.h> |
20 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
21 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
@@ -28,6 +36,9 @@ | |||
28 | #include <asm/tlbflush.h> | 36 | #include <asm/tlbflush.h> |
29 | #include <asm/setup.h> | 37 | #include <asm/setup.h> |
30 | 38 | ||
39 | #undef pr_fmt | ||
40 | #define pr_fmt(fmt) "microcode: " fmt | ||
41 | |||
31 | static unsigned long mc_saved_in_initrd[MAX_UCODE_COUNT]; | 42 | static unsigned long mc_saved_in_initrd[MAX_UCODE_COUNT]; |
32 | static struct mc_saved_data { | 43 | static struct mc_saved_data { |
33 | unsigned int mc_saved_count; | 44 | unsigned int mc_saved_count; |
@@ -397,8 +408,7 @@ static void __ref show_saved_mc(void) | |||
397 | sig = uci.cpu_sig.sig; | 408 | sig = uci.cpu_sig.sig; |
398 | pf = uci.cpu_sig.pf; | 409 | pf = uci.cpu_sig.pf; |
399 | rev = uci.cpu_sig.rev; | 410 | rev = uci.cpu_sig.rev; |
400 | pr_debug("CPU%d: sig=0x%x, pf=0x%x, rev=0x%x\n", | 411 | pr_debug("CPU: sig=0x%x, pf=0x%x, rev=0x%x\n", sig, pf, rev); |
401 | smp_processor_id(), sig, pf, rev); | ||
402 | 412 | ||
403 | for (i = 0; i < mc_saved_data.mc_saved_count; i++) { | 413 | for (i = 0; i < mc_saved_data.mc_saved_count; i++) { |
404 | struct microcode_header_intel *mc_saved_header; | 414 | struct microcode_header_intel *mc_saved_header; |