Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/smpboot: Remove APIC.wait_for_init_deassert and atomic init_deasserted

Both the per-APIC flag ".wait_for_init_deassert",
and the global atomic_t "init_deasserted"
are dead code -- remove them.

For all APIC types, "wait_for_master()"
prevents an AP from proceeding until the BSP has set
cpu_callout_mask, making "init_deasserted" {unnecessary}:

BSP: <de-assert INIT>
...
BSP: {set init_deasserted}
AP: wait_for_master()
set cpu_initialized_mask
wait for cpu_callout_mask
BSP: test cpu_initialized_mask
BSP: set cpu_callout_mask
AP: test cpu_callout_mask
AP: {wait for init_deasserted}
...
AP: <touch APIC>

Deleting the {dead code} above is necessary to enable
some parallelism in a future patch.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Jan H. Schönherr <jschoenh@amazon.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Zhu Guihua <zhugh.fnst@cn.fujitsu.com>
Link: http://lkml.kernel.org/r/de4b3a9bab894735e285870b5296da25ee6a8a5a.1439739165.git.len.brown@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Len Brown and committed by
Ingo Molnar
656bba30 a9bcaa02

+3 -26
-2
arch/x86/include/asm/apic.h
··· 313 313 /* wakeup_secondary_cpu */ 314 314 int (*wakeup_secondary_cpu)(int apicid, unsigned long start_eip); 315 315 316 - bool wait_for_init_deassert; 317 316 void (*inquire_remote_apic)(int apicid); 318 317 319 318 /* apic ops */ ··· 377 378 * APIC functionality to boot other CPUs - only used on SMP: 378 379 */ 379 380 #ifdef CONFIG_SMP 380 - extern atomic_t init_deasserted; 381 381 extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip); 382 382 #endif 383 383
-2
arch/x86/kernel/apic/apic_flat_64.c
··· 191 191 .send_IPI_all = flat_send_IPI_all, 192 192 .send_IPI_self = apic_send_IPI_self, 193 193 194 - .wait_for_init_deassert = false, 195 194 .inquire_remote_apic = default_inquire_remote_apic, 196 195 197 196 .read = native_apic_mem_read, ··· 298 299 .send_IPI_all = physflat_send_IPI_all, 299 300 .send_IPI_self = apic_send_IPI_self, 300 301 301 - .wait_for_init_deassert = false, 302 302 .inquire_remote_apic = default_inquire_remote_apic, 303 303 304 304 .read = native_apic_mem_read,
-1
arch/x86/kernel/apic/apic_noop.c
··· 152 152 153 153 .wakeup_secondary_cpu = noop_wakeup_secondary_cpu, 154 154 155 - .wait_for_init_deassert = false, 156 155 .inquire_remote_apic = NULL, 157 156 158 157 .read = noop_apic_read,
-2
arch/x86/kernel/apic/apic_numachip.c
··· 92 92 93 93 write_lcsr(CSR_G3_EXT_IRQ_GEN, int_gen.v); 94 94 95 - atomic_set(&init_deasserted, 1); 96 95 return 0; 97 96 } 98 97 ··· 234 235 .send_IPI_self = numachip_send_IPI_self, 235 236 236 237 .wakeup_secondary_cpu = numachip_wakeup_secondary, 237 - .wait_for_init_deassert = false, 238 238 .inquire_remote_apic = NULL, /* REMRD not supported */ 239 239 240 240 .read = native_apic_mem_read,
-1
arch/x86/kernel/apic/bigsmp_32.c
··· 186 186 .send_IPI_all = bigsmp_send_IPI_all, 187 187 .send_IPI_self = default_send_IPI_self, 188 188 189 - .wait_for_init_deassert = true, 190 189 .inquire_remote_apic = default_inquire_remote_apic, 191 190 192 191 .read = native_apic_mem_read,
-1
arch/x86/kernel/apic/probe_32.c
··· 111 111 .send_IPI_all = default_send_IPI_all, 112 112 .send_IPI_self = default_send_IPI_self, 113 113 114 - .wait_for_init_deassert = true, 115 114 .inquire_remote_apic = default_inquire_remote_apic, 116 115 117 116 .read = native_apic_mem_read,
-1
arch/x86/kernel/apic/x2apic_cluster.c
··· 272 272 .send_IPI_all = x2apic_send_IPI_all, 273 273 .send_IPI_self = x2apic_send_IPI_self, 274 274 275 - .wait_for_init_deassert = false, 276 275 .inquire_remote_apic = NULL, 277 276 278 277 .read = native_apic_msr_read,
-1
arch/x86/kernel/apic/x2apic_phys.c
··· 128 128 .send_IPI_all = x2apic_send_IPI_all, 129 129 .send_IPI_self = x2apic_send_IPI_self, 130 130 131 - .wait_for_init_deassert = false, 132 131 .inquire_remote_apic = NULL, 133 132 134 133 .read = native_apic_msr_read,
-2
arch/x86/kernel/apic/x2apic_uv_x.c
··· 248 248 APIC_DM_STARTUP; 249 249 uv_write_global_mmr64(pnode, UVH_IPI_INT, val); 250 250 251 - atomic_set(&init_deasserted, 1); 252 251 return 0; 253 252 } 254 253 ··· 413 414 .send_IPI_self = uv_send_IPI_self, 414 415 415 416 .wakeup_secondary_cpu = uv_wakeup_secondary, 416 - .wait_for_init_deassert = false, 417 417 .inquire_remote_apic = NULL, 418 418 419 419 .read = native_apic_msr_read,
+3 -13
arch/x86/kernel/smpboot.c
··· 97 97 DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info); 98 98 EXPORT_PER_CPU_SYMBOL(cpu_info); 99 99 100 - atomic_t init_deasserted; 101 - 102 100 static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) 103 101 { 104 102 unsigned long flags; ··· 144 146 145 147 /* 146 148 * If waken up by an INIT in an 82489DX configuration 147 - * we may get here before an INIT-deassert IPI reaches 148 - * our local APIC. We have to wait for the IPI or we'll 149 - * lock up on an APIC access. 150 - * 151 - * Since CPU0 is not wakened up by INIT, it doesn't wait for the IPI. 149 + * cpu_callout_mask guarantees we don't get here before 150 + * an INIT_deassert IPI reaches our local APIC, so it is 151 + * now safe to touch our local APIC. 152 152 */ 153 153 cpuid = smp_processor_id(); 154 - if (apic->wait_for_init_deassert && cpuid) 155 - while (!atomic_read(&init_deasserted)) 156 - cpu_relax(); 157 154 158 155 /* 159 156 * (This works even if the APIC is not enabled.) ··· 613 620 send_status = safe_apic_wait_icr_idle(); 614 621 615 622 mb(); 616 - atomic_set(&init_deasserted, 1); 617 623 618 624 /* 619 625 * Should we send STARTUP IPIs ? ··· 852 860 * This grunge runs the startup process for 853 861 * the targeted processor. 854 862 */ 855 - 856 - atomic_set(&init_deasserted, 0); 857 863 858 864 if (get_uv_system_type() != UV_NON_UNIQUE_APIC) { 859 865