Date: Tue, 9 Feb 2010 22:15:59 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r203727 - head/sys/net Message-ID: <201002092215.o19MFxEu097264@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Tue Feb 9 22:15:59 2010 New Revision: 203727 URL: http://svn.freebsd.org/changeset/base/203727 Log: Add an SDT provider for "vnet"s along with probes for vnet_alloc and vnet_destroy. Use the line number rather than NULL as dummy argument. Note: the fbt provider does not reliably provide :return probes (depending on optimization levels used at compile time) making it unusable for scripts to generate complete call-traces with well defined boundaries over allocations or destructions of virtual network stacks. Sponsored by: ISPsystem MFC After: 8 days Modified: head/sys/net/vnet.c Modified: head/sys/net/vnet.c ============================================================================== --- head/sys/net/vnet.c Tue Feb 9 22:05:30 2010 (r203726) +++ head/sys/net/vnet.c Tue Feb 9 22:15:59 2010 (r203727) @@ -38,11 +38,13 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_kdb.h" +#include "opt_kdtrace.h" #include <sys/param.h> #include <sys/kdb.h> #include <sys/kernel.h> #include <sys/jail.h> +#include <sys/sdt.h> #include <sys/systm.h> #include <sys/sysctl.h> #include <sys/linker_set.h> @@ -210,6 +212,13 @@ static TAILQ_HEAD(, vnet_data_free) vnet TAILQ_HEAD_INITIALIZER(vnet_data_free_head); static struct sx vnet_data_free_lock; +SDT_PROVIDER_DEFINE(vnet); +SDT_PROBE_DEFINE1(vnet, functions, vnet_alloc, entry, "int"); +SDT_PROBE_DEFINE2(vnet, functions, vnet_alloc, alloc, "int", "struct vnet *"); +SDT_PROBE_DEFINE2(vnet, functions, vnet_alloc, return, "int", "struct vnet *"); +SDT_PROBE_DEFINE2(vnet, functions, vnet_destroy, entry, "int", "struct vnet *"); +SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, return, "int"); + /* * Allocate a virtual network stack. */ @@ -218,8 +227,10 @@ vnet_alloc(void) { struct vnet *vnet; + SDT_PROBE1(vnet, functions, vnet_alloc, entry, __LINE__); vnet = malloc(sizeof(struct vnet), M_VNET, M_WAITOK | M_ZERO); vnet->vnet_magic_n = VNET_MAGIC_N; + SDT_PROBE2(vnet, functions, vnet_alloc, alloc, __LINE__, vnet); /* * Allocate storage for virtualized global variables and copy in @@ -244,6 +255,7 @@ vnet_alloc(void) LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le); VNET_LIST_WUNLOCK(); + SDT_PROBE2(vnet, functions, vnet_alloc, return, __LINE__, vnet); return (vnet); } @@ -255,6 +267,7 @@ vnet_destroy(struct vnet *vnet) { struct ifnet *ifp, *nifp; + SDT_PROBE2(vnet, functions, vnet_destroy, entry, __LINE__, vnet); KASSERT(vnet->vnet_sockcnt == 0, ("%s: vnet still has sockets", __func__)); @@ -281,6 +294,7 @@ vnet_destroy(struct vnet *vnet) vnet->vnet_data_base = 0; vnet->vnet_magic_n = 0xdeadbeef; free(vnet, M_VNET); + SDT_PROBE1(vnet, functions, vnet_destroy, return, __LINE__); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002092215.o19MFxEu097264>