Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2008 19:06:27 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 150719 for review
Message-ID:  <200809301906.m8UJ6RnA029376@repoman.freebsd.org>

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

Change 150719 by jhb@jhb_mutex on 2008/09/30 19:05:42

	Drop these diffs.  I think the critical section fixes this
	already.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_shutdown.c#72 edit

Differences ...

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

@@ -495,7 +495,7 @@
 }
 
 #ifdef SMP
-static volatile uintptr_t panic_thread;
+static u_int panic_cpu = NOCPU;
 #endif
 
 /*
@@ -510,23 +510,20 @@
 	int bootopt, newpanic;
 	va_list ap;
 	static char buf[256];
-#ifdef SMP
-	uintptr_t tid;
-#endif
 
 	critical_enter();
 #ifdef SMP
 	/*
 	 * We don't want multiple CPU's to panic at the same time, so we
-	 * use panic_thread as a simple spinlock.  We have to keep checking
-	 * panic_thread if we are spinning in case the panic on the first
+	 * use panic_cpu as a simple spinlock.  We have to keep checking
+	 * panic_cpu if we are spinning in case the panic on the first
 	 * CPU is canceled.
 	 */
-	tid = (uintptr_t)td;
-	if (panic_thread != tid)
-		while (atomic_cmpset_ptr(&panic_thread, 0, tid) == 0)
-			while (panic_thread != 0)
-				cpu_spinwait();
+	if (panic_cpu != PCPU_GET(cpuid))
+		while (atomic_cmpset_int(&panic_cpu, NOCPU,
+		    PCPU_GET(cpuid)) == 0)
+			while (panic_cpu != NOCPU)
+				; /* nothing */
 #endif
 
 	bootopt = RB_AUTOBOOT | RB_DUMP;
@@ -562,7 +559,7 @@
 	/* See if the user aborted the panic, in which case we continue. */
 	if (panicstr == NULL) {
 #ifdef SMP
-		atomic_store_rel_ptr(&panic_thread, 0);
+		atomic_store_rel_int(&panic_cpu, NOCPU);
 #endif
 		return;
 	}



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