Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Dec 2012 13:07:04 -0700
From:      Scott Long <scott4long@yahoo.com>
To:        George V. Neville-Neil <gnn@FreeBSD.org>
Cc:        svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   Re: svn commit: r243989 - in stable/9: cddl/lib/libdtrace sys/kern sys/modules/dtrace sys/modules/dtrace/dtio sys/modules/dtrace/dtraceall sys/sys
Message-ID:  <12702B8F-645A-4F27-9A2B-63845EFB3DF1@yahoo.com>
In-Reply-To: <201212071906.qB7J6f3Y064043@svn.freebsd.org>
References:  <201212071906.qB7J6f3Y064043@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Publicly, I'll state that I don't think that devstat is the right place =
for these, and I was hoping to have some time to move them to a better =
place, or at least fix up the existing problems that are present.  This =
commit shouldn't be considered the final word the stability of this set =
of SDT probes.

Scott

On Dec 7, 2012, at 12:06 PM, George V. Neville-Neil <gnn@FreeBSD.org> =
wrote:

> Author: gnn
> Date: Fri Dec  7 19:06:40 2012
> New Revision: 243989
> URL: http://svnweb.freebsd.org/changeset/base/243989
>=20
> Log:
>  MFC: 238366, 240924
>=20
>  Initial commit of an I/O provider for DTrace on FreeBSD.
>=20
>   These probes are most useful when looking into the structures
>   they provide, which are listed in io.d.  For example:
>=20
>   dtrace -n 'io:kernel::start { printf("%d\n", args[0]->bio_bcount); =
}'
>=20
>   Note that the I/O systems in FreeBSD and Solaris/Illumos are =
sufficiently
>   different that there is not a 1:1 mapping from scripts that work
>   with one to the other.
>=20
>  This commit includes the fix so that our probes use "kernel"
>  instead of the Solaris specific "genunix"
>=20
> Added:
>  stable/9/cddl/lib/libdtrace/io.d
>     - copied, changed from r236628, head/cddl/lib/libdtrace/io.d
>  stable/9/sys/kern/dtio_kdtrace.c
>     - copied, changed from r238366, head/sys/kern/dtio_kdtrace.c
>  stable/9/sys/modules/dtrace/dtio/
>     - copied from r238366, head/sys/modules/dtrace/dtio/
> Modified:
>  stable/9/cddl/lib/libdtrace/Makefile
>  stable/9/sys/kern/subr_devstat.c
>  stable/9/sys/modules/dtrace/Makefile
>  stable/9/sys/modules/dtrace/dtraceall/dtraceall.c
>  stable/9/sys/sys/dtrace_bsd.h
> Directory Properties:
>  stable/9/cddl/lib/libdtrace/   (props changed)
>  stable/9/sys/   (props changed)
>  stable/9/sys/amd64/include/xen/   (props changed)
>  stable/9/sys/boot/   (props changed)
>  stable/9/sys/boot/i386/efi/   (props changed)
>  stable/9/sys/boot/ia64/efi/   (props changed)
>  stable/9/sys/boot/ia64/ski/   (props changed)
>  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
>  stable/9/sys/boot/powerpc/ofw/   (props changed)
>  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
>  stable/9/sys/conf/   (props changed)
>  stable/9/sys/contrib/dev/acpica/   (props changed)
>  stable/9/sys/contrib/octeon-sdk/   (props changed)
>  stable/9/sys/contrib/pf/   (props changed)
>  stable/9/sys/contrib/x86emu/   (props changed)
>  stable/9/sys/dev/   (props changed)
>  stable/9/sys/dev/e1000/   (props changed)
>  stable/9/sys/dev/isp/   (props changed)
>  stable/9/sys/dev/ixgbe/   (props changed)
>  stable/9/sys/dev/puc/   (props changed)
>  stable/9/sys/fs/   (props changed)
>  stable/9/sys/fs/ntfs/   (props changed)
>  stable/9/sys/modules/   (props changed)
>=20
> Modified: stable/9/cddl/lib/libdtrace/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- stable/9/cddl/lib/libdtrace/Makefile	Fri Dec  7 16:26:32 2012	=
(r243988)
> +++ stable/9/cddl/lib/libdtrace/Makefile	Fri Dec  7 19:06:40 2012	=
(r243989)
> @@ -46,6 +46,7 @@ SRCS=3D		dt_aggregate.c \
> 		dis_tables.c
>=20
> DSRCS=3D		errno.d			\
> +		io.d			\
> 		psinfo.d		\
> 		signal.d		\
> 		unistd.d
>=20
> Copied and modified: stable/9/cddl/lib/libdtrace/io.d (from r236628, =
head/cddl/lib/libdtrace/io.d)
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/cddl/lib/libdtrace/io.d	Tue Jun  5 18:58:05 2012	=
(r236628, copy source)
> +++ stable/9/cddl/lib/libdtrace/io.d	Fri Dec  7 19:06:40 2012	=
(r243989)
> @@ -27,114 +27,50 @@
>=20
> #pragma ident	"%Z%%M%	%I%	%E% SMI"
>=20
> -#pragma D depends_on module unix
> #pragma D depends_on provider io
>=20
> -inline int B_BUSY =3D B_BUSY;
> -#pragma D binding "1.0" B_BUSY
> -inline int B_DONE =3D 0x00000200;
> -#pragma D binding "1.0" B_DONE
> -inline int B_ERROR =3D B_ERROR;
> -#pragma D binding "1.0" B_ERROR
> -inline int B_PAGEIO =3D B_PAGEIO;
> -#pragma D binding "1.0" B_PAGEIO
> -inline int B_PHYS =3D B_PHYS;
> -#pragma D binding "1.0" B_PHYS
> -inline int B_READ =3D B_READ;
> -#pragma D binding "1.0" B_READ
> -inline int B_WRITE =3D B_WRITE;
> -#pragma D binding "1.0" B_WRITE
> -inline int B_ASYNC =3D 0x00000004;
> -#pragma D binding "1.0" B_ASYNC
> -
> -typedef struct bufinfo {
> -	int b_flags;			/* buffer status */
> -	size_t b_bcount;		/* number of bytes */
> -	caddr_t b_addr;			/* buffer address */
> -	uint64_t b_lblkno;		/* block # on device */
> -	uint64_t b_blkno;		/* expanded block # on device */
> -	size_t b_resid;			/* # of bytes not transferred */
> -	size_t b_bufsize;		/* size of allocated buffer */
> -	caddr_t b_iodone;		/* I/O completion routine */
> -	int b_error;			/* expanded error field */
> -	dev_t b_edev;			/* extended device */
> -} bufinfo_t;
> -
> -#pragma D binding "1.0" translator
> -translator bufinfo_t < struct buf *B > {
> -	b_flags =3D B->b_flags;
> -	b_addr =3D B->b_un.b_addr;
> -	b_bcount =3D B->b_bcount;
> -	b_lblkno =3D B->_b_blkno._f;
> -	b_blkno =3D sizeof (long) =3D=3D 8 ? B->_b_blkno._f : =
B->_b_blkno._p._l;
> -	b_resid =3D B->b_resid;
> -	b_bufsize =3D B->b_bufsize;
> -	b_iodone =3D (caddr_t)B->b_iodone;
> -	b_error =3D B->b_error;
> -	b_edev =3D B->b_edev;
> -};=20
> -
> typedef struct devinfo {
> -	int dev_major;			/* major number */
> -	int dev_minor;			/* minor number */
> -	int dev_instance;		/* instance number */
> -	string dev_name;		/* name of device */
> -	string dev_statname;		/* name of device + =
instance/minor */
> -	string dev_pathname;		/* pathname of device */
> +        int dev_major;                  /* major number */
> +        int dev_minor;                  /* minor number */
> +        int dev_instance;               /* instance number */
> +        string dev_name;                /* name of device */
> +        string dev_statname;            /* name of device + =
instance/minor */
> +        string dev_pathname;            /* pathname of device */
> } devinfo_t;
>=20
> #pragma D binding "1.0" translator
> -translator devinfo_t < struct buf *B > {
> -	dev_major =3D B->b_dip !=3D NULL ? getmajor(B->b_edev) :
> -	    getmajor(B->b_file->v_vfsp->vfs_dev);
> -	dev_minor =3D B->b_dip !=3D NULL ? getminor(B->b_edev) :
> -	    getminor(B->b_file->v_vfsp->vfs_dev);
> -	dev_instance =3D B->b_dip =3D=3D NULL ?=20
> -	    getminor(B->b_file->v_vfsp->vfs_dev) :
> -	    ((struct dev_info *)B->b_dip)->devi_instance;
> -	dev_name =3D B->b_dip =3D=3D NULL ? "nfs" :
> -	    stringof(`devnamesp[getmajor(B->b_edev)].dn_name);
> -	dev_statname =3D strjoin(B->b_dip =3D=3D NULL ? "nfs" :
> -	    stringof(`devnamesp[getmajor(B->b_edev)].dn_name),
> -	    lltostr(B->b_dip =3D=3D NULL ? =
getminor(B->b_file->v_vfsp->vfs_dev) :
> -	    ((struct dev_info *)B->b_dip)->devi_instance =3D=3D 0 &&
> -	    ((struct dev_info *)B->b_dip)->devi_parent !=3D NULL &&
> -	    ((struct dev_info *)B->b_dip)->devi_parent->devi_node_name =
=3D=3D
> -	    "pseudo" ? getminor(B->b_edev) :
> -	    ((struct dev_info *)B->b_dip)->devi_instance));
> -	dev_pathname =3D B->b_dip =3D=3D NULL ? "<nfs>" :
> -	    ddi_pathname(B->b_dip, getminor(B->b_edev));
> +translator devinfo_t < struct devstat *D > {
> +           dev_major =3D D->device_number;
> +           dev_minor =3D D->unit_number;
> +           dev_instance =3D 0;
> +           dev_name =3D stringof(D->device_name);
> +           dev_statname =3D stringof(D->device_name);
> +           dev_pathname =3D stringof(D->device_name);
> };
>=20
> -typedef struct fileinfo {
> -	string fi_name;			/* name (basename of =
fi_pathname) */
> -	string fi_dirname;		/* directory (dirname of =
fi_pathname) */
> -	string fi_pathname;		/* full pathname */
> -	offset_t fi_offset;		/* offset within file */
> -	string fi_fs;			/* filesystem */
> -	string fi_mount;		/* mount point of file system */
> -	int fi_oflags;			/* open(2) flags for file =
descriptor */
> -} fileinfo_t;
> +typedef struct bufinfo {
> +        int b_flags;                    /* flags */
> +        long b_bcount;                /* number of bytes */
> +        caddr_t b_addr;                 /* buffer address */
> +        uint64_t b_blkno;               /* expanded block # on device =
*/
> +        uint64_t b_lblkno;              /* block # on device */
> +        size_t b_resid;                 /* # of bytes not transferred =
*/
> +        size_t b_bufsize;               /* size of allocated buffer =
*/
> +/*        caddr_t b_iodone;              I/O completion routine */
> +        int b_error;                    /* expanded error field */
> +/*        dev_t b_edev;                  extended device */
> +} bufinfo_t;
>=20
> #pragma D binding "1.0" translator
> -translator fileinfo_t < struct buf *B > {
> -	fi_name =3D B->b_file =3D=3D NULL ? "<none>" :
> -	    B->b_file->v_path =3D=3D NULL ? "<unknown>" :
> -	    basename(cleanpath(B->b_file->v_path));
> -	fi_dirname =3D B->b_file =3D=3D NULL ? "<none>" :
> -	    B->b_file->v_path =3D=3D NULL ? "<unknown>" :
> -	    dirname(cleanpath(B->b_file->v_path));
> -	fi_pathname =3D B->b_file =3D=3D NULL ? "<none>" :
> -	    B->b_file->v_path =3D=3D NULL ? "<unknown>" :
> -	    cleanpath(B->b_file->v_path);
> -	fi_offset =3D B->b_offset;
> -	fi_fs =3D B->b_file =3D=3D NULL ? "<none>" :
> -	    stringof(B->b_file->v_op->vnop_name);
> -	fi_mount =3D B->b_file =3D=3D NULL ? "<none>" :
> -	    B->b_file->v_vfsp->vfs_vnodecovered =3D=3D NULL ? "/" :
> -	    B->b_file->v_vfsp->vfs_vnodecovered->v_path =3D=3D NULL ? =
"<unknown>" :
> -	    cleanpath(B->b_file->v_vfsp->vfs_vnodecovered->v_path);
> -	fi_oflags =3D 0;
> +translator bufinfo_t < struct bio *B > {
> +           b_flags =3D B->bio_flags;
> +           b_bcount =3D B->bio_bcount;
> +           b_addr =3D B->bio_data;
> +           b_blkno =3D 0;
> +           b_lblkno =3D 0;
> +           b_resid =3D B->bio_resid;
> +           b_bufsize =3D 0; /* XXX gnn */
> +           b_error =3D B->bio_error;
> };
>=20
> /*
> @@ -158,63 +94,17 @@ inline int O_APPEND =3D 0x0008;
> #pragma D binding "1.1" O_APPEND
> inline int O_CREAT =3D 0x0200;
> #pragma D binding "1.1" O_CREAT
> -inline int O_DSYNC =3D O_DSYNC;
> -#pragma D binding "1.1" O_DSYNC
> inline int O_EXCL =3D 0x0800;
> #pragma D binding "1.1" O_EXCL
> -inline int O_LARGEFILE =3D O_LARGEFILE;
> -#pragma D binding "1.1" O_LARGEFILE
> inline int O_NOCTTY =3D 0x8000;
> #pragma D binding "1.1" O_NOCTTY
> inline int O_NONBLOCK =3D 0x0004;
> #pragma D binding "1.1" O_NONBLOCK
> inline int O_NDELAY =3D 0x0004;
> #pragma D binding "1.1" O_NDELAY
> -inline int O_RSYNC =3D O_RSYNC;
> -#pragma D binding "1.1" O_RSYNC
> inline int O_SYNC =3D 0x0080;
> #pragma D binding "1.1" O_SYNC
> inline int O_TRUNC =3D 0x0400;
> #pragma D binding "1.1" O_TRUNC
> -inline int O_XATTR =3D O_XATTR;
> -#pragma D binding "1.1" O_XATTR
>=20
> -#pragma D binding "1.1" translator
> -translator fileinfo_t < struct file *F > {
> -	fi_name =3D F =3D=3D NULL ? "<none>" :
> -	    F->f_vnode->v_path =3D=3D NULL ? "<unknown>" :
> -	    basename(cleanpath(F->f_vnode->v_path));
> -	fi_dirname =3D F =3D=3D NULL ? "<none>" :
> -	    F->f_vnode->v_path =3D=3D NULL ? "<unknown>" :
> -	    dirname(cleanpath(F->f_vnode->v_path));
> -	fi_pathname =3D F =3D=3D NULL ? "<none>" :
> -	    F->f_vnode->v_path =3D=3D NULL ? "<unknown>" :
> -	    cleanpath(F->f_vnode->v_path);
> -	fi_offset =3D F =3D=3D NULL ? 0 : F->f_offset;
> -	fi_fs =3D F =3D=3D NULL ? "<none>" : =
stringof(F->f_vnode->v_op->vnop_name);
> -	fi_mount =3D F =3D=3D NULL ? "<none>" :
> -	    F->f_vnode->v_vfsp->vfs_vnodecovered =3D=3D NULL ? "/" :
> -	    F->f_vnode->v_vfsp->vfs_vnodecovered->v_path =3D=3D NULL ? =
"<unknown>" :
> -	    cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path);
> -	fi_oflags =3D F =3D=3D NULL ? 0 : F->f_flag + (int)FOPEN;
> -};
>=20
> -inline fileinfo_t fds[int fd] =3D xlate <fileinfo_t> (
> -    fd >=3D 0 && fd < curthread->t_procp->p_user.u_finfo.fi_nfiles ?
> -    curthread->t_procp->p_user.u_finfo.fi_list[fd].uf_file : NULL);
> -
> -#pragma D attributes Stable/Stable/Common fds
> -#pragma D binding "1.1" fds
> -
> -#pragma D binding "1.2" translator
> -translator fileinfo_t < struct vnode *V > {
> -	fi_name =3D V->v_path =3D=3D NULL ? "<unknown>" :
> -	    basename(cleanpath(V->v_path));
> -	fi_dirname =3D V->v_path =3D=3D NULL ? "<unknown>" :
> -	    dirname(cleanpath(V->v_path));
> -	fi_pathname =3D V->v_path =3D=3D NULL ? "<unknown>" : =
cleanpath(V->v_path);
> -	fi_fs =3D stringof(V->v_op->vnop_name);
> -	fi_mount =3D V->v_vfsp->vfs_vnodecovered =3D=3D NULL ? "/" :
> -	    V->v_vfsp->vfs_vnodecovered->v_path =3D=3D NULL ? =
"<unknown>" :
> -	    cleanpath(V->v_vfsp->vfs_vnodecovered->v_path);
> -};
>=20
> Copied and modified: stable/9/sys/kern/dtio_kdtrace.c (from r238366, =
head/sys/kern/dtio_kdtrace.c)
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/kern/dtio_kdtrace.c	Wed Jul 11 16:27:02 2012	=
(r238366, copy source)
> +++ stable/9/sys/kern/dtio_kdtrace.c	Fri Dec  7 19:06:40 2012	=
(r243989)
> @@ -56,7 +56,7 @@ static dtrace_pattr_t dtio_attr =3D {
> { DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, =
DTRACE_CLASS_COMMON },
> };
>=20
> -static char    *genunix =3D "genunix";
> +static char    *kernel =3D "kernel";
>=20
> /*
>  * Name strings.
> @@ -113,25 +113,25 @@ dtio_provide(void *arg, dtrace_probedesc
> 	if (desc !=3D NULL)
> 		return;
>=20
> -	if (dtrace_probe_lookup(dtio_id, genunix, NULL,=20
> +	if (dtrace_probe_lookup(dtio_id, kernel, NULL,=20
> 				dtio_start_str) =3D=3D 0) {
> -		dtio_start_id =3D dtrace_probe_create(dtio_id, genunix, =
NULL,=20
> +		dtio_start_id =3D dtrace_probe_create(dtio_id, kernel, =
NULL,=20
> 						   dtio_start_str, 0, =
NULL);
> 	}
> -	if (dtrace_probe_lookup(dtio_id, genunix, NULL, dtio_done_str) =
=3D=3D 0) {
> -		dtio_done_id =3D dtrace_probe_create(dtio_id, genunix, =
NULL,=20
> +	if (dtrace_probe_lookup(dtio_id, kernel, NULL, dtio_done_str) =3D=3D=
 0) {
> +		dtio_done_id =3D dtrace_probe_create(dtio_id, kernel, =
NULL,=20
> 						   dtio_done_str, 0, =
NULL);
> 	}
> -	if (dtrace_probe_lookup(dtio_id, genunix, NULL,=20
> +	if (dtrace_probe_lookup(dtio_id, kernel, NULL,=20
> 				dtio_wait_start_str) =3D=3D 0) {
> -		dtio_wait_start_id =3D dtrace_probe_create(dtio_id, =
genunix,=20
> +		dtio_wait_start_id =3D dtrace_probe_create(dtio_id, =
kernel,=20
> 							 NULL,=20
> 							 =
dtio_wait_start_str,=20
> 							 0, NULL);
> 	}
> -	if (dtrace_probe_lookup(dtio_id, genunix, NULL,=20
> +	if (dtrace_probe_lookup(dtio_id, kernel, NULL,=20
> 				dtio_wait_done_str) =3D=3D 0) {
> -		dtio_wait_done_id =3D dtrace_probe_create(dtio_id, =
genunix, NULL,=20
> +		dtio_wait_done_id =3D dtrace_probe_create(dtio_id, =
kernel, NULL,=20
> 						   dtio_wait_done_str, =
0, NULL);
> 	}
>=20
>=20
> Modified: stable/9/sys/kern/subr_devstat.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- stable/9/sys/kern/subr_devstat.c	Fri Dec  7 16:26:32 2012	=
(r243988)
> +++ stable/9/sys/kern/subr_devstat.c	Fri Dec  7 19:06:40 2012	=
(r243989)
> @@ -29,6 +29,8 @@
> #include <sys/cdefs.h>
> __FBSDID("$FreeBSD$");
>=20
> +#include "opt_kdtrace.h"
> +
> #include <sys/param.h>
> #include <sys/kernel.h>
> #include <sys/systm.h>
> @@ -44,6 +46,54 @@ __FBSDID("$FreeBSD$");
>=20
> #include <machine/atomic.h>
>=20
> +#ifdef KDTRACE_HOOKS
> +#include <sys/dtrace_bsd.h>
> +
> +dtrace_io_start_probe_func_t dtrace_io_start_probe;
> +dtrace_io_done_probe_func_t dtrace_io_done_probe;
> +dtrace_io_wait_start_probe_func_t dtrace_io_wait_start_probe;
> +dtrace_io_wait_done_probe_func_t dtrace_io_wait_done_probe;
> +
> +uint32_t	dtio_start_id;
> +uint32_t	dtio_done_id;
> +uint32_t	dtio_wait_start_id;
> +uint32_t	dtio_wait_done_id;
> +
> +#define DTRACE_DEVSTAT_START() \
> +	if (dtrace_io_start_probe !=3D NULL) \
> +		(*dtrace_io_start_probe)(dtio_start_id, NULL, ds);
> +
> +#define DTRACE_DEVSTAT_BIO_START() \
> +	if (dtrace_io_start_probe !=3D NULL) \
> +		(*dtrace_io_start_probe)(dtio_start_id, bp, ds);
> +
> +#define DTRACE_DEVSTAT_DONE() \
> +	if (dtrace_io_done_probe !=3D NULL) \
> +		(*dtrace_io_done_probe)(dtio_done_id, NULL, ds);
> +
> +#define DTRACE_DEVSTAT_BIO_DONE() \
> +	if (dtrace_io_done_probe !=3D NULL) \
> +		(*dtrace_io_done_probe)(dtio_done_id, bp, ds);
> +
> +#define DTRACE_DEVSTAT_WAIT_START() \
> +	if (dtrace_io_wait_start_probe !=3D NULL) \
> +		(*dtrace_io_wait_start_probe)(dtio_wait_start_id, NULL, =
ds);
> +
> +#define DTRACE_DEVSTAT_WAIT_DONE() \
> +	if (dtrace_io_wait_done_probe !=3D NULL) \
> +		(*dtrace_io_wait_done_probe)(dtio_wait_done_id, NULL, =
ds);
> +
> +#else /* ! KDTRACE_HOOKS */
> +
> +#define DTRACE_DEVSTAT_START()
> +
> +#define DTRACE_DEVSTAT_DONE()
> +
> +#define DTRACE_DEVSTAT_WAIT_START()
> +
> +#define DTRACE_DEVSTAT_WAIT_DONE()
> +#endif /* KDTRACE_HOOKS */
> +
> static int devstat_num_devs;
> static long devstat_generation =3D 1;
> static int devstat_version =3D DEVSTAT_VERSION;
> @@ -227,6 +277,7 @@ devstat_start_transaction(struct devstat
> 	}
> 	ds->start_count++;
> 	atomic_add_rel_int(&ds->sequence0, 1);
> +	DTRACE_DEVSTAT_START();
> }
>=20
> void
> @@ -241,6 +292,7 @@ devstat_start_transaction_bio(struct dev
>=20
> 	binuptime(&bp->bio_t0);
> 	devstat_start_transaction(ds, &bp->bio_t0);
> +	DTRACE_DEVSTAT_BIO_START();
> }
>=20
> /*
> @@ -312,6 +364,7 @@ devstat_end_transaction(struct devstat *
>=20
> 	ds->end_count++;
> 	atomic_add_rel_int(&ds->sequence0, 1);
> +	DTRACE_DEVSTAT_DONE();
> }
>=20
> void
> @@ -334,6 +387,7 @@ devstat_end_transaction_bio(struct devst
>=20
> 	devstat_end_transaction(ds, bp->bio_bcount - bp->bio_resid,
> 				DEVSTAT_TAG_SIMPLE, flg, NULL, =
&bp->bio_t0);
> +	DTRACE_DEVSTAT_BIO_DONE();
> }
>=20
> /*
>=20
> Modified: stable/9/sys/modules/dtrace/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- stable/9/sys/modules/dtrace/Makefile	Fri Dec  7 16:26:32 2012	=
(r243988)
> +++ stable/9/sys/modules/dtrace/Makefile	Fri Dec  7 19:06:40 2012	=
(r243989)
> @@ -11,6 +11,7 @@ SUBDIR=3D		dtmalloc	\
> 		dtrace_test	\
> 		lockstat	\
> 		profile		\
> +		dtio		\
> 		prototype	\
> 		sdt		\
> 		systrace
>=20
> Modified: stable/9/sys/modules/dtrace/dtraceall/dtraceall.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- stable/9/sys/modules/dtrace/dtraceall/dtraceall.c	Fri Dec  7 =
16:26:32 2012	(r243988)
> +++ stable/9/sys/modules/dtrace/dtraceall/dtraceall.c	Fri Dec  7 =
19:06:40 2012	(r243989)
> @@ -65,6 +65,7 @@ MODULE_VERSION(dtraceall, 1);
> MODULE_DEPEND(dtraceall, cyclic, 1, 1, 1);
> MODULE_DEPEND(dtraceall, opensolaris, 1, 1, 1);
> MODULE_DEPEND(dtraceall, dtrace, 1, 1, 1);
> +MODULE_DEPEND(dtraceall, dtio, 1, 1, 1);
> MODULE_DEPEND(dtraceall, dtmalloc, 1, 1, 1);
> MODULE_DEPEND(dtraceall, dtnfscl, 1, 1, 1);
> MODULE_DEPEND(dtraceall, dtnfsclient, 1, 1, 1);
>=20
> Modified: stable/9/sys/sys/dtrace_bsd.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- stable/9/sys/sys/dtrace_bsd.h	Fri Dec  7 16:26:32 2012	=
(r243988)
> +++ stable/9/sys/sys/dtrace_bsd.h	Fri Dec  7 19:06:40 2012	=
(r243989)
> @@ -38,6 +38,8 @@ struct thread;
> struct vattr;
> struct vnode;
> struct reg;
> +struct devstat;
> +struct bio;
>=20
> /*
>  * Cyclic clock function type definition used to hook the cyclic
> @@ -168,6 +170,23 @@ extern dtrace_nfsclient_nfs23_done_probe
> extern dtrace_nfsclient_nfs23_done_probe_func_t
>     dtrace_nfscl_nfs234_done_probe;
>=20
> +/* IO Provider hooks, really hook into devstat */
> +typedef void (*dtrace_io_start_probe_func_t)(uint32_t, struct bio *,
> +					     struct devstat *);
> +extern dtrace_io_start_probe_func_t dtrace_io_start_probe;
> +
> +typedef void (*dtrace_io_done_probe_func_t)(uint32_t, struct bio *,
> +					    struct devstat *);
> +extern dtrace_io_done_probe_func_t dtrace_io_done_probe;
> +
> +typedef void (*dtrace_io_wait_start_probe_func_t)(uint32_t, uintptr_t =
*,=20
> +						  struct devstat *);
> +extern dtrace_io_wait_start_probe_func_t dtrace_io_wait_start_probe;
> +
> +typedef void (*dtrace_io_wait_done_probe_func_t)(uint32_t, uintptr_t =
*,=20
> +						 struct devstat *);
> +extern dtrace_io_wait_done_probe_func_t dtrace_io_wait_done_probe;
> +
> /*
>  * Functions which allow the dtrace module to check that the kernel=20
>  * hooks have been compiled with sufficient space for it's private




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?12702B8F-645A-4F27-9A2B-63845EFB3DF1>