Commit 18698917 authored by Andreas Mohr's avatar Andreas Mohr Committed by Linus Torvalds

[PATCH] cpu_relax(): smpboot.c

Add cpu_relax() to various smpboot.c init loops.  cpu_relax() always implies a
barrier (according to Arjan), so remove those as well.
Signed-off-by: default avatarAndreas Mohr <andi@lisas.de>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e75eac33
...@@ -257,7 +257,7 @@ static void __init synchronize_tsc_bp (void) ...@@ -257,7 +257,7 @@ static void __init synchronize_tsc_bp (void)
* all APs synchronize but they loop on '== num_cpus' * 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)
mb(); cpu_relax();
atomic_set(&tsc_count_stop, 0); atomic_set(&tsc_count_stop, 0);
wmb(); wmb();
/* /*
...@@ -276,7 +276,7 @@ static void __init synchronize_tsc_bp (void) ...@@ -276,7 +276,7 @@ static void __init synchronize_tsc_bp (void)
* Wait for all APs to leave the synchronization point: * 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)
mb(); cpu_relax();
atomic_set(&tsc_count_start, 0); atomic_set(&tsc_count_start, 0);
wmb(); wmb();
atomic_inc(&tsc_count_stop); atomic_inc(&tsc_count_stop);
...@@ -333,19 +333,21 @@ static void __init synchronize_tsc_ap (void) ...@@ -333,19 +333,21 @@ static void __init synchronize_tsc_ap (void)
* this gets called, so we first wait for the BP to * this gets called, so we first wait for the BP to
* finish SMP initialization: * finish SMP initialization:
*/ */
while (!atomic_read(&tsc_start_flag)) mb(); while (!atomic_read(&tsc_start_flag))
cpu_relax();
for (i = 0; i < NR_LOOPS; i++) { for (i = 0; i < NR_LOOPS; i++) {
atomic_inc(&tsc_count_start); atomic_inc(&tsc_count_start);
while (atomic_read(&tsc_count_start) != num_booting_cpus()) while (atomic_read(&tsc_count_start) != num_booting_cpus())
mb(); cpu_relax();
rdtscll(tsc_values[smp_processor_id()]); rdtscll(tsc_values[smp_processor_id()]);
if (i == NR_LOOPS-1) if (i == NR_LOOPS-1)
write_tsc(0, 0); write_tsc(0, 0);
atomic_inc(&tsc_count_stop); 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();
} }
} }
#undef NR_LOOPS #undef NR_LOOPS
...@@ -1433,7 +1435,7 @@ int __devinit __cpu_up(unsigned int cpu) ...@@ -1433,7 +1435,7 @@ int __devinit __cpu_up(unsigned int cpu)
/* Unleash the CPU! */ /* Unleash the CPU! */
cpu_set(cpu, smp_commenced_mask); cpu_set(cpu, smp_commenced_mask);
while (!cpu_isset(cpu, cpu_online_map)) while (!cpu_isset(cpu, cpu_online_map))
mb(); cpu_relax();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment