From owner-svn-src-all@FreeBSD.ORG Tue Feb 9 22:15:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B8A7106566B; Tue, 9 Feb 2010 22:15:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5155C8FC08; Tue, 9 Feb 2010 22:15:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o19MFxw4097266; Tue, 9 Feb 2010 22:15:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o19MFxEu097264; Tue, 9 Feb 2010 22:15:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201002092215.o19MFxEu097264@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 9 Feb 2010 22:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203727 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Feb 2010 22:15:59 -0000 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 #include #include #include +#include #include #include #include @@ -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__); } /*