From: Andrew Morton Arjan said cpu_relax() always implies a barrier. Cc: Andreas Mohr Cc: Arjan van de Ven Signed-off-by: Andrew Morton --- arch/i386/kernel/smpboot.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff -puN arch/i386/kernel/smpboot.c~cpu_relax-smpbootc-fix arch/i386/kernel/smpboot.c --- a/arch/i386/kernel/smpboot.c~cpu_relax-smpbootc-fix +++ a/arch/i386/kernel/smpboot.c @@ -251,10 +251,8 @@ static void __init synchronize_tsc_bp (v /* * all APs synchronize but they loop on '== num_cpus' */ - while (atomic_read(&tsc_count_start) != num_booting_cpus()-1) { + while (atomic_read(&tsc_count_start) != num_booting_cpus()-1) cpu_relax(); - mb(); - } atomic_set(&tsc_count_stop, 0); wmb(); /* @@ -272,10 +270,8 @@ static void __init synchronize_tsc_bp (v /* * Wait for all APs to leave the synchronization point: */ - while (atomic_read(&tsc_count_stop) != num_booting_cpus()-1) { + while (atomic_read(&tsc_count_stop) != num_booting_cpus()-1) cpu_relax(); - mb(); - } atomic_set(&tsc_count_start, 0); wmb(); atomic_inc(&tsc_count_stop); @@ -332,27 +328,21 @@ static void __init synchronize_tsc_ap (v * this gets called, so we first wait for the BP to * finish SMP initialization: */ - while (!atomic_read(&tsc_start_flag)) { + while (!atomic_read(&tsc_start_flag)) cpu_relax(); - mb(); - } for (i = 0; i < NR_LOOPS; i++) { atomic_inc(&tsc_count_start); - while (atomic_read(&tsc_count_start) != num_booting_cpus()) { + while (atomic_read(&tsc_count_start) != num_booting_cpus()) cpu_relax(); - mb(); - } rdtscll(tsc_values[smp_processor_id()]); if (i == NR_LOOPS-1) write_tsc(0, 0); atomic_inc(&tsc_count_stop); - while (atomic_read(&tsc_count_stop) != num_booting_cpus()) { + while (atomic_read(&tsc_count_stop) != num_booting_cpus()) cpu_relax(); - mb(); - } } } #undef NR_LOOPS @@ -1453,10 +1443,8 @@ int __devinit __cpu_up(unsigned int cpu) per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; /* Unleash the CPU! */ cpu_set(cpu, smp_commenced_mask); - while (!cpu_isset(cpu, cpu_online_map)) { + while (!cpu_isset(cpu, cpu_online_map)) cpu_relax(); - mb(); - } return 0; } _