* [PATCH] Make sure all probes are listed in default case
@ 2025-06-28 1:19 eugene.loh
2025-07-22 14:19 ` Nick Alcock
0 siblings, 1 reply; 3+ messages in thread
From: eugene.loh @ 2025-06-28 1:19 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
INCOMPATIBILITIES | 2 +-
cmd/dtrace.c | 11 +++
test/unittest/dtrace-util/tst.ListProbes.r | 13 ++++
test/unittest/dtrace-util/tst.ListProbes.sh | 82 +++++++++++++++++++++
4 files changed, 107 insertions(+), 1 deletion(-)
create mode 100644 test/unittest/dtrace-util/tst.ListProbes.r
create mode 100755 test/unittest/dtrace-util/tst.ListProbes.sh
diff --git a/INCOMPATIBILITIES b/INCOMPATIBILITIES
index 035c3675b..bf55019ec 100644
--- a/INCOMPATIBILITIES
+++ b/INCOMPATIBILITIES
@@ -8,7 +8,7 @@ Missing providers
Difficulty: Medium
Likelihood: High
-A number of providers are missing, including pid, fbt, and net.
+Some providers are missing.
diff --git a/cmd/dtrace.c b/cmd/dtrace.c
index e0e778db0..ed517abff 100644
--- a/cmd/dtrace.c
+++ b/cmd/dtrace.c
@@ -1443,6 +1443,17 @@ main(int argc, char *argv[])
list_prog(&g_cmdv[i]);
if (g_cmdc == 0) {
+ dtrace_cmd_t pseudo_cmd;
+
+ /*
+ * If we are listing the default case "dtrace -l",
+ * compile the string ":::" to give providers an
+ * attempt to provide probes.
+ */
+ pseudo_cmd.dc_spec = DTRACE_PROBESPEC_NAME;
+ pseudo_cmd.dc_arg = ":::";
+ compile_str(&pseudo_cmd);
+
if (dtrace_probe_iter(g_dtp, NULL, list_probe, NULL) < 0)
dfatal(NULL); /* dtrace_errmsg() only */
}
diff --git a/test/unittest/dtrace-util/tst.ListProbes.r b/test/unittest/dtrace-util/tst.ListProbes.r
new file mode 100644
index 000000000..a04669843
--- /dev/null
+++ b/test/unittest/dtrace-util/tst.ListProbes.r
@@ -0,0 +1,13 @@
+cpc
+dtrace
+fbt
+io
+ip
+lockstat
+proc
+profile
+rawfbt
+rawtp
+sched
+sdt
+syscall
diff --git a/test/unittest/dtrace-util/tst.ListProbes.sh b/test/unittest/dtrace-util/tst.ListProbes.sh
new file mode 100755
index 000000000..84f363443
--- /dev/null
+++ b/test/unittest/dtrace-util/tst.ListProbes.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2025, 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.
+#
+
+##
+# ASSERTION:
+# Testing -l option gives reasonable numbers of probes for each provider.
+#
+# SECTION: dtrace Utility/-ln Option
+##
+
+dtrace=$1
+
+# Decide whether to expect lockstat (disabled prior to 5.10).
+read MAJOR MINOR <<< `uname -r | grep -Eo '^[0-9]+\.[0-9]+' | tr '.' ' '`
+if [ $MAJOR -gt 5 ]; then
+ expect_lockstat=1
+elif [ $MAJOR -eq 5 -a $MINOR -ge 10 ]; then
+ expect_lockstat=1
+else
+ expect_lockstat=0
+fi
+
+# Run "dtrace -l", print the providers, aggregate by provider, then confirm counts.
+$dtrace $dt_flags -l \
+| gawk '{ print $2 }' \
+| sort | uniq -c \
+| gawk -v LCKSTT=$expect_lockstat '
+
+ BEGIN {
+ nerr = 0;
+
+ # Fake lockstat if not expected.
+ if (LCKSTT == 0) print "lockstat";
+ }
+
+ function mycheck(lbl, val, valmin, valmax) {
+ print lbl;
+ if (val < valmin) { print "ERROR:", lbl, val, "< MIN =", valmin; nerr++ }
+ if (val > valmax) { print "ERROR:", lbl, val, "> MAX =", valmax; nerr++ }
+ }
+
+ # Skip the banner.
+ /^ +1 PROVIDER$/ { next }
+
+ # Wrong number of fields.
+ NF != 2 {
+ print "ERROR: wrong number of fields", $0;
+ nerr++;
+ next;
+ }
+
+ # Recognize some providers; apply sanity check on number of probes.
+ $2 == "cpc" { mycheck($2, $1, 5, 500); next }
+ $2 == "dtrace" { mycheck($2, $1, 3, 3); next }
+ $2 == "fbt" { mycheck($2, $1, 30000, 300000); next }
+ $2 == "io" { mycheck($2, $1, 2, 20); next }
+ $2 == "ip" { mycheck($2, $1, 2, 20); next }
+ $2 == "lockstat" { mycheck($2, $1, 4, 40); next }
+ # nothing for pid
+ $2 == "proc" { mycheck($2, $1, 6, 30); next }
+ $2 == "profile" { mycheck($2, $1, 6, 30); next }
+ $2 == "rawfbt" { mycheck($2, $1, 30000, 300000); next }
+ $2 == "rawtp" { mycheck($2, $1, 600, 6000); next }
+ $2 == "sched" { mycheck($2, $1, 3, 30); next }
+ $2 == "sdt" { mycheck($2, $1, 600, 6000); next }
+ $2 == "syscall" { mycheck($2, $1, 300, 3000); next }
+ # nothing for usdt
+
+ # Unrecognized line.
+ {
+ print "ERROR: unrecognized line", $0;
+ nerr++;
+ }
+
+ END { exit(nerr == 0 ? 0 : 1) }'
+
+exit $?
--
2.43.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Make sure all probes are listed in default case
2025-06-28 1:19 [PATCH] Make sure all probes are listed in default case eugene.loh
@ 2025-07-22 14:19 ` Nick Alcock
2025-07-22 14:52 ` Eugene Loh
0 siblings, 1 reply; 3+ messages in thread
From: Nick Alcock @ 2025-07-22 14:19 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
On 28 Jun 2025, eugene loh spake thusly:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
(presumably this is fixing the problem that lazily-instantiated probes
like fbt now is weren't instantiating probes before trying to list
them.)
I winced at this at first:
> + # Recognize some providers; apply sanity check on number of probes.
> + $2 == "cpc" { mycheck($2, $1, 5, 500); next }
> + $2 == "dtrace" { mycheck($2, $1, 3, 3); next }
> + $2 == "fbt" { mycheck($2, $1, 30000, 300000); next }
> + $2 == "io" { mycheck($2, $1, 2, 20); next }
> + $2 == "ip" { mycheck($2, $1, 2, 20); next }
> + $2 == "lockstat" { mycheck($2, $1, 4, 40); next }
> + # nothing for pid
> + $2 == "proc" { mycheck($2, $1, 6, 30); next }
> + $2 == "profile" { mycheck($2, $1, 6, 30); next }
> + $2 == "rawfbt" { mycheck($2, $1, 30000, 300000); next }
> + $2 == "rawtp" { mycheck($2, $1, 600, 6000); next }
> + $2 == "sched" { mycheck($2, $1, 3, 30); next }
> + $2 == "sdt" { mycheck($2, $1, 600, 6000); next }
> + $2 == "syscall" { mycheck($2, $1, 300, 3000); next }
> + # nothing for usdt
... but honestly if the figures are outside those bounds something is
*definitely* wrong (and it'll be obvious when they really need
updating).
--
NULL && (void)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Make sure all probes are listed in default case
2025-07-22 14:19 ` Nick Alcock
@ 2025-07-22 14:52 ` Eugene Loh
0 siblings, 0 replies; 3+ messages in thread
From: Eugene Loh @ 2025-07-22 14:52 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel
On 7/22/25 10:19, Nick Alcock wrote:
> On 28 Jun 2025, eugene loh spake thusly:
>> From: Eugene Loh <eugene.loh@oracle.com>
>>
>> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
>
> (presumably this is fixing the problem that lazily-instantiated probes
> like fbt now is weren't instantiating probes before trying to list
> them.)
Yes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-22 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28 1:19 [PATCH] Make sure all probes are listed in default case eugene.loh
2025-07-22 14:19 ` Nick Alcock
2025-07-22 14:52 ` Eugene Loh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.