Date: Sun, 14 Jan 2007 18:55:40 GMT From: Marko Zec <zec@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 112910 for review Message-ID: <200701141855.l0EIteT0055776@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=112910 Change 112910 by zec@zec_tca51 on 2007/01/14 18:54:54 In callout_reset() check whether the handle provided by the caller is already linked in somewhere in the callout wheel. If it is, panic. This check can be insanely expensive and shouldn't be compiled in under normal circumstances, but at the moment I need this for chasing ghosts... Affected files ... .. //depot/projects/vimage/src/sys/kern/kern_timeout.c#2 edit Differences ... ==== //depot/projects/vimage/src/sys/kern/kern_timeout.c#2 (text+ko) ==== @@ -37,6 +37,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.102 2006/10/11 14:57:03 glebius Exp $"); +#include "opt_vimage.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/callout.h> @@ -465,6 +467,23 @@ c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING); c->c_func = ftn; c->c_time = ticks + to_ticks; +#if (defined(VIMAGE) && defined(INVARIANTS)) + /* + * MARKO XXX + * + * I'm suspecting that some lockups might have been caused by + * a single callout handle being scheduled multiple times. + * This loop examines the entire callwhell before inserting a + * new handle, and if the handle is already linked in it panics. + */ + int callwheel_iter; + struct callout *c_iter; + for (callwheel_iter = 0; callwheel_iter <= callwheelmask; + callwheel_iter++) + TAILQ_FOREACH(c_iter, &callwheel[callwheel_iter], c_links.tqe) + if (c_iter == c) + panic("finally got you!"); +#endif TAILQ_INSERT_TAIL(&callwheel[c->c_time & callwheelmask], c, c_links.tqe); CTR5(KTR_CALLOUT, "%sscheduled %p func %p arg %p in %d",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701141855.l0EIteT0055776>