[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] x86: make cpu_2_logical_apicid private to x2apic code
... as it in fact is only being used there. While moving it, also make it a per-CPU variable rather than a NR_CPUS-sized array. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1024,7 +1024,6 @@ __next: if (boot_cpu_physical_apicid == -1U) boot_cpu_physical_apicid = get_apic_id(); x86_cpu_to_apicid[0] = get_apic_id(); - cpu_2_logical_apicid[0] = get_logical_apic_id(); init_ioapic_mappings(); } --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -32,14 +32,15 @@ static bool_t __initdata x2apic_phys; /* By default we use logical cluster mode. */ boolean_param("x2apic_phys", x2apic_phys); +static DEFINE_PER_CPU_READ_MOSTLY(u32, cpu_2_logical_apicid); + static void init_apic_ldr_x2apic_phys(void) { } static void init_apic_ldr_x2apic_cluster(void) { - int cpu = smp_processor_id(); - cpu_2_logical_apicid[cpu] = apic_read(APIC_LDR); + this_cpu(cpu_2_logical_apicid) = apic_read(APIC_LDR); } static void __init clustered_apic_check_x2apic(void) @@ -48,7 +49,7 @@ static void __init clustered_apic_check_ static unsigned int cpu_mask_to_apicid_x2apic_cluster(const cpumask_t *cpumask) { - return cpu_2_logical_apicid[cpumask_first(cpumask)]; + return per_cpu(cpu_2_logical_apicid, cpumask_first(cpumask)); } static void __send_IPI_mask_x2apic( @@ -77,7 +78,7 @@ static void __send_IPI_mask_x2apic( if ( !cpu_online(cpu) || (cpu == smp_processor_id()) ) continue; msr_content = (dest_mode == APIC_DEST_PHYSICAL) - ? cpu_physical_id(cpu) : cpu_2_logical_apicid[cpu]; + ? cpu_physical_id(cpu) : per_cpu(cpu_2_logical_apicid, cpu); msr_content = (msr_content << 32) | APIC_DM_FIXED | dest_mode | vector; apic_wrmsr(APIC_ICR, msr_content); } --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -28,11 +28,6 @@ int hard_smp_processor_id(void) return get_apic_id(); } -int logical_smp_processor_id(void) -{ - return get_logical_apic_id(); -} - /* * send_IPI_mask(cpumask, vector): sends @vector IPI to CPUs in @cpumask, * excluding the local CPU. @cpumask may be empty. --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -64,8 +64,6 @@ struct cpuinfo_x86 cpu_data[NR_CPUS]; u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; -static void map_cpu_to_logical_apicid(void); - static int cpu_error; static enum cpu_state { CPU_STATE_DYING, /* slave -> master: I am dying */ @@ -202,7 +200,6 @@ static void smp_callin(void) Dprintk("CALLIN, before setup_local_APIC().\n"); x2apic_ap_setup(); setup_local_APIC(); - map_cpu_to_logical_apicid(); /* Save our processor parameters. */ smp_store_cpu_info(cpu); @@ -401,22 +398,6 @@ extern struct { unsigned short ss; } stack_start; -u32 cpu_2_logical_apicid[NR_CPUS] __read_mostly = - { [0 ... NR_CPUS-1] = BAD_APICID }; - -static void map_cpu_to_logical_apicid(void) -{ - int cpu = smp_processor_id(); - int apicid = logical_smp_processor_id(); - - cpu_2_logical_apicid[cpu] = apicid; -} - -static void unmap_cpu_to_logical_apicid(int cpu) -{ - cpu_2_logical_apicid[cpu] = BAD_APICID; -} - static int wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) { unsigned long send_status = 0, accept_status = 0; @@ -646,7 +627,6 @@ static int do_boot_cpu(int apicid, int c void cpu_exit_clear(unsigned int cpu) { cpu_uninit(cpu); - unmap_cpu_to_logical_apicid(cpu); set_cpu_state(CPU_STATE_DEAD); } @@ -775,7 +755,6 @@ void __init smp_prepare_cpus(unsigned in if (APIC_init_uniprocessor()) printk(KERN_NOTICE "Local APIC not detected." " Using dummy APIC emulation.\n"); - map_cpu_to_logical_apicid(); return; } @@ -804,7 +783,6 @@ void __init smp_prepare_cpus(unsigned in connect_bsp_APIC(); setup_local_APIC(); - map_cpu_to_logical_apicid(); smpboot_setup_io_apic(); --- a/xen/include/asm-x86/apic.h +++ b/xen/include/asm-x86/apic.h @@ -158,12 +158,6 @@ static __inline u32 get_apic_id(void) /* return x2apic_enabled ? id : GET_xAPIC_ID(id); } -static __inline u32 get_logical_apic_id(void) -{ - u32 logical_id = apic_read(APIC_LDR); - return x2apic_enabled ? logical_id : GET_xAPIC_LOGICAL_ID(logical_id); -} - void apic_wait_icr_idle(void); int get_physical_broadcast(void); --- a/xen/include/asm-x86/smp.h +++ b/xen/include/asm-x86/smp.h @@ -37,7 +37,6 @@ extern void zap_low_mappings(void); #define MAX_APICID 256 extern u32 x86_cpu_to_apicid[]; -extern u32 cpu_2_logical_apicid[]; #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] @@ -54,7 +53,6 @@ int cpu_add(uint32_t apic_id, uint32_t a #define raw_smp_processor_id() (get_processor_id()) int hard_smp_processor_id(void); -int logical_smp_processor_id(void); void __stop_this_cpu(void); Attachment:
x86-cpu2lapicid.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |