From 6689b404af0ff9a980306eadf2ce472509df3ee2 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 20 Jun 2003 08:07:15 +0000 Subject: Crude but efficient: #ifdef DIAGNOSTIC hold a mutex while calling callout's so that we hear about it if they sleep. --- sys/kern/kern_timeout.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/kern/kern_timeout.c') diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index d789476..be13f97 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -69,7 +69,9 @@ struct callout_list callfree; int callwheelsize, callwheelbits, callwheelmask; struct callout_tailq *callwheel; int softticks; /* Like ticks, but for softclock(). */ -struct mtx callout_lock; +#ifdef DIAGNOSTIC +struct mtx callout_lock, callout_dont_sleep; +#endif static struct callout *nextsoftcheck; /* Next callout to be checked. */ @@ -120,6 +122,9 @@ kern_timeout_callwheel_init(void) TAILQ_INIT(&callwheel[i]); } mtx_init(&callout_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); +#ifdef DIAGNOSTIC + mtx_init(&callout_dont_sleep, "callout_dont_sleep", NULL, MTX_DEF); +#endif } /* @@ -214,9 +219,11 @@ softclock(void *dummy) } #ifdef DIAGNOSTIC binuptime(&bt1); + mtx_lock(&callout_dont_sleep); #endif c_func(c_arg); #ifdef DIAGNOSTIC + mtx_unlock(&callout_dont_sleep); binuptime(&bt2); bintime_sub(&bt2, &bt1); if (bt2.frac > maxdt) { -- cgit v1.1