1 From 838312be46f3abfbdc175f81c3e54a857994476d Mon Sep 17 00:00:00 2001
2 From: Jan Beulich <JBeulich@suse.com>
3 Date: Wed, 28 Sep 2011 16:44:54 +0100
4 Subject: apic, i386/bigsmp: Fix false warnings regarding logical APIC ID mismatches
6 From: Jan Beulich <JBeulich@suse.com>
8 commit 838312be46f3abfbdc175f81c3e54a857994476d upstream.
10 These warnings (generally one per CPU) are a result of
11 initializing x86_cpu_to_logical_apicid while apic_default is
12 still in use, but the check in setup_local_APIC() being done
13 when apic_bigsmp was already used as an override in
14 default_setup_apic_routing():
16 Overriding APIC driver with bigsmp
17 Enabling APIC mode: Physflat. Using 5 I/O APICs
18 ------------[ cut here ]------------
19 WARNING: at .../arch/x86/kernel/apic/apic.c:1239
21 CPU 1 irqstacks, hard=f1c9a000 soft=f1c9c000
22 Booting Node 0, Processors #1
23 smpboot cpu 1: start_ip = 9e000
25 ------------[ cut here ]------------
26 WARNING: at .../arch/x86/kernel/apic/apic.c:1239
27 setup_local_APIC+0x137/0x46b() Hardware name: ...
28 CPU1 logical APIC ID: 2 != 8
31 Fix this (for the time being, i.e. until
32 x86_32_early_logical_apicid() will get removed again, as Tejun
33 says ought to be possible) by overriding the previously stored
34 values at the point where the APIC driver gets overridden.
36 v2: Move this and the pre-existing override logic into
37 arch/x86/kernel/apic/bigsmp_32.c.
39 Signed-off-by: Jan Beulich <jbeulich@suse.com>
40 Acked-by: Tejun Heo <tj@kernel.org>
41 Link: http://lkml.kernel.org/r/4E835D16020000780005844C@nat28.tlf.novell.com
42 Signed-off-by: Ingo Molnar <mingo@elte.hu>
43 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
46 arch/x86/include/asm/apic.h | 2 +-
47 arch/x86/kernel/apic/bigsmp_32.c | 20 ++++++++++++++++----
48 arch/x86/kernel/apic/probe_32.c | 10 ++--------
49 3 files changed, 19 insertions(+), 13 deletions(-)
51 --- a/arch/x86/include/asm/apic.h
52 +++ b/arch/x86/include/asm/apic.h
53 @@ -495,7 +495,7 @@ static inline void default_wait_for_init
57 -extern struct apic *generic_bigsmp_probe(void);
58 +extern void generic_bigsmp_probe(void);
61 #ifdef CONFIG_X86_LOCAL_APIC
62 --- a/arch/x86/kernel/apic/bigsmp_32.c
63 +++ b/arch/x86/kernel/apic/bigsmp_32.c
64 @@ -255,12 +255,24 @@ static struct apic apic_bigsmp = {
65 .x86_32_early_logical_apicid = bigsmp_early_logical_apicid,
68 -struct apic * __init generic_bigsmp_probe(void)
69 +void __init generic_bigsmp_probe(void)
72 - return &apic_bigsmp;
76 + if (!probe_bigsmp())
79 + apic = &apic_bigsmp;
81 + for_each_possible_cpu(cpu) {
82 + if (early_per_cpu(x86_cpu_to_logical_apicid,
85 + early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
86 + bigsmp_early_logical_apicid(cpu);
89 + pr_info("Overriding APIC driver with %s\n", apic_bigsmp.name);
92 apic_driver(apic_bigsmp);
93 --- a/arch/x86/kernel/apic/probe_32.c
94 +++ b/arch/x86/kernel/apic/probe_32.c
95 @@ -200,14 +200,8 @@ void __init default_setup_apic_routing(v
96 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
99 - if (!cmdline_apic && apic == &apic_default) {
100 - struct apic *bigsmp = generic_bigsmp_probe();
103 - printk(KERN_INFO "Overriding APIC driver with %s\n",
107 + if (!cmdline_apic && apic == &apic_default)
108 + generic_bigsmp_probe();
111 if (apic->setup_apic_routing)