public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Eugene Loh <eugene.loh@oracle.com>
Cc: Kris Van Hees <kris.van.hees@oracle.com>,
	dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [DTrace-devel] [PATCH 1/4] cg, providers: refactor clearing probe arguments
Date: Thu, 18 Dec 2025 14:23:34 -0500	[thread overview]
Message-ID: <aURUtpXjLYdmeQka@oracle.com> (raw)
In-Reply-To: <a601f7a6-6df3-8519-0986-3ee50934410d@oracle.com>

On Thu, Dec 18, 2025 at 02:12:01PM -0500, Eugene Loh wrote:
> Two things...
> 
> On 12/17/25 00:09, Kris Van Hees via DTrace-devel wrote:
> 
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > ---
> >   libdtrace/dt_cg.c           | 34 +++++++++++++++++++++++++++++++---
> >   libdtrace/dt_cg.h           |  1 +
> >   libdtrace/dt_prov_cpc.c     | 17 -----------------
> >   libdtrace/dt_prov_dtrace.c  |  8 ++------
> >   libdtrace/dt_prov_profile.c | 23 +----------------------
> >   libdtrace/dt_prov_syscall.c | 10 ++--------
> 
> Is there also another clean-up site in dt_prov_sdt.c in trampoline()?

Ah right, good catch.

> > diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> > @@ -454,6 +454,32 @@ dt_cg_tramp_copy_regs(dt_pcb_t *pcb)
> >   	}
> >   }
> > +/*
> > + * Clear the content of the 'argv' member of the machine state, from the given
> > + * index (idx).
> > + *
> > + * The caller must ensure that %r7 contains the value set by the
> > + * dt_cg_tramp_prologue*() functions.
> > + */
> > +void
> > +dt_cg_tramp_clear_argv(dt_pcb_t *pcb, int idx)
> > +{
> > +	dt_irlist_t	*dlp = &pcb->pcb_ir;
> > +	int		i, argc = ARRAY_SIZE(((dt_mstate_t *)0)->argv);
> > +
> > +	if (idx >= argc)
> > +		return;
> > +
> > +	/*
> > +	 *	memset(&dctx->mst->argv[idx], 0, sizeof(dt_pt_regs);
> > +	 *				// stdw [%7 + DMST_ARG(idx)], 0
> > +	 *				// stdw [%7 + DMST_ARG(idx + 1)], 0
> > +	 *				//     (...)
> > +	 */
> 
> Actually, the code is clearer and more concise than the comment. Plus, the
> comment is wrong?  What's sizeof(dt_pt_regs) doing in there?  Just drop the
> "memset" comment block.  The two lines of code speak for themselves.

Good point.  Removing.

v2 on the way.

> > +	for (i = idx; i < argc; i++)
> > +		emit(dlp, BPF_STORE_IMM(BPF_DW, BPF_REG_7, DMST_ARG(i), 0));
> > +}

      reply	other threads:[~2025-12-18 19:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17  5:09 [PATCH 1/4] cg, providers: refactor clearing probe arguments Kris Van Hees
2025-12-18 19:12 ` [DTrace-devel] " Eugene Loh
2025-12-18 19:23   ` Kris Van Hees [this message]

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=aURUtpXjLYdmeQka@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=eugene.loh@oracle.com \
    /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