PERFORCE change 134077 for review

John Baldwin jhb at FreeBSD.org
Fri Jan 25 05:17:55 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=134077

Change 134077 by jhb at jhb_zion on 2008/01/25 13:17:30

	Test for the TDF_INTERRUPT leakage that could result in early
	wakeups if a sleep timed out before the thread went to sleep.
	This could also happen prior to yesterday's fix if the timer
	fired during sleepq_catch_signals().

Affected files ...

.. //depot/projects/smpng/sys/modules/crash/crash.c#46 edit

Differences ...

==== //depot/projects/smpng/sys/modules/crash/crash.c#46 (text+ko) ====

@@ -138,9 +138,24 @@
 	printf("crash: sleepq_timedwait() returned %d\n", rval);
 	bintime_sub(&finish, &start);
 	bintime2timeval(&finish, &elapsed);
-	printf("crash: slept for %d.%04ld sec\n", (int)elapsed.tv_sec,
-	    elapsed.tv_usec / 1000);
+	printf("crash: slept for %d.%04ld sec (should be 2 sec)\n",
+	    (int)elapsed.tv_sec, elapsed.tv_usec / 1000);
 	callout_drain(&c);
+
+	/*
+	 * Test to see if we leaked TDF_INTERRUPT from the timeout
+	 * handler routine.  If so, this sleep will terminate
+	 * immediately with EWOULDBLOCK rather than waiting for the
+	 * timeout to fire.
+	 */
+	binuptime(&start);
+	ret = tsleep(&race_wchan, 0, "race", 5 * hz);
+	binuptime(&finish);
+	printf("crash: sleepq_timedwait() returned %d\n", rval);
+	bintime_sub(&finish, &start);
+	bintime2timeval(&finish, &elapsed);
+	printf("crash: slept for %d.%04ld sec (should be 5 sec)\n",
+	    (int)elapsed.tv_sec, elapsed.tv_usec / 1000);
 }
 CRASH_EVENT("exercise tsleep() race", exercise_tsleep_race);
 


More information about the p4-projects mailing list