From owner-svn-src-all@FreeBSD.ORG Mon Feb 17 14:48:24 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9A121E4C; Mon, 17 Feb 2014 14:48:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 76B7A198C; Mon, 17 Feb 2014 14:48:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1HEmOba092898; Mon, 17 Feb 2014 14:48:24 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1HEmNNo092894; Mon, 17 Feb 2014 14:48:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201402171448.s1HEmNNo092894@svn.freebsd.org> From: Andriy Gapon Date: Mon, 17 Feb 2014 14:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r262059 - in stable/9/sys: cddl/compat/opensolaris/sys kern modules/zfs sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Mon, 17 Feb 2014 14:48:24 -0000 Author: avg Date: Mon Feb 17 14:48:23 2014 New Revision: 262059 URL: http://svnweb.freebsd.org/changeset/base/262059 Log: MFC r258625: sdt: add support for solaris/illumos style DTRACE_PROBE macros Note: in head KDTRACE_HOOKS is defined in opt_global.h and thus there is no need to explicitly include any header to check that option. In this branch we have to include opt_kdtrace.h and, so, this commit carries additional changes to accomodate for that difference. Sponsored by: HybridCluster Modified: stable/9/sys/cddl/compat/opensolaris/sys/sdt.h stable/9/sys/kern/kern_sdt.c stable/9/sys/modules/zfs/Makefile stable/9/sys/sys/sdt.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/cddl/compat/opensolaris/sys/sdt.h ============================================================================== --- stable/9/sys/cddl/compat/opensolaris/sys/sdt.h Mon Feb 17 14:47:52 2014 (r262058) +++ stable/9/sys/cddl/compat/opensolaris/sys/sdt.h Mon Feb 17 14:48:23 2014 (r262059) @@ -29,20 +29,11 @@ #ifndef _OPENSOLARIS_SYS_SDT_H_ #define _OPENSOLARIS_SYS_SDT_H_ +#ifdef _KERNEL +#include +#endif #include_next -#undef DTRACE_PROBE -#undef DTRACE_PROBE1 -#undef DTRACE_PROBE2 -#undef DTRACE_PROBE3 -#undef DTRACE_PROBE4 - -#define DTRACE_PROBE(name) -#define DTRACE_PROBE1(name, type1, arg1) -#define DTRACE_PROBE2(name, type1, arg1, type2, arg2) -#define DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3) -#define DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) - #define SET_ERROR(err) (err) #endif /* _OPENSOLARIS_SYS_SDT_H_ */ Modified: stable/9/sys/kern/kern_sdt.c ============================================================================== --- stable/9/sys/kern/kern_sdt.c Mon Feb 17 14:47:52 2014 (r262058) +++ stable/9/sys/kern/kern_sdt.c Mon Feb 17 14:48:23 2014 (r262059) @@ -31,6 +31,8 @@ #include #include +SDT_PROVIDER_DEFINE(sdt); + /* * Hook for the DTrace probe function. The SDT provider will set this to * dtrace_probe() when it loads. Modified: stable/9/sys/modules/zfs/Makefile ============================================================================== --- stable/9/sys/modules/zfs/Makefile Mon Feb 17 14:47:52 2014 (r262058) +++ stable/9/sys/modules/zfs/Makefile Mon Feb 17 14:48:23 2014 (r262059) @@ -4,6 +4,12 @@ KMOD= zfs SRCS= bus_if.h device_if.h vnode_if.h +.if !defined(KERNBUILDDIR) +SRCS+= opt_kdtrace.h +opt_kdtrace.h: + echo "" > ${.TARGET} +.endif + SUNW= ${.CURDIR}/../../cddl/contrib/opensolaris .PATH: ${SUNW}/common/acl Modified: stable/9/sys/sys/sdt.h ============================================================================== --- stable/9/sys/sys/sdt.h Mon Feb 17 14:47:52 2014 (r262058) +++ stable/9/sys/sys/sdt.h Mon Feb 17 14:48:23 2014 (r262059) @@ -126,6 +126,14 @@ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \ xarg6) +#define DTRACE_PROBE(name) +#define DTRACE_PROBE1(name, type0, arg0) +#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) +#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) +#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) +#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,\ + type4, arg4) + #else SET_DECLARE(sdt_providers_set, struct sdt_provider); @@ -313,6 +321,51 @@ SET_DECLARE(sdt_argtypes_set, struct sdt (uintptr_t)arg6); \ } while (0) +#define DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) do { \ + static SDT_PROBE_DEFINE(sdt, , , name); \ + SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4); +#define DTRACE_PROBE_IMPL_END } while (0) + +#define DTRACE_PROBE(name) \ + DTRACE_PROBE_IMPL_START(name, 0, 0, 0, 0, 0) \ + DTRACE_PROBE_IMPL_END + +#define DTRACE_PROBE1(name, type0, arg0) \ + DTRACE_PROBE_IMPL_START(name, arg0, 0, 0, 0, 0) \ + SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ + DTRACE_PROBE_IMPL_END + +#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) \ + DTRACE_PROBE_IMPL_START(name, arg0, arg1, 0, 0, 0) \ + SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ + DTRACE_PROBE_IMPL_END + +#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) \ + DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, 0, 0) \ + SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \ + DTRACE_PROBE_IMPL_END + +#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) \ + DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, 0) \ + SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \ + DTRACE_PROBE_IMPL_END + +#define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3, \ + type4, arg4) \ + DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4) \ + SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL); \ + SDT_PROBE_ARGTYPE(sdt, , , name, 4, #type4, NULL); \ + DTRACE_PROBE_IMPL_END + #endif /* KDTRACE_HOOKS */ /* @@ -365,6 +418,8 @@ struct sdt_provider { void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); +SDT_PROVIDER_DECLARE(sdt); + #endif /* _KERNEL */ #endif /* _SYS_SDT_H */