x86: remove update_apic from x86_quirks
Subsystems (2)
PATCH 1/1 x86: remove update_apic from x86_quirks
Impact: cleanup
x86_quirks->update_apic() calling looks crazy. so try to remove it
1. every apic take wakeup_cpu member directly
2. seperate es7000_apic to es7000_apic_cluster
3. use uv_wakeup_cpu directly
--- arch/x86/include/asm/apic.h | 7 + arch/x86/include/asm/setup.h | 3 arch/x86/include/asm/uv/uv.h | 3 arch/x86/kernel/apic/apic_flat_64.c | 4 - arch/x86/kernel/apic/bigsmp_32.c | 2 arch/x86/kernel/apic/es7000_32.c | 127 ++++++++++++++++++++++++++-------- arch/x86/kernel/apic/numaq_32.c | 10 -- arch/x86/kernel/apic/probe_32.c | 16 ---- arch/x86/kernel/apic/probe_64.c | 3 arch/x86/kernel/apic/summit_32.c | 2 arch/x86/kernel/apic/x2apic_cluster.c | 2 arch/x86/kernel/apic/x2apic_phys.c | 2 arch/x86/kernel/apic/x2apic_uv_x.c | 11 +- arch/x86/kernel/setup.c | 14 --- arch/x86/kernel/smpboot.c | 8 -- 15 files changed, 121 insertions(+), 93 deletions(-)
arch/x86/include/asm/apic.h +4 -3
@@ -325,6 +325,9 @@ struct apic { };extern struct apic *apic; +extern atomic_t init_deasserted; +extern int wakeup_secondary_cpu_via_nmi (int apicid,unsigned long start_eip); +extern int wakeup_secondary_cpu_via_init (int apicid,unsigned long start_eip);static inline u32 apic_read (u32 reg) {
@@ -384,9 +387,7 @@ static inline unsigned default_get_apic_#define DEFAULT_TRAMPOLINE_PHYS_LOW 0x467#define DEFAULT_TRAMPOLINE_PHYS_HIGH 0x469 -#ifdef CONFIG_X86_32 -extern void es7000_update_apic_to_cluster (void ); -#else +#ifdef CONFIG_X86_64 extern struct apic apic_flat;extern struct apic apic_physflat;extern struct apic apic_x2apic_cluster;
arch/x86/include/asm/setup.h +0 -3
@@ -31,7 +31,6 @@ struct x86_quirks {void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable,unsigned short oemsize);int (*setup_ioapic_ids)(void ); -int (*update_apic)(void ); };extern void x86_quirk_pre_intr_init (void );
@@ -77,8 +76,6 @@ static inline void visws_early_detect(vostatic inline int is_visws_box (void ) {return 0 ; }#endif -extern int wakeup_secondary_cpu_via_nmi (int apicid,unsigned long start_eip); -extern int wakeup_secondary_cpu_via_init (int apicid,unsigned long start_eip);extern struct x86_quirks *x86_quirks;extern unsigned long saved_video_mode;
arch/x86/include/asm/uv/uv.h +0 -3
@@ -12,7 +12,6 @@ extern enum uv_system_type get_uv_systemextern int is_uv_system (void );extern void uv_cpu_init (void );extern void uv_system_init (void ); -extern int uv_wakeup_secondary (int phys_apicid,unsigned int start_rip); extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, struct mm_struct *mm, unsigned long va,
@@ -24,8 +23,6 @@ static inline enum uv_system_type get_uvstatic inline int is_uv_system (void ) {return 0 ; }static inline void uv_cpu_init (void ) { }static inline void uv_system_init (void ) { } -static inline int uv_wakeup_secondary (int phys_apicid,unsigned int start_rip) -{return 1 ; }static inline const struct cpumask *uv_flush_tlb_others (const struct cpumask *cpumask,struct mm_struct *mm,unsigned long va,unsigned int cpu)
arch/x86/kernel/apic/apic_flat_64.c +2 -2
@@ -222,7 +222,7 @@ struct apic apic_flat = { .send_IPI_all = flat_send_IPI_all, .send_IPI_self = apic_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = NULL,
@@ -373,7 +373,7 @@ struct apic apic_physflat = { .send_IPI_all = physflat_send_IPI_all, .send_IPI_self = apic_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = NULL,
arch/x86/kernel/apic/bigsmp_32.c +1 -1
@@ -256,7 +256,7 @@ struct apic apic_bigsmp = { .send_IPI_all = bigsmp_send_IPI_all, .send_IPI_self = default_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
arch/x86/kernel/apic/es7000_32.c +98 -29
192 lines not on this page · raw message
arch/x86/kernel/apic/numaq_32.c +1 -9
@@ -256,13 +256,6 @@ static int __init numaq_setup_ioapic_idsreturn 1 ; } -static int __init numaq_update_apic (void ) -{ - apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi; - -return 0 ; -} -static struct x86_quirks numaq_x86_quirks__initdata = { .arch_pre_time_init = numaq_pre_time_init, .arch_time_init =NULL ,
@@ -278,7 +271,6 @@ static struct x86_quirks numaq_x86_quirk .mpc_oem_pci_bus = mpc_oem_pci_bus, .smp_read_mpc_oem = smp_read_mpc_oem, .setup_ioapic_ids = numaq_setup_ioapic_ids, - .update_apic = numaq_update_apic, };static __init void early_check_numaq (void )
@@ -546,7 +538,7 @@ struct apic apic_numaq = { .send_IPI_all = numaq_send_IPI_all, .send_IPI_self = default_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_nmi, .trampoline_phys_low = NUMAQ_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = NUMAQ_TRAMPOLINE_PHYS_HIGH,
arch/x86/kernel/apic/probe_32.c +3 -13
@@ -138,7 +138,7 @@ struct apic apic_default = { .send_IPI_all = default_send_IPI_all, .send_IPI_self = default_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
@@ -159,6 +159,7 @@ extern struct apic apic_numaq;extern struct apic apic_summit;extern struct apic apic_bigsmp;extern struct apic apic_es7000; +extern struct apic apic_es7000_cluster;extern struct apic apic_default;struct apic *apic = &apic_default;
@@ -176,6 +177,7 @@ static struct apic *apic_probe[] __initd#endif #ifdef CONFIG_X86_ES7000 &apic_es7000, + &apic_es7000_cluster, #endif &apic_default,/* must be last */ NULL,
@@ -197,9 +199,6 @@ static int __init parse_apic(char *arg) } } -if (x86_quirks->update_apic) - x86_quirks->update_apic (); -/* Parsed again by __setup for debug/verbose */ return 0 ; }
@@ -218,8 +217,6 @@ void __init generic_bigsmp_probe(void)if (!cmdline_apic && apic == &apic_default) {if (apic_bigsmp.probe ()) { apic = &apic_bigsmp; -if (x86_quirks->update_apic) - x86_quirks->update_apic ();printk (KERN_INFO "Overriding APIC driver with %s\n" , apic->name); }
@@ -240,9 +237,6 @@ void __init generic_apic_probe(void)/* Not visible without early console */ if (!apic_probe[i])panic ("Didn't find an APIC driver" ); - -if (x86_quirks->update_apic) - x86_quirks->update_apic (); }printk (KERN_INFO "Using APIC driver %s\n" , apic->name); }
@@ -262,8 +256,6 @@ generic_mps_oem_check(struct mpc_table *if (!cmdline_apic) { apic = apic_probe[i]; -if (x86_quirks->update_apic) - x86_quirks->update_apic ();printk (KERN_INFO "Switched to APIC driver `%s'.\n" , apic->name); }
@@ -284,8 +276,6 @@ int __init default_acpi_madt_oem_check(cif (!cmdline_apic) { apic = apic_probe[i]; -if (x86_quirks->update_apic) - x86_quirks->update_apic ();printk (KERN_INFO "Switched to APIC driver `%s'.\n" , apic->name); }
arch/x86/kernel/apic/probe_64.c +0 -3
@@ -68,9 +68,6 @@ void __init default_setup_apic_routing(v apic = &apic_physflat;printk (KERN_INFO "Setting APIC routing to %s\n" , apic->name); } - -if (x86_quirks->update_apic) - x86_quirks->update_apic (); }/* Same for both flat and physical. */
arch/x86/kernel/apic/summit_32.c +1 -1
@@ -574,7 +574,7 @@ struct apic apic_summit = { .send_IPI_all = summit_send_IPI_all, .send_IPI_self = default_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
arch/x86/kernel/apic/x2apic_cluster.c +1 -1
@@ -224,7 +224,7 @@ struct apic apic_x2apic_cluster = { .send_IPI_all = x2apic_send_IPI_all, .send_IPI_self = x2apic_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = NULL,
arch/x86/kernel/apic/x2apic_phys.c +1 -1
@@ -213,7 +213,7 @@ struct apic apic_x2apic_phys = { .send_IPI_all = x2apic_send_IPI_all, .send_IPI_self = x2apic_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = wakeup_secondary_cpu_via_init, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = NULL,
arch/x86/kernel/apic/x2apic_uv_x.c +7 -4
@@ -91,7 +91,7 @@ static void uv_vector_allocation_domain(cpumask_set_cpu (cpu, retmask); } -int uv_wakeup_secondary (int phys_apicid,unsigned int start_rip) +static int uv_wakeup_secondary (int phys_apicid,unsigned long start_rip) {unsigned long val;int pnode;
@@ -99,16 +99,19 @@ int uv_wakeup_secondary(int phys_apicid, pnode =uv_apicid_to_pnode (phys_apicid); val = (1UL <<UVH_IPI_INT_SEND_SHFT ) | (phys_apicid <<UVH_IPI_INT_APIC_ID_SHFT ) | - (((long )start_rip <<UVH_IPI_INT_VECTOR_SHFT ) >>12 ) | + ((start_rip <<UVH_IPI_INT_VECTOR_SHFT ) >>12 ) |APIC_DM_INIT ;uv_write_global_mmr64 (pnode,UVH_IPI_INT , val);mdelay (10 ); val = (1UL <<UVH_IPI_INT_SEND_SHFT ) | (phys_apicid <<UVH_IPI_INT_APIC_ID_SHFT ) | - (((long )start_rip <<UVH_IPI_INT_VECTOR_SHFT ) >>12 ) | + ((start_rip <<UVH_IPI_INT_VECTOR_SHFT ) >>12 ) |APIC_DM_STARTUP ;uv_write_global_mmr64 (pnode,UVH_IPI_INT , val); + +atomic_set (&init_deasserted,1 ); +return 0 ; }
@@ -285,7 +288,7 @@ struct apic apic_x2apic_uv_x = { .send_IPI_all = uv_send_IPI_all, .send_IPI_self = uv_send_IPI_self, - .wakeup_cpu = NULL, + .wakeup_cpu = uv_wakeup_secondary, .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, .wait_for_init_deassert = NULL,
arch/x86/kernel/setup.c +1 -13
@@ -600,19 +600,7 @@ static int __init setup_elfcorehdr(charearly_param ("elfcorehdr" , setup_elfcorehdr);#endif -static int __init default_update_apic (void ) -{ -#ifdef CONFIG_SMP -if (!apic->wakeup_cpu) - apic->wakeup_cpu = wakeup_secondary_cpu_via_init; -#endif - -return 0 ; -} - -static struct x86_quirks default_x86_quirks__initdata = { - .update_apic = default_update_apic, -}; +static struct x86_quirks default_x86_quirks__initdata ;struct x86_quirks *x86_quirks__initdata = &default_x86_quirks;
arch/x86/kernel/smpboot.c +1 -7
@@ -112,7 +112,7 @@ EXPORT_PER_CPU_SYMBOL(cpu_core_map); DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);EXPORT_PER_CPU_SYMBOL (cpu_info); -static atomic_t init_deasserted; +atomic_t init_deasserted;/* Set if we find a B stepping CPU */
@@ -614,12 +614,6 @@ wakeup_secondary_cpu_via_init(int phys_aunsigned long send_status, accept_status =0 ;int maxlvt, num_starts, j; -if (get_uv_system_type () ==UV_NON_UNIQUE_APIC ) { - send_status =uv_wakeup_secondary (phys_apicid, start_eip); -atomic_set (&init_deasserted,1 ); -return send_status; - } - maxlvt =lapic_get_maxlvt ();/*
Quoted 19 lines · Yinghai Lu
Impact: cleanup
x86_quirks->update_apic()calling looks crazy. so try to remove it
1. every apic takewakeup_cpumember directly
2. seperatees7000_apictoes7000_apic_cluster
3. useuv_wakeup_cpudirectlySigned-off-by Yinghai Lu <[email protected]>--- arch/x86/include/asm/apic.h | 7 + arch/x86/include/asm/setup.h | 3 arch/x86/include/asm/uv/uv.h | 3 arch/x86/kernel/apic/apic_flat_64.c | 4 - arch/x86/kernel/apic/bigsmp_32.c | 2 arch/x86/kernel/apic/es7000_32.c | 127 ++++++++++++++++++++++++++-------- arch/x86/kernel/apic/numaq_32.c | 10 -- arch/x86/kernel/apic/probe_32.c | 16 ----
Quoted 8 lines
arch/x86/kernel/apic/probe_64.c | 3 arch/x86/kernel/apic/summit_32.c | 2 arch/x86/kernel/apic/x2apic_cluster.c | 2 arch/x86/kernel/apic/x2apic_phys.c | 2 arch/x86/kernel/apic/x2apic_uv_x.c | 11 +- arch/x86/kernel/setup.c | 14 --- arch/x86/kernel/smpboot.c | 8 -- 15 files changed, 121 insertions(+), 93 deletions(-)
that's certainly a nice cleanup! Applied to tip:x86/apic, thanks Yinghai!
Ingo
btw., i suspect we could make apic->wakeup_cpu() == NULL mean wakeup_secondary_cpu_via_init()? And thus remove the wakeup_cpu initialization from most of the APIC drivers.
Ingo
except that it doesnt build:
arch/x86/kernel/built-in.o:(.data+0x8c08): undefined reference to wakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x8d68): undefined reference to wakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x8ec8): undefined reference to wakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x9038): undefined reference to wakeup_secondary_cpu_via_init'
Ingo
Quoted 7 lines · Ingo Molnar
except that it doesnt build:
arch/x86/kernel/built-in.o:(.data+0x8c08): undefined reference to
wakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x8d68): undefined reference towakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x8ec8): undefined reference towakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x9038): undefined reference towakeup_secondary_cpu_via_init'
.config?
I tested 32bit and 64bit
YH
Quoted 10 lines · Yinghai Lu
Quoted 7 lines · Ingo Molnar
except that it doesnt build:
arch/x86/kernel/built-in.o:(.data+0x8c08): undefined reference to
wakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x8d68): undefined reference towakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x8ec8): undefined reference towakeup_secondary_cpu_via_init' arch/x86/kernel/built-in.o:(.data+0x9038): undefined reference towakeup_secondary_cpu_via_init'.config?
There's no need for a config :)
When introducing a widely used symbol as wakeup_secondary_cpu_via_init(), the first thing to check is to make sure it's built in widely enough:
$ git grep wakeup_secondary_cpu_via_init
arch/x86/include/asm/apic.h:extern int wakeup_secondary_cpu_via_init(int apicid, unsigned long start_eip);arch/x86/kernel/apic/apic_flat_64.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/apic_flat_64.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/bigsmp_32.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/es7000_32.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/probe_32.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/summit_32.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/x2apic_cluster.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,arch/x86/kernel/apic/x2apic_phys.c: .wakeup_cpu = wakeup_secondary_cpu_via_init,
arch/x86/kernel/smpboot.c:wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
as you can see it's defined in arch/x86/kernel/smpboot.c - which, as its name already tells us, is only built on SMP.
There's other usage though, like arch/x86/kernel/apic/probe_32.c, which is built on CONFIG_X86_LOCAL_APIC=y, which can be enabled on !SMP as well.
Since on SMP we are not likely to boot other CPUs via apic->wakeup_cpu(), i suspect we need a !SMP inline for wakeup_secondary_cpu_via_init()?
Ingo