Re: [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code

From: Thomas Gleixner
Date: Fri Jan 16 2015 - 06:05:48 EST


On Fri, 16 Jan 2015, Thomas Gleixner wrote:
> On Fri, 16 Jan 2015, Jiang Liu wrote:
> > 5) x86_32, UP, IO_APIC disabled
> > 5.1) boot: panic with following call stack:
> > do_ono_initcall()->APIC_init_uniprocessor()->setup_local_APIC().
> > I can't capture the full log message due to lack of serial console.
> > It seems we have trouble with:
> > early_initcall(APIC_init_uniprocessor);
>
> Hmm, worked here. Lemme find some other machine.

Found the issue, won't work. But I still want to remove that x86
nonsense from init. So we need to do it different.

Subject: init: Get rid of x86isms
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Wed, 14 Jan 2015 14:59:48 +0100

Provide a config option and make the UP smp_init() implementation
depend on it and confine this to x86.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
arch/x86/Kconfig | 4 ++++
arch/x86/kernel/apic/apic.c | 7 +++++++
include/linux/smp.h | 6 ++++++
init/main.c | 13 -------------
4 files changed, 17 insertions(+), 13 deletions(-)

Index: tip/arch/x86/Kconfig
===================================================================
--- tip.orig/arch/x86/Kconfig
+++ tip/arch/x86/Kconfig
@@ -855,6 +855,10 @@ config SCHED_MC

source "kernel/Kconfig.preempt"

+config UP_SMP_INIT
+ def_bool y
+ depends on X86_UP_APIC
+
config X86_UP_APIC
bool "Local APIC support on uniprocessors"
depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI
Index: tip/arch/x86/kernel/apic/apic.c
===================================================================
--- tip.orig/arch/x86/kernel/apic/apic.c
+++ tip/arch/x86/kernel/apic/apic.c
@@ -2265,6 +2265,13 @@ int __init APIC_init_uniprocessor(void)
return 0;
}

+#ifdef CONFIG_UP_SMP_INIT
+void smp_init(void)
+{
+ APIC_init_uniprocessor();
+}
+#endif
+
/*
* Power management
*/
Index: tip/include/linux/smp.h
===================================================================
--- tip.orig/include/linux/smp.h
+++ tip/include/linux/smp.h
@@ -151,6 +151,12 @@ smp_call_function_any(const struct cpuma
static inline void kick_all_cpus_sync(void) { }
static inline void wake_up_all_idle_cpus(void) { }

+#ifdef CONFIG_UP_SMP_INIT
+extern void __init smp_init(void);
+#else
+static inline void smp_init(void) { }
+#endif
+
#endif /* !SMP */

/*
Index: tip/init/main.c
===================================================================
--- tip.orig/init/main.c
+++ tip/init/main.c
@@ -87,10 +87,6 @@
#include <asm/sections.h>
#include <asm/cacheflush.h>

-#ifdef CONFIG_X86_LOCAL_APIC
-#include <asm/smp.h>
-#endif
-
static int kernel_init(void *);

extern void init_IRQ(void);
@@ -351,15 +347,6 @@ __setup("rdinit=", rdinit_setup);

#ifndef CONFIG_SMP
static const unsigned int setup_max_cpus = NR_CPUS;
-#ifdef CONFIG_X86_LOCAL_APIC
-static void __init smp_init(void)
-{
- APIC_init_uniprocessor();
-}
-#else
-#define smp_init() do { } while (0)
-#endif
-
static inline void setup_nr_cpu_ids(void) { }
static inline void smp_prepare_cpus(unsigned int maxcpus) { }
#endif



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/