public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Yinghai Lu <yinghai@kernel.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	yinghai@kernel.org, tglx@linutronix.de, gorcunov@gmail.com,
	mingo@elte.hu
Subject: [tip:irq/numa] x86: don't call read_apic_id if !cpu_has_apic
Date: Mon, 18 May 2009 07:39:43 GMT	[thread overview]
Message-ID: <tip-2759c3287de27266e06f1f4e82cbd2d65f6a044c@git.kernel.org> (raw)
In-Reply-To: <4A09CCBB.2000306@kernel.org>

Commit-ID:  2759c3287de27266e06f1f4e82cbd2d65f6a044c
Gitweb:     http://git.kernel.org/tip/2759c3287de27266e06f1f4e82cbd2d65f6a044c
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Fri, 15 May 2009 13:05:16 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 18 May 2009 08:43:25 +0200

x86: don't call read_apic_id if !cpu_has_apic

should not call that if apic is disabled.

[ Impact: fix crash on certain UP configs ]

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
LKML-Reference: <4A09CCBB.2000306@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/kernel/apic/apic_flat_64.c |    2 +-
 arch/x86/kernel/cpu/amd.c           |    2 +-
 arch/x86/kernel/cpu/common.c        |    6 ++++++
 arch/x86/kernel/cpu/intel.c         |    6 +++---
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 744e6d8..d0c99ab 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -161,7 +161,7 @@ static int flat_apic_id_registered(void)
 
 static int flat_phys_pkg_id(int initial_apic_id, int index_msb)
 {
-	return hard_smp_processor_id() >> index_msb;
+	return initial_apic_id >> index_msb;
 }
 
 struct apic apic_flat =  {
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 7e4a459..728b375 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -272,7 +272,7 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
 #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
 	int cpu = smp_processor_id();
 	int node;
-	unsigned apicid = hard_smp_processor_id();
+	unsigned apicid = cpu_has_apic ? hard_smp_processor_id() : c->apicid;
 
 	node = c->phys_proc_id;
 	if (apicid_to_node[apicid] != NUMA_NO_NODE)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c1caefc..017c600 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -761,6 +761,12 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
 	if (this_cpu->c_identify)
 		this_cpu->c_identify(c);
 
+	/* Clear/Set all flags overriden by options, after probe */
+	for (i = 0; i < NCAPINTS; i++) {
+		c->x86_capability[i] &= ~cpu_caps_cleared[i];
+		c->x86_capability[i] |= cpu_caps_set[i];
+	}
+
 #ifdef CONFIG_X86_64
 	c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
 #endif
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 7437fa1..daed39b 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -229,12 +229,12 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
 }
 #endif
 
-static void __cpuinit srat_detect_node(void)
+static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
 {
 #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
 	unsigned node;
 	int cpu = smp_processor_id();
-	int apicid = hard_smp_processor_id();
+	int apicid = cpu_has_apic ? hard_smp_processor_id() : c->apicid;
 
 	/* Don't do the funky fallback heuristics the AMD version employs
 	   for now. */
@@ -400,7 +400,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
 	}
 
 	/* Work around errata */
-	srat_detect_node();
+	srat_detect_node(c);
 
 	if (cpu_has(c, X86_FEATURE_VMX))
 		detect_vmx_virtcap(c);

  parent reply	other threads:[~2009-05-18  7:51 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090430084145.GD21699@elte.hu>
2009-05-02  4:48 ` [PATCH] x86: read apic id if it is not acpi_lapic Yinghai Lu
2009-05-02  7:02   ` Cyrill Gorcunov
2009-05-02 17:40     ` [PATCH] x86: read apic id if it is not acpi_lapic -v2 Yinghai Lu
     [not found]       ` <20090502184108.GC4791@lenovo>
     [not found]         ` <49FC9BFC.4040904@kernel.org>
     [not found]           ` <20090502192441.GE4791@lenovo>
     [not found]             ` <49FC9F28.2070802@kernel.org>
     [not found]               ` <20090502193203.GG4791@lenovo>
2009-05-02 22:27                 ` [PATCH] x86: change apic_version array to bsp apic ver only Yinghai Lu
2009-05-11  9:20       ` [PATCH] x86: read apic id if it is not acpi_lapic -v2 Ingo Molnar
2009-05-11  9:26       ` Ingo Molnar
2009-05-11  9:40         ` Cyrill Gorcunov
2009-05-11 11:06           ` Ingo Molnar
2009-05-11  9:53       ` [tip:x86/apic] x86: read apic ID in the !acpi_lapic case tip-bot for Yinghai Lu
2009-05-11 11:02         ` Ingo Molnar
2009-05-11 13:41           ` Cyrill Gorcunov
2009-05-11 13:49             ` Ingo Molnar
2009-05-11 17:43               ` Yinghai Lu
2009-05-11 18:05                 ` Cyrill Gorcunov
2009-05-11 20:01                   ` Ingo Molnar
2009-05-11 20:05                     ` Cyrill Gorcunov
2009-05-11 20:14                     ` Yinghai Lu
2009-05-11 13:54             ` [tip:x86/apic] x86: apic: Fixmap apic address even if apic disabled tip-bot for Cyrill Gorcunov
2009-05-11 16:11           ` [tip:x86/apic] x86: read apic ID in the !acpi_lapic case Yinghai Lu
2009-05-12 10:36       ` [tip:irq/numa] " tip-bot for Yinghai Lu
2009-05-12 11:22         ` Ingo Molnar
2009-05-12 14:51           ` Cyrill Gorcunov
2009-05-12 14:58             ` Ingo Molnar
2009-05-12 15:00               ` Cyrill Gorcunov
2009-05-12 15:04               ` Yinghai Lu
2009-05-12 15:06                 ` Ingo Molnar
2009-05-12 16:46                   ` Ingo Molnar
2009-05-12 17:02                     ` Cyrill Gorcunov
2009-05-12 17:12                       ` Yinghai Lu
2009-05-12 17:27                         ` Cyrill Gorcunov
2009-05-12 18:31                     ` Yinghai Lu
2009-05-12 18:33                       ` Ingo Molnar
2009-05-12 18:35                         ` Yinghai Lu
2009-05-12 19:05                           ` Ingo Molnar
2009-05-12 19:23                             ` Yinghai Lu
2009-05-13 13:14                               ` Ingo Molnar
2009-05-13 16:41                                 ` Yinghai Lu
2009-05-18  7:39                               ` tip-bot for Yinghai Lu [this message]
2009-05-12 16:48             ` [tip:irq/numa] x86/pci: add 4 more return parameters to IO_APIC_get_PCI_irq_vector(), fix tip-bot for 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=tip-2759c3287de27266e06f1f4e82cbd2d65f6a044c@git.kernel.org \
    --to=yinghai@kernel.org \
    --cc=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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