[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080324182107.GA27979@sgi.com>
Date: Mon, 24 Mar 2008 13:21:07 -0500
From: Jack Steiner <steiner@....com>
To: mingo@...e.hu, tglx@...utronix.de
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [RFC 1/8] x86_64: Change GET_APIC_ID() from an inline function to an out-of-line function
Change GET_APIC_ID() on x86_64 from an inline function to an
out-of-line function. The function is rarely called and the
additional overhead is negligible.
This change is in preparation for additional changes to
the APICID functions that will come in a later patch.
Signed-off-by: Jack Steiner <steiner@....com>
---
arch/x86/kernel/apic_64.c | 2 +-
arch/x86/kernel/genapic_64.c | 5 +++++
arch/x86/kernel/genapic_flat_64.c | 2 +-
arch/x86/kernel/io_apic_64.c | 4 ++--
arch/x86/kernel/mpparse_64.c | 2 +-
arch/x86/kernel/smpboot_64.c | 6 +++---
include/asm-x86/apic.h | 1 +
include/asm-x86/apicdef.h | 1 -
include/asm-x86/smp_64.h | 2 +-
9 files changed, 15 insertions(+), 10 deletions(-)
Index: linux/arch/x86/kernel/apic_64.c
===================================================================
--- linux.orig/arch/x86/kernel/apic_64.c 2008-03-18 14:54:19.000000000 -0500
+++ linux/arch/x86/kernel/apic_64.c 2008-03-20 15:30:23.000000000 -0500
@@ -885,7 +885,7 @@ void __init init_apic_mappings(void)
* Fetch the APIC ID of the BSP in case we have a
* default configuration (or the MP table is broken).
*/
- boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
+ boot_cpu_id = get_apic_id();
}
/*
Index: linux/arch/x86/kernel/genapic_64.c
===================================================================
--- linux.orig/arch/x86/kernel/genapic_64.c 2008-03-18 14:54:19.000000000 -0500
+++ linux/arch/x86/kernel/genapic_64.c 2008-03-21 09:13:41.000000000 -0500
@@ -64,3 +64,8 @@ void send_IPI_self(int vector)
{
__send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
}
+
+unsigned int get_apic_id(void)
+{
+ return (apic_read(APIC_ID) >> 24) & 0xFFu;
+}
Index: linux/arch/x86/kernel/genapic_flat_64.c
===================================================================
--- linux.orig/arch/x86/kernel/genapic_flat_64.c 2008-03-18 14:54:19.000000000 -0500
+++ linux/arch/x86/kernel/genapic_flat_64.c 2008-03-20 15:30:23.000000000 -0500
@@ -97,7 +97,7 @@ static void flat_send_IPI_all(int vector
static int flat_apic_id_registered(void)
{
- return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map);
+ return physid_isset(get_apic_id(), phys_cpu_present_map);
}
static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask)
Index: linux/arch/x86/kernel/io_apic_64.c
===================================================================
--- linux.orig/arch/x86/kernel/io_apic_64.c 2008-03-18 14:54:19.000000000 -0500
+++ linux/arch/x86/kernel/io_apic_64.c 2008-03-21 09:07:19.000000000 -0500
@@ -1067,7 +1067,7 @@ void __apicdebuginit print_local_APIC(vo
printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
smp_processor_id(), hard_smp_processor_id());
v = apic_read(APIC_ID);
- printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(v));
+ printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, get_apic_id());
v = apic_read(APIC_LVR);
printk(KERN_INFO "... APIC VERSION: %08x\n", v);
ver = GET_APIC_VERSION(v);
@@ -1261,7 +1261,7 @@ void disable_IO_APIC(void)
entry.dest_mode = 0; /* Physical */
entry.delivery_mode = dest_ExtINT; /* ExtInt */
entry.vector = 0;
- entry.dest = GET_APIC_ID(apic_read(APIC_ID));
+ entry.dest = get_apic_id();
/*
* Add it to the IO-APIC irq-routing table:
Index: linux/arch/x86/kernel/mpparse_64.c
===================================================================
--- linux.orig/arch/x86/kernel/mpparse_64.c 2008-03-18 14:54:19.000000000 -0500
+++ linux/arch/x86/kernel/mpparse_64.c 2008-03-21 09:07:23.000000000 -0500
@@ -614,7 +614,7 @@ void __init mp_register_lapic_address(u6
mp_lapic_addr = (unsigned long) address;
set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
if (boot_cpu_id == -1U)
- boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID));
+ boot_cpu_id = get_apic_id();
}
void __cpuinit mp_register_lapic (u8 id, u8 enabled)
Index: linux/arch/x86/kernel/smpboot_64.c
===================================================================
--- linux.orig/arch/x86/kernel/smpboot_64.c 2008-03-18 14:54:19.000000000 -0500
+++ linux/arch/x86/kernel/smpboot_64.c 2008-03-21 09:07:19.000000000 -0500
@@ -158,7 +158,7 @@ void __cpuinit smp_callin(void)
/*
* (This works even if the APIC is not enabled.)
*/
- phys_id = GET_APIC_ID(apic_read(APIC_ID));
+ phys_id = get_apic_id();
cpuid = smp_processor_id();
if (cpu_isset(cpuid, cpu_callin_map)) {
panic("smp_callin: phys CPU#%d, CPU#%d already present??\n",
@@ -878,9 +878,9 @@ void __init smp_prepare_cpus(unsigned in
enable_IO_APIC();
end_local_APIC_setup();
- if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) {
+ if (get_apic_id() != boot_cpu_id) {
panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
- GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id);
+ get_apic_id(), boot_cpu_id);
/* Or can we switch back to PIC here? */
}
Index: linux/include/asm-x86/apic.h
===================================================================
--- linux.orig/include/asm-x86/apic.h 2008-03-18 14:54:19.000000000 -0500
+++ linux/include/asm-x86/apic.h 2008-03-21 09:07:59.000000000 -0500
@@ -129,6 +129,7 @@ extern void enable_NMI_through_LVT0(void
*/
#ifdef CONFIG_X86_64
extern void setup_apic_routing(void);
+extern unsigned int get_apic_id(void);
#endif
extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
Index: linux/include/asm-x86/apicdef.h
===================================================================
--- linux.orig/include/asm-x86/apicdef.h 2008-03-18 14:54:19.000000000 -0500
+++ linux/include/asm-x86/apicdef.h 2008-03-21 09:07:23.000000000 -0500
@@ -14,7 +14,6 @@
#ifdef CONFIG_X86_64
# define APIC_ID_MASK (0xFFu<<24)
-# define GET_APIC_ID(x) (((x)>>24)&0xFFu)
# define SET_APIC_ID(x) (((x)<<24))
#endif
Index: linux/include/asm-x86/smp_64.h
===================================================================
--- linux.orig/include/asm-x86/smp_64.h 2008-03-18 14:54:19.000000000 -0500
+++ linux/include/asm-x86/smp_64.h 2008-03-18 14:54:24.000000000 -0500
@@ -92,7 +92,7 @@ static __inline int logical_smp_processo
static inline int hard_smp_processor_id(void)
{
/* we don't want to mark this access volatile - bad code generation */
- return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID));
+ return get_apic_id();
}
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists