From owner-p4-projects@FreeBSD.ORG Thu Feb 14 20:53:53 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CB72216A498; Thu, 14 Feb 2008 20:53:53 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FF3A16A480 for ; Thu, 14 Feb 2008 20:53:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9200613C4E7 for ; Thu, 14 Feb 2008 20:53:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1EKrrf0032734 for ; Thu, 14 Feb 2008 20:53:53 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1EKrrdI032730 for perforce@freebsd.org; Thu, 14 Feb 2008 20:53:53 GMT (envelope-from jhb@freebsd.org) Date: Thu, 14 Feb 2008 20:53:53 GMT Message-Id: <200802142053.m1EKrrdI032730@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 135405 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2008 20:53:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=135405 Change 135405 by jhb@jhb_mutex on 2008/02/14 20:53:35 - Add 'show callouts' - add test case for pause issue. Affected files ... .. //depot/projects/smpng/sys/kern/kern_timeout.c#35 edit .. //depot/projects/smpng/sys/modules/crash/crash.c#50 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_timeout.c#35 (text+ko) ==== @@ -37,6 +37,8 @@ #include __FBSDID("$FreeBSD: src/sys/kern/kern_timeout.c,v 1.108 2007/11/22 12:15:54 attilio Exp $"); +#include "opt_ddb.h" + #include #include #include @@ -48,6 +50,10 @@ #include #include #include +#ifdef DDB +#include +#include +#endif static int avg_depth; SYSCTL_INT(_debug, OID_AUTO, to_avg_depth, CTLFLAG_RD, &avg_depth, 0, @@ -712,3 +718,71 @@ return; } #endif /* APM_FIXUP_CALLTODO */ + +#ifdef DDB +#if 0 +static void +db_print_ticks(int ticks) +{ + int h, m, s; + + s = ticks / hz; + m = s / 60; + h = m / 60; + + if (h > 0) + printf("%02d:", h); + else + printf(" "); + if (m > 0) + printf("%02d:", m % 60); + else + printf(" "); + if (s > 0) + printf("%02d.%-4d", s % 60, ticks % hz); + else + printf(" %4d", ticks); +} +#endif + +DB_SHOW_COMMAND(callouts, db_show_callouts) +{ + struct callout *c; + int bucket, callouts, sticks; + + /* First, count the number of callouts. */ + callouts = 0; + for (bucket = 0; bucket < callwheelsize; bucket++) { + TAILQ_FOREACH(c, &callwheel[bucket], c_links.tqe) { + callouts++; + } + } + + sticks = softticks; + do { + bucket = sticks & callwheelmask; + TAILQ_FOREACH(c, &callwheel[bucket], c_links.tqe) { + if (c->c_time < sticks) + continue; + if (c->c_time > sticks) + break; +#if 1 + db_printf("%9d ", c->c_time - softticks); +#else + db_print_ticks(c->c_time - softticks); + db_printf(" "); +#endif + db_printsym((db_expr_t)c->c_func, DB_STGY_PROC); + db_printf("(%p)", c->c_arg); + if (c->c_lock) + db_printf(" lock %p (%s)", c->c_lock, + c->c_lock->lo_name); + db_printf("\n"); + callouts--; + if (db_pager_quit) + return; + } + sticks++; + } while (callouts > 0); +} +#endif /* DDB */ ==== //depot/projects/smpng/sys/modules/crash/crash.c#50 (text+ko) ==== @@ -89,6 +89,15 @@ /* Events. */ +static void +pause_forever(void *dummy) +{ + + for (;;) + pause("foo", 1); +} +CRASH_EVENT("pause in an endless loop", pause_forever); + static int race_wchan; static void