From owner-freebsd-dtrace@FreeBSD.ORG Thu May 30 06:02:05 2013 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F21F13B3 for ; Thu, 30 May 2013 06:02:05 +0000 (UTC) (envelope-from adam.leventhal@delphix.com) Received: from mail-ob0-x234.google.com (mail-ob0-x234.google.com [IPv6:2607:f8b0:4003:c01::234]) by mx1.freebsd.org (Postfix) with ESMTP id BDF16DF for ; Thu, 30 May 2013 06:02:05 +0000 (UTC) Received: by mail-ob0-f180.google.com with SMTP id eh20so3951716obb.25 for ; Wed, 29 May 2013 23:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphix.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KCiV/AfqCH6TmcNVMUZ/TPN3KRrz/dVZXJKWUqEzKT8=; b=GhDM+ja62zdYtAUUUw3CdxLBxB4OJhq5PbT/TPVcsHbjFW5dfiUOokgm27Dn97dQz6 OMNskQn/npqQH+JIN1aTokDhcuul32fWGs4j54WjlTYN9uRGgRPq7gyzJeE3l/J4ilMh LXBH8ShsxJYb01wC9iQGNRdtobzlbpQ0ccIBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=KCiV/AfqCH6TmcNVMUZ/TPN3KRrz/dVZXJKWUqEzKT8=; b=JC7VG4fUW/NGxEaDW7aWmWsEXnTlOHraIz1M1d+HNdbiI6RpPIbZp2GCOLpiEfhfuD MmjnWfndn8jaNPRxBzvUostmSk6tfUzOYDQxS8DIyxIwiGSs4Cquyk/eSz4IIjEIBQ2i 6a1RjTh02i1WwW0EgkF3wxvoI1xBz6Mg3/osAP1yjx9carg+AuMYnAfMJN9PvSqF6xbv bInk6hoEmMccankwCCR64JuPLDftJ1WEBu6xI4B1+P2EB+u1IWeKXfxWonlduOYlJvLZ Mf3dJPlKSlqxaesLLbGBlA9BjkUkD7N/sIVwmDDjRcb0ZW8Ok3VuKBwO2CG11sz4Xnxs i9yA== MIME-Version: 1.0 X-Received: by 10.60.98.173 with SMTP id ej13mr3561361oeb.72.1369893725377; Wed, 29 May 2013 23:02:05 -0700 (PDT) Received: by 10.76.168.34 with HTTP; Wed, 29 May 2013 23:02:05 -0700 (PDT) In-Reply-To: <20130530040705.GA40320@gloom> References: <20130530040705.GA40320@gloom> Date: Wed, 29 May 2013 23:02:05 -0700 Message-ID: Subject: Re: adding SDT probe functions with 6+ DTrace arguments From: Adam Leventhal To: Mark Johnston Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQnqb4lnIk0fmlF3qDkxbVGACTx4rEP04MzrsB6+EJhvIyj9dadSwY2MLnYeCiedKB5wD2KA Cc: rstone@freebsd.org, freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 May 2013 06:02:06 -0000 Hey Mark, I'm just now familiarizing myself with the way that FreeBSD DTrace handles SDT probes, but certainly having more arguments (as needed) makes sense, and the approach you've taken seems in keeping with the existing methodology. Adam On Wed, May 29, 2013 at 9:07 PM, Mark Johnston wrote: > Hello, > > Does anyone have objections or comments on the patch below? It simply > makes it possible to use the SDT_* macros to implement DTrace probes > with more than 5 arguments. dtrace_probe() only takes 5 arguments, so > some ugly casting is needed, but it works properly in my testing on > amd64. In fact, there are a couple of bugs in the way that DTrace > fetches the 6th argument (or the 7th, and so on) from the probe site, > but I'll be fixing that soon as well, along with the test case that's > supposed to detect this problem in the first place. > > I don't know of any existing SDT providers in FreeBSD that would use > these macros, but the ip, iscsi and tcp providers will - hence my > interest in making sure that this functionality works properly. > > Thanks! > -Mark > > diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h > index 522e1f2..21edd53 100644 > --- a/sys/sys/sdt.h > +++ b/sys/sys/sdt.h > @@ -91,6 +91,10 @@ > #define SDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2) > #define SDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3) > #define SDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4) > +#define SDT_PROBE_DEFINE6(prov, mod, func, name, snamp, arg0, arg1, arg2, \ > + arg3, arg4, arg5) > +#define SDT_PROBE_DEFINE7(prov, mod, func, name, snamp, arg0, arg1, arg2, \ > + arg3, arg4, arg5, arg6) > > #define SDT_PROBE0(prov, mod, func, name) > #define SDT_PROBE1(prov, mod, func, name, arg0) > @@ -98,6 +102,9 @@ > #define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2) > #define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3) > #define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) > +#define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) > +#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \ > + arg6) > > #else > > @@ -233,6 +240,27 @@ struct sdt_provider { > SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \ > SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4) > > +#define SDT_PROBE_DEFINE6(prov, mod, func, name, sname, arg0, arg1, arg2, arg3,\ > + arg4, arg5) \ > + SDT_PROBE_DEFINE(prov, mod, func, name, sname); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5); > + > +#define SDT_PROBE_DEFINE7(prov, mod, func, name, sname, arg0, arg1, arg2, arg3,\ > + arg4, arg5, arg6) \ > + SDT_PROBE_DEFINE(prov, mod, func, name, sname); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5); \ > + SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6); > + > #define SDT_PROBE0(prov, mod, func, name) \ > SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0) > #define SDT_PROBE1(prov, mod, func, name, arg0) \ > @@ -245,6 +273,27 @@ struct sdt_provider { > SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0) > #define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ > SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) > +#define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) \ > + do { \ > + if (sdt_##prov##_##mod##_##func##_##name->id) \ > + (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \ > + uintptr_t, uintptr_t, uintptr_t))sdt_probe_func)( \ > + sdt_##prov##_##mod##_##func##_##name->id, \ > + (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \ > + (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);\ > + } while (0) > +#define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \ > + arg6) \ > + do { \ > + if (sdt_##prov##_##mod##_##func##_##name->id) \ > + (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \ > + uintptr_t, uintptr_t, uintptr_t, uintptr_t)) \ > + sdt_probe_func)( \ > + sdt_##prov##_##mod##_##func##_##name->id, \ > + (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \ > + (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \ > + (uintptr_t)arg6); \ > + } while (0) > > typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); > typedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *); > _______________________________________________ > freebsd-dtrace@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org" -- Adam Leventhal CTO, Delphix http://blog.delphix.com/ahl