Date: Wed, 14 Jun 2006 06:08:20 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99201 for review Message-ID: <200606140608.k5E68K0k050389@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99201 Change 99201 by jb@jb_freebsd2 on 2006/06/14 06:07:22 Re-implement the DTrace vtime hook in a better place as pointer out by jhb@. Thanks. Affected files ... .. //depot/projects/dtrace/src/sys/kern/kern_switch.c#4 edit .. //depot/projects/dtrace/src/sys/kern/kern_synch.c#4 edit .. //depot/projects/dtrace/src/sys/kern/sched_4bsd.c#5 edit .. //depot/projects/dtrace/src/sys/kern/sched_ule.c#3 edit .. //depot/projects/dtrace/src/sys/sys/proc.h#7 edit Differences ... ==== //depot/projects/dtrace/src/sys/kern/kern_switch.c#4 (text+ko) ==== @@ -88,7 +88,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.121 2006/06/01 22:45:56 cognet Exp $"); -#include "opt_kdtrace.h" #include "opt_sched.h" #ifndef KERN_SWITCH_INCLUDE @@ -127,11 +126,6 @@ #define td_kse td_sched -#ifdef KDTRACE -int dtrace_vtime_active; -dtrace_vtime_switch_func_t dtrace_vtime_switch_func; -#endif - /* * kern.sched.preemption allows user space to determine if preemption support * is compiled in or not. It is not currently a boot or runtime flag that ==== //depot/projects/dtrace/src/sys/kern/kern_synch.c#4 (text+ko) ==== @@ -64,6 +64,11 @@ #include <machine/cpu.h> +#ifdef KDTRACE +int dtrace_vtime_active; +dtrace_vtime_switch_func_t dtrace_vtime_switch_func; +#endif + static void synch_setup(void *dummy); SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup, NULL) @@ -422,6 +427,17 @@ td, td->td_proc->p_comm, td->td_priority, td->td_inhibitors, td->td_wmesg, td->td_lockname); #endif + +#ifdef KDTRACE + /* + * If DTrace has set the active vtime enum to anything + * other than INACTIVE (0), then it should have set the + * function to call. + */ + if (dtrace_vtime_active) + (*dtrace_vtime_switch_func)(newtd); +#endif + sched_switch(td, newtd, flags); CTR3(KTR_SCHED, "mi_switch: running %p(%s) prio %d", td, td->td_proc->p_comm, td->td_priority); ==== //depot/projects/dtrace/src/sys/kern/sched_4bsd.c#5 (text+ko) ==== @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.81 2006/06/06 12:26:17 davidxu Exp $"); #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #define kse td_sched ==== //depot/projects/dtrace/src/sys/kern/sched_ule.c#3 (text+ko) ==== @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.162 2006/06/06 12:26:17 davidxu Exp $"); #include "opt_hwpmc_hooks.h" -#include "opt_kdtrace.h" #include "opt_sched.h" #define kse td_sched ==== //depot/projects/dtrace/src/sys/sys/proc.h#7 (text+ko) ==== @@ -489,12 +489,8 @@ extern int dtrace_vtime_active; extern dtrace_vtime_switch_func_t dtrace_vtime_switch_func; -#define TD_SET_RUNNING(td) if (dtrace_vtime_active) \ - (*dtrace_vtime_switch_func)(td); \ - (td)->td_state = TDS_RUNNING -#else +#endif #define TD_SET_RUNNING(td) (td)->td_state = TDS_RUNNING -#endif #define TD_SET_RUNQ(td) (td)->td_state = TDS_RUNQ #define TD_SET_CAN_RUN(td) (td)->td_state = TDS_CAN_RUN
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606140608.k5E68K0k050389>