From: Andreas Mohr Add cpu_relax() to various smpboot.c init loops. Signed-off-by: Andreas Mohr Cc: Arjan van de Ven Signed-off-by: Andrew Morton --- arch/i386/kernel/smpboot.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff -puN arch/i386/kernel/smpboot.c~cpu_relax-smpbootc arch/i386/kernel/smpboot.c --- a/arch/i386/kernel/smpboot.c~cpu_relax-smpbootc +++ a/arch/i386/kernel/smpboot.c @@ -251,8 +251,10 @@ 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(); /* @@ -270,8 +272,10 @@ 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); @@ -328,19 +332,27 @@ 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)) mb(); + 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()) mb(); + while (atomic_read(&tsc_count_stop) != num_booting_cpus()) { + cpu_relax(); + mb(); + } } } #undef NR_LOOPS @@ -1441,8 +1453,10 @@ 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; } _