public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: Ingo Molnar <mingo@elte.hu>, "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yinghai Lu <yinghai@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [RFC -tip] x86,apic -- reduce disable_apic usage
Date: Sun, 5 Jul 2009 20:20:44 +0400	[thread overview]
Message-ID: <20090705162044.GC4791@lenovo> (raw)

Here is an attempt to bring more consistency for apic
presence check. I hope I covered all the code flows.
Though it's RFC. Please review and test if possible.

	-- Cyrill
---
Instead of messing with (cpu_has_apic|disable_apic)
to check if we have apic functional, better to distinguish
them by logical kind. cpu_has_apic -- to check if we may
use apic functionality, disable_apic -- to note that
apic was disabled via command line.

Other interesting (and a side one) issue I guess is that
X86_FEATURE_APIC feature bit is always cleared if apic
disabled via command line but not the reverse.

Eventually this allow us to save a few lines of code.

Also:

1) No need to clear bit twice in APIC_init_uniprocessor.
   cpu_has_apic check for boot_cpu_data bit anyway.
2) Don't check for disable_apic in print_all_ICs. It's
   already set. Always.
3) Don't set disable_apic if there is no MPS support built in
   with acpi enabled. Even having SMP built kernel we're
   protected by acpi_lapic check in smp_sanity_check.
   At least we should be.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/apic/apic.c    |    3 +--
 arch/x86/kernel/apic/io_apic.c |    6 +++---
 arch/x86/kernel/setup.c        |    6 +-----
 3 files changed, 5 insertions(+), 10 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/apic/apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/apic.c
@@ -1173,7 +1173,7 @@ void __cpuinit setup_local_APIC(void)
 	unsigned int value;
 	int i, j;
 
-	if (disable_apic) {
+	if (!cpu_has_apic) {
 		arch_disable_smp_support();
 		return;
 	}
@@ -1651,7 +1651,6 @@ int __init APIC_init_uniprocessor(void)
 	    APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
 		pr_err("BIOS bug, local APIC 0x%x not detected!...\n",
 			boot_cpu_physical_apicid);
-		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
 		return -1;
 	}
 #endif
Index: linux-2.6.git/arch/x86/kernel/apic/io_apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/io_apic.c
@@ -1884,7 +1884,7 @@ __apicdebuginit(int) print_all_ICs(void)
 	print_PIC();
 
 	/* don't print out if apic is not there */
-	if (!cpu_has_apic || disable_apic)
+	if (!cpu_has_apic)
 		return 0;
 
 	print_all_local_APICs();
@@ -3261,7 +3261,7 @@ static int msi_compose_msg(struct pci_de
 	int err;
 	unsigned dest;
 
-	if (disable_apic)
+	if (!cpu_has_apic)
 		return -ENXIO;
 
 	cfg = irq_cfg(irq);
@@ -3714,7 +3714,7 @@ int arch_setup_ht_irq(unsigned int irq, 
 	struct irq_cfg *cfg;
 	int err;
 
-	if (disable_apic)
+	if (!cpu_has_apic)
 		return -ENXIO;
 
 	cfg = irq_cfg(irq);
Index: linux-2.6.git/arch/x86/kernel/setup.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/setup.c
+++ linux-2.6.git/arch/x86/kernel/setup.c
@@ -795,12 +795,8 @@ void __init setup_arch(char **cmdline_p)
 	/* after early param, so could get panic from serial */
 	reserve_early_setup_data();
 
-	if (acpi_mps_check()) {
-#ifdef CONFIG_X86_LOCAL_APIC
-		disable_apic = 1;
-#endif
+	if (acpi_mps_check())
 		setup_clear_cpu_cap(X86_FEATURE_APIC);
-	}
 
 #ifdef CONFIG_PCI
 	if (pci_early_dump_regs)

             reply	other threads:[~2009-07-05 16:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-05 16:20 Cyrill Gorcunov [this message]
2009-07-05 16:38 ` [RFC -tip] x86,apic -- reduce disable_apic usage Maciej W. Rozycki
2009-07-05 16:59   ` Cyrill Gorcunov
2009-07-05 17:12     ` Cyrill Gorcunov
2009-07-05 17:17       ` Cyrill Gorcunov
2009-07-05 17:47         ` Maciej W. Rozycki
2009-07-05 18:12           ` Cyrill Gorcunov
2009-07-05 17:30   ` H. Peter Anvin
2009-07-05 19:02     ` Cyrill Gorcunov
2009-07-05 19:18       ` H. Peter Anvin
2009-07-05 19:46         ` Cyrill Gorcunov
2009-07-07 23:49     ` Maciej W. Rozycki
2009-07-08 14:44       ` Cyrill Gorcunov

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=20090705162044.GC4791@lenovo \
    --to=gorcunov@openvz.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=yinghai@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