Date: Mon, 26 Jun 2006 06:08:07 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 100033 for review Message-ID: <200606260608.k5Q687vH022951@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100033 Change 100033 by jb@jb_freebsd2 on 2006/06/26 06:07:40 Move the anonymous enabling into a separate system initialisation function with it's own level. This allows all providers to be initialised before the anonymous stuff happens. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_anon.c#5 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_anon.c#5 (text+ko) ==== @@ -2,6 +2,64 @@ /* * DTrace Anonymous Enabling Functions */ +static void +dtrace_anon_init(void *dummy) +{ + dtrace_state_t *state = NULL; + dtrace_enabling_t *enab; + + mutex_enter(&cpu_lock); + mutex_enter(&dtrace_provider_lock); + mutex_enter(&dtrace_lock); + + dtrace_anon_property(); + + mutex_exit(&cpu_lock); + + /* + * If there are already providers, we must ask them to provide their + * probes, and then match any anonymous enabling against them. Note + * that there should be no other retained enablings at this time: + * the only retained enablings at this time should be the anonymous + * enabling. + */ + if (dtrace_anon.dta_enabling != NULL) { + ASSERT(dtrace_retained == dtrace_anon.dta_enabling); + + dtrace_enabling_provide(NULL); + state = dtrace_anon.dta_state; + + /* + * We couldn't hold cpu_lock across the above call to + * dtrace_enabling_provide(), but we must hold it to actually + * enable the probes. We have to drop all of our locks, pick + * up cpu_lock, and regain our locks before matching the + * retained anonymous enabling. + */ + mutex_exit(&dtrace_lock); + mutex_exit(&dtrace_provider_lock); + + mutex_enter(&cpu_lock); + mutex_enter(&dtrace_provider_lock); + mutex_enter(&dtrace_lock); + + if ((enab = dtrace_anon.dta_enabling) != NULL) + (void) dtrace_enabling_match(enab, NULL); + + mutex_exit(&cpu_lock); + } + + mutex_exit(&dtrace_provider_lock); + mutex_exit(&dtrace_lock); + + if (state != NULL) { + /* + * If we created any anonymous state, set it going now. + */ + (void) dtrace_state_go(state, &dtrace_anon.dta_beganon); + } +} + static dtrace_state_t * dtrace_anon_grab(void) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606260608.k5Q687vH022951>