From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Jiang Liu <jiang.liu@linux.intel.com>,
Joerg Roedel <joro@8bytes.org>,
x86@kernel.org, Tony Luck <tony.luck@intel.com>,
Borislav Petkov <bp@alien8.de>
Subject: [patch 21/23] x86/smpboot: Sanitize uniprocessor init
Date: Thu, 15 Jan 2015 21:22:42 -0000 [thread overview]
Message-ID: <20150115211703.987833932@linutronix.de> (raw)
In-Reply-To: 20150115210458.625399149@linutronix.de
[-- Attachment #1: x86-smpboot-sanitize-apic-setup.patch --]
[-- Type: text/plain, Size: 2486 bytes --]
The UP related setups for local apic are mangled into smp_sanity_check().
That results in duplicate calls to disable_smp() and makes the code
hard to follow. Let smp_sanity_check() return dedicated values for the
various exit reasons and handle them at the call site.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/smpboot.c | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
Index: tip/arch/x86/kernel/smpboot.c
===================================================================
--- tip.orig/arch/x86/kernel/smpboot.c
+++ tip/arch/x86/kernel/smpboot.c
@@ -990,6 +990,8 @@ void arch_disable_smp_support(void)
*/
static __init void disable_smp(void)
{
+ pr_info("SMP disabled\n");
+
disable_ioapic_support();
init_cpu_present(cpumask_of(0));
@@ -1003,6 +1005,13 @@ static __init void disable_smp(void)
cpumask_set_cpu(0, cpu_core_mask(0));
}
+enum {
+ SMP_OK,
+ SMP_NO_CONFIG,
+ SMP_NO_APIC,
+ SMP_FORCE_UP,
+};
+
/*
* Various sanity checks.
*/
@@ -1050,10 +1059,7 @@ static int __init smp_sanity_check(unsig
if (!smp_found_config && !acpi_lapic) {
preempt_enable();
pr_notice("SMP motherboard not detected\n");
- disable_smp();
- if (APIC_init_uniprocessor())
- pr_notice("Local APIC not detected. Using dummy APIC emulation.\n");
- return -1;
+ return SMP_NO_CONFIG;
}
/*
@@ -1077,7 +1083,7 @@ static int __init smp_sanity_check(unsig
boot_cpu_physical_apicid);
pr_err("... forcing use of dummy APIC emulation (tell your hw vendor)\n");
}
- return -1;
+ return SMP_NO_APIC;
}
verify_local_APIC();
@@ -1087,12 +1093,10 @@ static int __init smp_sanity_check(unsig
*/
if (!max_cpus) {
pr_info("SMP mode deactivated\n");
- disable_ioapic_support();
- apic_bsp_setup();
- return -1;
+ return SMP_FORCE_UP;
}
- return 0;
+ return SMP_OK;
}
static void __init smp_cpu_index_default(void)
@@ -1132,10 +1136,21 @@ void __init native_smp_prepare_cpus(unsi
}
set_cpu_sibling_map(0);
- if (smp_sanity_check(max_cpus) < 0) {
- pr_info("SMP disabled\n");
+ switch (smp_sanity_check(max_cpus)) {
+ case SMP_NO_CONFIG:
disable_smp();
+ if (APIC_init_uniprocessor())
+ pr_notice("Local APIC not detected. Using dummy APIC emulation.\n");
+ return;
+ case SMP_NO_APIC:
+ disable_smp();
+ return;
+ case SMP_FORCE_UP:
+ disable_smp();
+ apic_bsp_setup();
return;
+ case SMP_OK:
+ break;
}
default_setup_apic_routing();
next prev parent reply other threads:[~2015-01-15 21:23 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-15 21:22 [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code Thomas Gleixner
2015-01-15 21:22 ` [patch 01/23] x86/apic: Avoid open coded x2apic detection Thomas Gleixner
2015-01-16 9:59 ` Borislav Petkov
2015-01-22 11:39 ` Thomas Gleixner
2015-01-23 16:13 ` Thomas Gleixner
2015-01-22 14:24 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 02/23] x86/apic: Make x2apic_mode depend on CONFIG_X86_X2APIC Thomas Gleixner
2015-01-16 10:50 ` Borislav Petkov
2015-01-22 14:24 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 03/23] x86/apic: Move x2apic code to one place Thomas Gleixner
2015-01-16 10:55 ` Borislav Petkov
2015-01-22 14:25 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 04/23] x86/ioapic: Check x2apic really Thomas Gleixner
2015-01-16 11:10 ` Borislav Petkov
2015-01-16 11:15 ` Borislav Petkov
2015-01-22 14:25 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 05/23] x86/apic: Make disable x2apic work really Thomas Gleixner
2015-01-16 11:17 ` Borislav Petkov
2015-01-22 14:25 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 06/23] x86/apic: Check x2apic early Thomas Gleixner
2015-01-16 8:07 ` Jiang Liu
2015-01-22 14:26 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 07/23] x86/x2apic: Move code in conditional region Thomas Gleixner
2015-01-16 11:56 ` Borislav Petkov
2015-01-22 14:26 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 08/23] x86/x2apic: Clarify remapping mode for x2apic enablement Thomas Gleixner
2015-01-16 14:19 ` Borislav Petkov
2015-01-22 14:26 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 09/23] x86/x2apic: Add proper state tracking Thomas Gleixner
2015-01-16 18:58 ` Borislav Petkov
2015-01-22 14:27 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 10/23] x86/x2apic: Disable x2apic from nox2apic setup Thomas Gleixner
2015-01-16 19:01 ` Borislav Petkov
2015-01-22 14:27 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 11/23] x86/x2apic: Split enable and setup function Thomas Gleixner
2015-01-16 19:00 ` Borislav Petkov
2015-01-22 13:08 ` Thomas Gleixner
2015-01-22 14:28 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 12/23] x86/x2apic: Use state information for disable Thomas Gleixner
2015-01-16 19:01 ` Borislav Petkov
2015-01-22 14:28 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 13/23] x86/smpboot: Move smpboot inlines to code Thomas Gleixner
2015-01-16 19:01 ` Borislav Petkov
2015-01-22 14:28 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 14/23] x86/ioapic: Provide stub functions for IOAPIC=n Thomas Gleixner
2015-01-16 19:02 ` Borislav Petkov
2015-01-22 14:29 ` [tip:x86/apic] x86/ioapic: Provide stub functions for IOAPIC%3Dn tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 15/23] x86/ioapic: Add proper checks to setp/enable_IO_APIC() Thomas Gleixner
2015-01-16 19:02 ` Borislav Petkov
2015-01-22 14:29 ` [tip:x86/apic] x86/ioapic: Add proper checks to setp/ enable_IO_APIC() tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 16/23] x86/apic: Sanitize ioapic handling Thomas Gleixner
2015-01-16 19:02 ` Borislav Petkov
2015-01-22 14:29 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 17/23] x86/smpboot: Cleanup " Thomas Gleixner
2015-01-16 19:03 ` Borislav Petkov
2015-01-22 14:30 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 18/23] x86/apic: Move apic_init_uniprocessor code Thomas Gleixner
2015-01-16 19:03 ` Borislav Petkov
2015-01-22 14:30 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 19/23] init: Get rid of x86isms Thomas Gleixner
2015-01-22 14:30 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 20/23] x86/smpboot: Move apic init code to apic.c Thomas Gleixner
2015-01-16 19:04 ` Borislav Petkov
2015-01-22 14:31 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` Thomas Gleixner [this message]
2015-01-16 19:04 ` [patch 21/23] x86/smpboot: Sanitize uniprocessor init Borislav Petkov
2015-01-22 14:31 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 22/23] x86/apic: Reuse apic_bsp_setup() for UP APIC setup Thomas Gleixner
2015-01-16 19:04 ` Borislav Petkov
2015-01-22 14:31 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-15 21:22 ` [patch 23/23] x86: Consolidate boot cpu timer setup Thomas Gleixner
2015-01-16 19:04 ` Borislav Petkov
2015-01-22 14:32 ` [tip:x86/apic] " tip-bot for Thomas Gleixner
2015-01-16 9:37 ` [patch 00/23] x86: Cleanup apic/ioapic/x2apic setup code Jiang Liu
2015-01-16 10:21 ` Thomas Gleixner
2015-01-16 10:35 ` Jiang Liu
2015-01-16 11:05 ` Thomas Gleixner
2015-01-16 19:03 ` Borislav Petkov
2015-01-21 1:50 ` Jiang Liu
2015-01-21 9:33 ` Thomas Gleixner
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=20150115211703.987833932@linutronix.de \
--to=tglx@linutronix.de \
--cc=bp@alien8.de \
--cc=jiang.liu@linux.intel.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).