From nobody Thu Sep 19 09:53:38 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X8W762PjXz5Vn9p; Thu, 19 Sep 2024 09:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X8W761R23z4QKl; Thu, 19 Sep 2024 09:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726739618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EZ/4si/044I4A+N4EELbgB45zrlGposJufOkzw6xo6Y=; b=dk3RYFwYuCKqZluibZ3nMJjAeHMjKDoDWc/3/cpRbT81++fNtscaFclqwA5VAdScHPfw+r eaK4q3+PentuU3TP0a8wFNWpE2YLaQdtUAntdbhKBOe+vA7v8oEK3NVz9VmFu1M+mAXVwc I9u8rbv1rVbcQPWzMluZPrtkzSrwhQA16eLnV56QWq7ixRt5hluVJcKElmAgh1jtJ7/fbY ZfsHIIH5ArE042LhCLsvNm7i4E4ECs9VnOQc+hzBpybv46pYf3/C52T8CzfzEh0wxKgrHy SdB+5qxqu2QdDDXTXlGz8Tt+whqoxESNsWM4AhwagFvc5yCqdrogpN7SuRKK4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726739618; a=rsa-sha256; cv=none; b=GkkL/ZQ2uWZ56mAcq3vTIdVrXOLPhnp95MbwLkupdv+OijVdXhGa89ePNtqwO/nuKqtDhh nS0PUcB9afjXv1f5X9PXtHLrUgmQ+3w0S/upbOE+M1EfDUKirrPQ4u7V+81ATX9VR66SWq qIPKOYer5/EpsC5MfCqFENL9CZBbqQx2HRln5Icc+xeVsZLY/3rZwl7arUpnU9diIk+dwC bQCHJ++jW6q+1qYDMUzJQZgy+EiWJRdDwM0mZX673tZ8v7qJQgSlcpvmJF+su0bXLyb5eX TN0m8vqSqTILREy4diJdeW+lSLVqZcwno6zdPFxagTkAYh90uaWIRu0/wGWQlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726739618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EZ/4si/044I4A+N4EELbgB45zrlGposJufOkzw6xo6Y=; b=AtTbzxluXZ5Lh0GFaobb+xOtAn7o3mNEj40zWOPUd9uCoXF6nthP8Ac9lw77CdpOBGk81V LtWAiydeDXyhfmW8PHaTLrNtPtVt+x+IQq1iZgDwyb/Gy+JJCFjTaxhLxulSBYOa8RfAfO e5X671a8f+bajlXfh+ECkImQx0uZJlReL62szdmdxHLIKzeEiXYtgOBCStAdIPWBcOoFQ4 iRrgcKzke52DBlaDWFPAmNfAAs1vZXYEDdD4dpgwp9tCUsuvatMY4LwppZxWD5uZ2cT6Hp MOy00NZL/aUg28L8AWbxJUXMVef4eqKzgqLBHCxhIVEuJB3nzpTpOhIqVvBRHQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X8W761301z11lF; Thu, 19 Sep 2024 09:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48J9rcOk075404; Thu, 19 Sep 2024 09:53:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48J9rcQO075401; Thu, 19 Sep 2024 09:53:38 GMT (envelope-from git) Date: Thu, 19 Sep 2024 09:53:38 GMT Message-Id: <202409190953.48J9rcQO075401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d439598dd0d3 - main - dtrace tests: Add a test case which validates FBT probe arguments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d439598dd0d341b0c0b77151ba904e09c42f8421 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d439598dd0d341b0c0b77151ba904e09c42f8421 commit d439598dd0d341b0c0b77151ba904e09c42f8421 Author: Mark Johnston AuthorDate: 2024-09-19 09:22:03 +0000 Commit: Mark Johnston CommitDate: 2024-09-19 09:22:03 +0000 dtrace tests: Add a test case which validates FBT probe arguments Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46674 --- .../test/tst/common/fbtprovider/tst.argtest.ksh | 34 ++++++++++++++++++++++ .../tst/common/fbtprovider/tst.argtest.ksh.out | 3 ++ .../dtrace/tests/common/fbtprovider/Makefile | 2 ++ sys/cddl/dev/dtrace/dtrace_test.c | 28 ++++++++++++++++-- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/fbtprovider/tst.argtest.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/fbtprovider/tst.argtest.ksh new file mode 100644 index 000000000000..dc3641b01101 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/fbtprovider/tst.argtest.ksh @@ -0,0 +1,34 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2024 Mark Johnston +# + +dtrace=$1 + +$dtrace -q -s /dev/stdin -c "sysctl debug.dtracetest.fbttest=1" <<__EOF__ +fbt:dtrace_test:fbttest:entry +{ + printf("%d %d %d %d %d %d %d %d %d %d\n", args[0], args[1], args[2], + args[3], args[4], args[5], args[6], args[7], args[8], args[9]); +} +__EOF__ diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/fbtprovider/tst.argtest.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/fbtprovider/tst.argtest.ksh.out new file mode 100644 index 000000000000..301e154b3339 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/fbtprovider/tst.argtest.ksh.out @@ -0,0 +1,3 @@ +debug.dtracetest.fbttest: 0 -> 0 +1 2 3 4 5 6 7 8 9 10 + diff --git a/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile b/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile index 3ca540fd77f1..0dee8f807065 100644 --- a/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile +++ b/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile @@ -6,6 +6,8 @@ PACKAGE= tests ${PACKAGE}FILES= \ err.D_PDESC_ZERO.notreturn.d \ + tst.argtest.ksh \ + tst.argtest.ksh.out \ tst.basic.d \ tst.functionentry.d \ tst.functionreturnvalue.d \ diff --git a/sys/cddl/dev/dtrace/dtrace_test.c b/sys/cddl/dev/dtrace/dtrace_test.c index e36debc27a49..a61958d9184a 100644 --- a/sys/cddl/dev/dtrace/dtrace_test.c +++ b/sys/cddl/dev/dtrace/dtrace_test.c @@ -51,13 +51,27 @@ typedef struct vnode vnode_t; vnode_t dummy; vnode_t *rootvp = &dummy; +enum argtest { + ARGTEST_SDT, + ARGTEST_FBT, +}; + +extern void fbttest(int, int, int, int, int, int, int, int, int, int); + +void __noinline +fbttest(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) +{ + printf("fbttest(%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)\n", + a, b, c, d, e, f, g, h, i, j); +} + /* * Test SDT probes with more than 5 arguments. On amd64, such probes require * special handling since only the first 5 arguments will be passed to * dtrace_probe() in registers; the rest must be fetched off the stack. */ static int -dtrace_test_sdttest(SYSCTL_HANDLER_ARGS) +dtrace_test_argtest(SYSCTL_HANDLER_ARGS) { int val, error; @@ -68,7 +82,10 @@ dtrace_test_sdttest(SYSCTL_HANDLER_ARGS) else if (val == 0) return (0); - SDT_PROBE6(test, , , sdttest, 1, 2, 3, 4, 5, 6); + if (arg2 == ARGTEST_SDT) + SDT_PROBE6(test, , , sdttest, 1, 2, 3, 4, 5, 6); + else + fbttest(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); return (error); } @@ -78,8 +95,13 @@ static SYSCTL_NODE(_debug, OID_AUTO, dtracetest, ""); SYSCTL_PROC(_debug_dtracetest, OID_AUTO, sdttest, - CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, dtrace_test_sdttest, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, ARGTEST_SDT, + dtrace_test_argtest, "I", "Trigger the SDT test probe"); +SYSCTL_PROC(_debug_dtracetest, OID_AUTO, fbttest, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, ARGTEST_FBT, + dtrace_test_argtest, + "I", "Trigger the FBT test probe"); static int dtrace_test_modevent(module_t mod, int type, void *data)