Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2004 17:28:02 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 60154 for review
Message-ID:  <200408201728.i7KHS2hP031681@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=60154

Change 60154 by jhb@jhb_slimer on 2004/08/20 17:27:23

	Yay for cpu_spinwait() and fewer ugly #ifdefs!

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_shutdown.c#47 edit
.. //depot/projects/smpng/sys/kern/subr_smp.c#34 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_shutdown.c#47 (text+ko) ====

@@ -500,11 +500,8 @@
 	 */
 	if (panic_thread != curthread)
 		while (atomic_cmpset_ptr(&panic_thread, NULL, curthread) == 0)
-			while (panic_thread != NULL) {
-#ifdef __i386__
-				ia32_pause();
-#endif
-			}
+			while (panic_thread != NULL)
+				cpu_spinwait();
 #endif
 
 	bootopt = RB_AUTOBOOT | RB_DUMP;

==== //depot/projects/smpng/sys/kern/subr_smp.c#34 (text+ko) ====

@@ -229,9 +229,7 @@
 	i = 0;
 	while ((stopped_cpus & map) != map) {
 		/* spin */
-#ifdef __i386__
-		ia32_pause();
-#endif
+		cpu_spinwait();
 		i++;
 #ifdef DIAGNOSTIC
 		if (i == 100000) {
@@ -271,12 +269,9 @@
 	atomic_store_rel_int(&started_cpus, map);
 
 	/* wait for each to clear its bit */
-	while ((stopped_cpus & map) != 0) {
-#ifdef __i386__
-		ia32_pause();
-#endif
+	while ((stopped_cpus & map) != 0)
 		/* nothing */
-	}
+		cpu_spinwait();
 
 	return 1;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408201728.i7KHS2hP031681>