From owner-p4-projects@FreeBSD.ORG Wed Jun 14 06:10:43 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C3CE016A47E; Wed, 14 Jun 2006 06:10:43 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 87D3E16A47A for ; Wed, 14 Jun 2006 06:10:43 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 88B4C43D46 for ; Wed, 14 Jun 2006 06:10:42 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5E68Kbx050392 for ; Wed, 14 Jun 2006 06:08:20 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5E68K0k050389 for perforce@freebsd.org; Wed, 14 Jun 2006 06:08:20 GMT (envelope-from jb@freebsd.org) Date: Wed, 14 Jun 2006 06:08:20 GMT Message-Id: <200606140608.k5E68K0k050389@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 99201 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: Wed, 14 Jun 2006 06:10:44 -0000 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 __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 +#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