From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: change apic_version array to bsp apic ver only
Date: Sat, 02 May 2009 15:27:49 -0700 [thread overview]
Message-ID: <49FCC8E5.8050202@kernel.org> (raw)
In-Reply-To: <20090502193203.GG4791@lenovo>
only need to record boot cpu apic version
[ Impact: save some bytes ]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/include/asm/mpspec.h | 2 +-
arch/x86/kernel/acpi/boot.c | 7 +++----
arch/x86/kernel/apic/apic.c | 16 ++++++++--------
arch/x86/kernel/apic/es7000_32.c | 4 +---
arch/x86/kernel/apic/io_apic.c | 2 +-
arch/x86/kernel/smpboot.c | 10 +++++-----
arch/x86/kernel/visws_quirks.c | 3 ++-
7 files changed, 21 insertions(+), 23 deletions(-)
Index: linux-2.6/arch/x86/include/asm/mpspec.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/mpspec.h
+++ linux-2.6/arch/x86/include/asm/mpspec.h
@@ -5,7 +5,7 @@
#include <asm/mpspec_def.h>
-extern int apic_version[MAX_APICS];
+extern int apic_version;
extern int pic_mode;
#ifdef CONFIG_X86_32
Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -225,7 +225,7 @@ static void __cpuinit acpi_register_lapi
}
if (boot_cpu_physical_apicid != -1U)
- ver = apic_version[boot_cpu_physical_apicid];
+ ver = apic_version;
generic_processor_info(id, ver);
}
@@ -808,8 +808,7 @@ static void __init acpi_register_lapic_a
set_fixmap_nocache(FIX_APIC_BASE, address);
if (boot_cpu_physical_apicid == -1U) {
boot_cpu_physical_apicid = read_apic_id();
- apic_version[boot_cpu_physical_apicid] =
- GET_APIC_VERSION(apic_read(APIC_LVR));
+ apic_version = GET_APIC_VERSION(apic_read(APIC_LVR));
}
}
@@ -937,7 +936,7 @@ static u8 __init uniq_ioapic_id(u8 id)
{
#ifdef CONFIG_X86_32
if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
- !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
+ !APIC_XAPIC(apic_version))
return io_apic_get_unique_id(nr_ioapics, id);
else
return id;
Index: linux-2.6/arch/x86/kernel/apic/apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6/arch/x86/kernel/apic/apic.c
@@ -1615,8 +1615,7 @@ void __init init_apic_mappings(void)
new_apicid = read_apic_id();
if (boot_cpu_physical_apicid != new_apicid) {
boot_cpu_physical_apicid = new_apicid;
- apic_version[new_apicid] =
- GET_APIC_VERSION(apic_read(APIC_LVR));
+ apic_version = GET_APIC_VERSION(apic_read(APIC_LVR));
}
}
@@ -1624,7 +1623,7 @@ void __init init_apic_mappings(void)
* This initializes the IO-APIC and APIC hardware if this is
* a UP kernel.
*/
-int apic_version[MAX_APICS];
+int apic_version;
int __init APIC_init_uniprocessor(void)
{
@@ -1645,8 +1644,7 @@ int __init APIC_init_uniprocessor(void)
/*
* Complain if the BIOS pretends there is one.
*/
- if (!cpu_has_apic &&
- APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
+ if (!cpu_has_apic && APIC_INTEGRATED(apic_version)) {
pr_err("BIOS bug, local APIC 0x%x not detected!...\n",
boot_cpu_physical_apicid);
clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
@@ -1871,7 +1869,9 @@ void __cpuinit generic_processor_info(in
version);
version = 0x10;
}
- apic_version[apicid] = version;
+
+ if (apicid == boot_cpu_physical_apicid)
+ apic_version = version;
if (num_processors >= nr_cpu_ids) {
int max = nr_cpu_ids;
@@ -1888,10 +1888,10 @@ void __cpuinit generic_processor_info(in
num_processors++;
cpu = cpumask_next_zero(-1, cpu_present_mask);
- if (version != apic_version[boot_cpu_physical_apicid])
+ if (version != apic_version)
WARN_ONCE(1,
"ACPI: apic version mismatch, bootcpu: %x cpu %d: %x\n",
- apic_version[boot_cpu_physical_apicid], cpu, version);
+ apic_version, cpu, version);
physid_set(apicid, phys_cpu_present_map);
if (apicid == boot_cpu_physical_apicid) {
Index: linux-2.6/arch/x86/kernel/apic/es7000_32.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/es7000_32.c
+++ linux-2.6/arch/x86/kernel/apic/es7000_32.c
@@ -512,11 +512,9 @@ static void es7000_init_apic_ldr(void)
static void es7000_setup_apic_routing(void)
{
- int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
-
printk(KERN_INFO
"Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
- (apic_version[apic] == 0x14) ?
+ (apic_version == 0x14) ?
"Physical Cluster" : "Logical Cluster",
nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
}
Index: linux-2.6/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6/arch/x86/kernel/apic/io_apic.c
@@ -2010,7 +2010,7 @@ static void __init setup_ioapic_ids_from
* no meaning without the serial APIC bus.
*/
if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
- || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
+ || APIC_XAPIC(apic_version))
return;
/*
* This is broken; anything with a real cpu count has to
Index: linux-2.6/arch/x86/kernel/smpboot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/smpboot.c
+++ linux-2.6/arch/x86/kernel/smpboot.c
@@ -522,7 +522,7 @@ wakeup_secondary_cpu_via_nmi(int logical
* Give the other CPU some time to accept the IPI.
*/
udelay(200);
- if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
+ if (APIC_INTEGRATED(apic_version)) {
maxlvt = lapic_get_maxlvt();
if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
apic_write(APIC_ESR, 0);
@@ -549,7 +549,7 @@ wakeup_secondary_cpu_via_init(int phys_a
/*
* Be paranoid about clearing APIC errors.
*/
- if (APIC_INTEGRATED(apic_version[phys_apicid])) {
+ if (APIC_INTEGRATED(apic_version)) {
if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
apic_write(APIC_ESR, 0);
apic_read(APIC_ESR);
@@ -589,7 +589,7 @@ wakeup_secondary_cpu_via_init(int phys_a
* Determine this based on the APIC version.
* If we don't have an integrated APIC, don't send the STARTUP IPIs.
*/
- if (APIC_INTEGRATED(apic_version[phys_apicid]))
+ if (APIC_INTEGRATED(apic_version))
num_starts = 2;
else
num_starts = 0;
@@ -753,7 +753,7 @@ do_rest:
/*
* Be paranoid about clearing APIC errors.
*/
- if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
+ if (APIC_INTEGRATED(apic_version)) {
apic_write(APIC_ESR, 0);
apic_read(APIC_ESR);
}
@@ -990,7 +990,7 @@ static int __init smp_sanity_check(unsig
/*
* If we couldn't find a local APIC, then get out of here now!
*/
- if (APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid]) &&
+ if (APIC_INTEGRATED(apic_version) &&
!cpu_has_apic) {
printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
boot_cpu_physical_apicid);
Index: linux-2.6/arch/x86/kernel/visws_quirks.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/visws_quirks.c
+++ linux-2.6/arch/x86/kernel/visws_quirks.c
@@ -205,7 +205,8 @@ static void __init MP_processor_info(str
m->apicid);
ver = 0x10;
}
- apic_version[m->apicid] = ver;
+ if (m->cpuflag & CPU_BOOTPROCESSOR)
+ apic_version = ver;
}
static int __init visws_find_smp_config(unsigned int reserve)
next prev parent reply other threads:[~2009-05-02 22:28 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 ` Yinghai Lu [this message]
2009-05-11 9:20 ` 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:irq/numa] x86: don't call read_apic_id if !cpu_has_apic tip-bot for Yinghai Lu
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=49FCC8E5.8050202@kernel.org \
--to=yinghai@kernel.org \
--cc=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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