From owner-freebsd-hackers@FreeBSD.ORG Thu May 11 07:53:00 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAE0216A411; Thu, 11 May 2006 07:53:00 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id B044E43D45; Thu, 11 May 2006 07:52:55 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.14] (imini.samsco.home [192.168.254.14]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k4B7qsVv005752; Thu, 11 May 2006 01:52:54 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <4462ED55.10900@samsco.org> Date: Thu, 11 May 2006 01:52:53 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050416 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Benno Rice References: <4462D01D.1000500@FreeBSD.org> In-Reply-To: <4462D01D.1000500@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on pooker.samsco.org Cc: hackers@freebsd.org Subject: Re: RFC: Optionally verbose SYSINIT X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 May 2006 07:53:00 -0000 This would be awesome, please do it. Scott Benno Rice wrote: > One of the things that I found useful both in starting the PowerPC port > and in doing the XScale stuff I'm working on is making the SYSINIT stuff > done by mi_startup() verbose. This generally requires hacking your own > code into mi_startup() to print out which SYSINIT you're up to and the > like. jhb recently pointed me at this version he wrote which uses DDB > to look up the symbol corresponding to the SYSINIT in question which > makes it even more useful. > > I would like to commit this version, which I've made optional based on a > VERBOSE_SYSINIT option, so as to make it available to anyone else > further down the line who's porting to a new architecture. > > Comments? Questions? > > > ------------------------------------------------------------------------ > > Index: conf/options > =================================================================== > RCS file: /home/ncvs/src/sys/conf/options,v > retrieving revision 1.540 > diff -u -r1.540 options > --- conf/options 7 May 2006 18:12:17 -0000 1.540 > +++ conf/options 11 May 2006 05:34:26 -0000 > @@ -158,6 +158,7 @@ > TURNSTILE_PROFILING > TTYHOG opt_tty.h > VFS_AIO > +VERBOSE_SYSINIT opt_global.h > WLCACHE opt_wavelan.h > WLDEBUG opt_wavelan.h > > Index: kern/init_main.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/init_main.c,v > retrieving revision 1.262 > diff -u -r1.262 init_main.c > --- kern/init_main.c 7 Feb 2006 21:22:01 -0000 1.262 > +++ kern/init_main.c 11 May 2006 05:35:21 -0000 > @@ -84,6 +84,9 @@ > #include > #include > > +#include > +#include > + > void mi_startup(void); /* Should be elsewhere */ > > /* Components of the first process -- never freed. */ > @@ -169,6 +172,11 @@ > register struct sysinit **xipp; /* interior loop of sort*/ > register struct sysinit *save; /* bubble*/ > > +#if defined(VERBOSE_SYSINIT) > + int last; > + int verbose; > +#endif > + > if (sysinit == NULL) { > sysinit = SET_BEGIN(sysinit_set); > sysinit_end = SET_LIMIT(sysinit_set); > @@ -191,6 +199,14 @@ > } > } > > +#if defined(VERBOSE_SYSINIT) > + last = SI_SUB_COPYRIGHT; > + verbose = 0; > +#if !defined(DDB) > + printf("VERBOSE_SYSINIT: DDB not enabled, symbol lookups disabled.\n"); > +#endif > +#endif > + > /* > * Traverse the (now) ordered list of system initialization tasks. > * Perform each task, and continue on to the next task. > @@ -206,9 +222,38 @@ > if ((*sipp)->subsystem == SI_SUB_DONE) > continue; > > +#if defined(VERBOSE_SYSINIT) > + if ((*sipp)->subsystem > last) { > + verbose = 1; > + last = (*sipp)->subsystem; > + printf("subsystem %x\n", last); > + } > + if (verbose) { > +#if defined(DDB) > + const char *name; > + c_db_sym_t sym; > + db_expr_t offset; > + > + sym = db_search_symbol((vm_offset_t)(*sipp)->func, > + DB_STGY_PROC, &offset); > + db_symbol_values(sym, &name, NULL); > + if (name != NULL) > + printf(" %s(%p)... ", name, (*sipp)->udata); > + else > +#endif > + printf(" %p(%p)... ", (*sipp)->func, > + (*sipp)->udata); > + } > +#endif > + > /* Call function */ > (*((*sipp)->func))((*sipp)->udata); > > +#if defined(VERBOSE_SYSINIT) > + if (verbose) > + printf("done.\n"); > +#endif > + > /* Check off the one we're just done */ > (*sipp)->subsystem = SI_SUB_DONE; > > > > ------------------------------------------------------------------------ > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"