Date: Fri, 25 Jan 2008 13:17:54 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 134077 for review Message-ID: <200801251317.m0PDHs7C034896@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=134077 Change 134077 by jhb@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801251317.m0PDHs7C034896>