[DTrace-devel] [PATCH v2 3/6] usdt: provide probes properly when >1 is specified

Nick Alcock nick.alcock at oracle.com
Wed May 17 19:53:00 UTC 2023


dt_pid_create_usdt_probes is called by dt_pid_create_probes, which
despite its name is usually called by the compiler to set the context
for one probe at a time, not all at once. So dt_pid_create_usdt_probes
is usually (currently: always) called in a mode in which it scans all
the probes and then creates only those it has been asked to create.
So we really do need to not skip invocations after the first.

This will obviously not work well for wildcard probe handling, but for
now the inefficient approach of just repeated rescanning should work
well enough.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_pid.c                | 7 +++----
 libdtrace/dt_proc.h               | 1 -
 test/unittest/usdt/tst.allargs.sh | 2 --
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
index 06bd7a4dd24aa..4be230ace1bf8 100644
--- a/libdtrace/dt_pid.c
+++ b/libdtrace/dt_pid.c
@@ -742,6 +742,8 @@ dt_pid_create_usdt_probes(dtrace_hdl_t *dtp, dt_proc_t *dpr,
 		 * probe: we'll complain later if we use it for anything.
 		 */
 
+		dt_dprintf("providing %s:%s:%s:%s\n", pdp->prv, pdp->mod,
+			   pdp->fun, pdp->prb);
 		if (pvp->impl->provide_probe(dtp, &psp) < 0 && pdp) {
 			dt_pid_error(dtp, pcb, dpr, D_PROC_USDT,
 				     "failed to instantiate %sprobe %s for pid %d: %s",
@@ -921,10 +923,7 @@ dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
 		dpr = dt_proc_lookup(dtp, pid);
 		assert(dpr != NULL);
 
-		if (!dpr->dpr_usdt) {
-			err = dt_pid_create_usdt_probes(dtp, dpr, pdp, pcb);
-			dpr->dpr_usdt = B_TRUE;
-		}
+		err = dt_pid_create_usdt_probes(dtp, dpr, pdp, pcb);
 
 		dt_proc_release_unlock(dtp, pid);
 	}
diff --git a/libdtrace/dt_proc.h b/libdtrace/dt_proc.h
index 2b4f4d0f03cf0..0ec1caf08fbfa 100644
--- a/libdtrace/dt_proc.h
+++ b/libdtrace/dt_proc.h
@@ -39,7 +39,6 @@ typedef struct dt_proc {
 	uint_t dpr_refs;		/* reference count */
 	uint8_t dpr_stop;		/* stop mask: see flag bits below */
 	uint8_t dpr_done;		/* done flag: ctl thread has exited */
-	uint8_t dpr_usdt;		/* usdt flag: usdt initialized */
 	uint8_t dpr_created;            /* proc flag: true if we created this
 					   process, false if we grabbed it */
 	uint8_t dpr_monitoring;		/* true if we should background-monitor
diff --git a/test/unittest/usdt/tst.allargs.sh b/test/unittest/usdt/tst.allargs.sh
index f0484793206f7..20f9de900b5ad 100755
--- a/test/unittest/usdt/tst.allargs.sh
+++ b/test/unittest/usdt/tst.allargs.sh
@@ -4,8 +4,6 @@
 # Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
-#
-# @@xfail: dtv2
 
 # This test covers all USDT probes fired by the DTRACE_PROBEn macros.
 # Arguments values are checked only for first 10 arguments because
-- 
2.39.1.268.g9de2f9a303




More information about the DTrace-devel mailing list