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: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [DTrace-devel] [PATCH v2 15/19] Ignore clauses: some clauses are impossible regardless of uprp
Date: Thu, 24 Oct 2024 17:12:30 -0400	[thread overview]
Message-ID: <Zxq4Pk7yKVnbWxpR@oracle.com> (raw)
In-Reply-To: <0ac389c5-769f-b86d-ae9f-c9102e774c2f@oracle.com>

On Thu, Oct 24, 2024 at 03:30:13PM -0400, Eugene Loh via DTrace-devel wrote:
> 
> On 10/23/24 16:28, Kris Van Hees wrote:
> > On Tue, Sep 24, 2024 at 04:25:54PM -0400, eugene.loh@oracle.com wrote:
> > > From: Eugene Loh <eugene.loh@oracle.com>
> > > 
> > > In ignore_clauses, for an underlying probe uprp, we try to
> > > decide if we can safely ignore clause n.
> > > 
> > > Meanwhile, for some clauses, the probe description tells us the
> > > clause will not be called for any USDT probe, regardless of the
> > > underlying probe.  For example, "syscall::write:" can safely be
> > > ignored, for all uprp.
> > > 
> > > Add a dtsd_usdt variable to each statement to track status:
> > > 
> > >      USDT_FLAG_UNINITIALIZED  not yet initialized
> > > 
> > >      USDT_FLAG_POSSIBLE       clause could possibly be called
> > >                               for some USDT probe
> > > 
> > >      USDT_FLAG_IGNORE         clause can safely be ignored for
> > >                               all USDT probes
> > I think it would be better to use the dtsd_clauseflags member for this.
> > You can add dt_stmt_set_flag() and dt_stmt_test_flag() (or similar names)
> > to set and test for specific bits in the dtsd_clauseflags member using
> > DT_CLSFLAG_* constants.  You should be OK with just 2, one to indicate
> > POSSIBLE and one to indicate IGNORE (neither being set obviously meansnot
> > yet initialized).
> > 
> > I don't really know what symbol names would be best... perhaps for now use
> > DT_CLSFLAG_USDT_INCLUDE and DT_CLSFLAG_USDT_EXCLUDE?
> > 
> > Main thing I would like to accomplish here is simply to access flags on the
> > statements through functions rather than accessing them directly.
> 
> I'd like to push back here.
> 
> First of all, the patch exposes only dtsd_usdt at the dtrace.h level.  That
> variable can hide whatever it is that USDT wants to do with it.  Your
> proposal would expose at least USDT_INCLUDE/EXCLUDE (or POSSIBLE/IGNORE or
> whatever we want to call them) in dtrace.h, and I do not know if future USDT
> would have even more stuff it wants to play with, meaning even more changes
> outside of the provider.

My objection is primarily with adding a member to the statement struct for a
particular provider.  Especially when there is no need for that.  There is a
flags member already that can be used for these purposes.

We never know whether there might be future needs that might require changes
but that is not really a reason to make changes now that are not needed.

> Second, you say the main point is to access flags through functions rather
> than directly, but to date we've been accessing flags directly.  The
> set/test functions would be new.  If we want to stop the direct accesses,
> that would seem to be a different patch.

My point here is that doing this from *providers* is a bit different than
accessing things from the libdtrace core.  Providers have been written to be
more separated from the core of libdtrace, or at least I have been trying to
do so.  This particular use case seems to be a perfect situation where using
accessor functions makes a lot of sense.  Especially because you are changing
data in structures that are at the core of libdtrace - not just usiing it.

Alternatively, I'd propose simply not doing this caching of state concerning
which clauses to ignore, and having clause_ignore() determine it for a given
statement without using cached information (since these flags really amount to
caching of information for optinization purposes).  Perhaps that is the better
option right now?

	Kris

  reply	other threads:[~2024-10-24 21:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 20:25 [PATCH v7 03/19] Deprecate enabled probe ID (epid) eugene.loh
2024-09-24 20:25 ` [PATCH v2 05/19] Split dt_pid_create_probes() into pid and USDT functions eugene.loh
2024-09-24 20:25 ` [PATCH v3 07/19] Create the BPF usdt_prids map eugene.loh
2024-09-24 20:25 ` [PATCH v3 09/19] Use usdt_prids map to call clauses conditionally for USDT probes eugene.loh
2024-09-24 20:25 ` [PATCH v3 11/19] Support USDT wildcard provider descriptions eugene.loh
2024-10-24 16:38   ` Kris Van Hees
2024-10-25  5:56     ` Eugene Loh
2024-10-25 12:48       ` Kris Van Hees
2024-09-24 20:25 ` [PATCH v2 14/19] Ignore clauses in USDT trampoline if we know they are impossible eugene.loh
2024-09-24 20:25 ` [PATCH v2 15/19] Ignore clauses: some clauses are impossible regardless of uprp eugene.loh
2024-10-23 20:28   ` Kris Van Hees
2024-10-24 19:30     ` Eugene Loh
2024-10-24 21:12       ` Kris Van Hees [this message]
2024-10-24 21:53         ` [DTrace-devel] " Eugene Loh

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=Zxq4Pk7yKVnbWxpR@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