Linux DTrace development list
 help / color / mirror / Atom feed
From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 06/14] Add clauses to per-uprobe list
Date: Tue,  4 Jun 2024 14:11:05 -0400	[thread overview]
Message-ID: <20240604181113.11505-7-eugene.loh@oracle.com> (raw)
In-Reply-To: <20240604181113.11505-1-eugene.loh@oracle.com>

From: Eugene Loh <eugene.loh@oracle.com>

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 libdtrace/dt_prov_uprobe.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/libdtrace/dt_prov_uprobe.c b/libdtrace/dt_prov_uprobe.c
index cace406d..34906aa0 100644
--- a/libdtrace/dt_prov_uprobe.c
+++ b/libdtrace/dt_prov_uprobe.c
@@ -62,6 +62,7 @@ typedef struct dt_uprobe {
 	int		flags;
 	tp_probe_t	*tp;
 	dt_list_t	probes;		/* pid/USDT probes triggered by it */
+	dt_list_t	clauses;	/* clauses possibly called by this uprobe */
 } dt_uprobe_t;
 
 typedef struct list_probe {
@@ -69,6 +70,11 @@ typedef struct list_probe {
 	dt_probe_t	*probe;
 } list_probe_t;
 
+typedef struct list_clause {
+	dt_list_t	list;
+	uint_t		clause;
+} list_clause_t;
+
 static const dtrace_pattr_t	pattr = {
 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
@@ -243,6 +249,7 @@ static int provide_probe(dtrace_hdl_t *dtp, const pid_probespec_t *psp,
 	dt_uprobe_t		*upp;
 	dt_probe_t		*prp, *uprp;
 	list_probe_t		*pop, *pup;
+	list_clause_t		*cl;
 
 	snprintf(prv, sizeof(prv), "%s%d", psp->pps_prv, psp->pps_pid);
 
@@ -263,6 +270,7 @@ static int provide_probe(dtrace_hdl_t *dtp, const pid_probespec_t *psp,
 	/* Mark the provider as a PID-based provider. */
 	pvp->pv_flags |= DT_PROVIDER_PID;
 
+	/* Look up or create the underlying probe. */
 	uprp = create_underlying(dtp, psp);
 	if (uprp == NULL)
 		return -1;
@@ -270,6 +278,17 @@ static int provide_probe(dtrace_hdl_t *dtp, const pid_probespec_t *psp,
 	upp = uprp->prv_data;
 	upp->flags |= flags;
 
+	/* Add to this uprobe an index for the next clause to be assigned. */
+	cl = dt_list_prev(&upp->clauses);
+	if (cl == NULL || cl->clause != dtp->dt_clause_nextid) {
+		cl = dt_zalloc(dtp, sizeof(list_clause_t));
+		if (cl == NULL)
+			return -1;
+		cl->clause = dtp->dt_clause_nextid;
+		dt_list_append(&upp->clauses, cl);
+	}
+
+	/* Look up the overlying probe. */
 	prp = dt_probe_lookup(dtp, &pd);
 	if (prp != NULL) {
 		/*
-- 
2.18.4


  parent reply	other threads:[~2024-06-04 18:11 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 18:10 "proof of concept" for systemwide USDT eugene.loh
2024-06-04 18:11 ` [PATCH 01/14] Move comment closer to the code it describes eugene.loh
2024-06-04 18:21   ` [DTrace-devel] " Kris Van Hees
2024-06-04 18:11 ` [PATCH 02/14] Clean up prp/uprp variable names eugene.loh
2024-06-04 18:44   ` [DTrace-devel] " Kris Van Hees
2024-06-05 18:18     ` Eugene Loh
2024-06-04 18:11 ` [PATCH 03/14] Let USDT module names contain dots eugene.loh
2024-06-04 20:42   ` [DTrace-devel] " Kris Van Hees
2024-06-04 22:30     ` Eugene Loh
2024-06-07 18:48       ` Nick Alcock
2024-06-07 22:22         ` Eugene Loh
2024-06-04 18:11 ` [PATCH 04/14] Track uprobe provider descriptions eugene.loh
2024-06-04 21:10   ` [DTrace-devel] " Kris Van Hees
2024-06-07 21:40     ` Eugene Loh
2024-06-07 22:16       ` Kris Van Hees
2024-06-10 21:23         ` Eugene Loh
2024-06-10 21:31           ` Kris Van Hees
2024-06-04 18:11 ` [PATCH 05/14] Add a hook for a provider-specific "update" function eugene.loh
2024-06-04 21:38   ` [DTrace-devel] " Kris Van Hees
2024-06-10 22:14     ` Eugene Loh
2024-06-04 18:11 ` eugene.loh [this message]
2024-06-04 18:11 ` [PATCH 07/14] Create the BPF uprobes map eugene.loh
2024-06-05  4:33   ` [DTrace-devel] " Kris Van Hees
2024-06-10 20:55     ` Eugene Loh
2024-06-04 18:11 ` [PATCH 08/14] Use uprobes map to call clauses conditionally eugene.loh
2024-06-04 18:11 ` [PATCH 09/14] Systemwide USDT WIP eugene.loh
2024-06-04 18:11 ` [PATCH 10/14] Fix the consumer's picture of the EPID eugene.loh
2024-06-04 18:11 ` [PATCH 11/14] Back out the previous patch eugene.loh
2024-06-04 18:11 ` [PATCH 12/14] Fix comments that hardwire DBUF_ offsets eugene.loh
2024-06-04 18:11 ` [PATCH 13/14] Clean up some comments eugene.loh
2024-06-04 18:11 ` [PATCH 14/14] Have the consumer get the PRID from the output buffer eugene.loh
  -- strict thread matches above, loose matches on Subject: below --
2024-06-05  3:52 [PATCH 06/14] Add clauses to per-uprobe list Kris Van Hees

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240604181113.11505-7-eugene.loh@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox