mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Mohr <andi@rhlx01.fht-esslingen.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH -mm 4/6] cpu_relax(): smpboot.c
Date: Wed, 21 Jun 2006 23:00:23 +0200	[thread overview]
Message-ID: <20060621210023.GD22516@rhlx01.fht-esslingen.de> (raw)


Add cpu_relax() to various smpboot.c init loops.


Kept mb() since it's said to be required in some postings.

Tested on 2.6.17-mm1.

Signed-off-by: Andreas Mohr <andi@lisas.de>


diff -urN linux-2.6.17-mm1.orig/arch/i386/kernel/smpboot.c linux-2.6.17-mm1.my/arch/i386/kernel/smpboot.c
--- linux-2.6.17-mm1.orig/arch/i386/kernel/smpboot.c	2006-06-21 14:28:15.000000000 +0200
+++ linux-2.6.17-mm1.my/arch/i386/kernel/smpboot.c	2006-06-21 14:43:24.000000000 +0200
@@ -251,8 +251,10 @@
 		/*
 		 * 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 @@
 		/*
 		 * 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 @@
 	 * 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
@@ -1446,8 +1458,10 @@
 	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;
 }
 

                 reply	other threads:[~2006-06-21 21:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060621210023.GD22516@rhlx01.fht-esslingen.de \
    --to=andi@rhlx01.fht-esslingen.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®