Linux DTrace development list
 help / color / mirror / Atom feed
From: Nick Alcock <nix@esperi.org.uk>
To: Kris Van Hees <kris.van.hees@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 10/20] libdtrace: retain descriptors for cached module BTF IDs
Date: Tue, 24 Nov 2026 15:40:40 +0000	[thread overview]
Message-ID: <87eccagruv.fsf@esperi.org.uk> (raw)
In-Reply-To: <au9KzkbyxnlvGB62@kvh-deb-bpf>

On 7 Nov 2026, Kris Van Hees told this:

> On Fri, Nov 06, 2026 at 12:59:41PM +0000, Nix wrote:
>> On 30 Oct 2026, Kris Van Hees outgrape:
>> 
>> > ---
>> >  libdtrace/dt_btf.c               | 79 ++++++++++++++++++++++++++++++--
>> >  libdtrace/dt_impl.h              |  1 +
>> >  libdtrace/dt_open.c              |  1 +
>> >  test/triggers/module-discovery.c | 11 +++++
>> >  4 files changed, 88 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/libdtrace/dt_btf.c b/libdtrace/dt_btf.c
>> > index 617b0128..727e5f54 100644
>> > --- a/libdtrace/dt_btf.c
>> > +++ b/libdtrace/dt_btf.c
>> > @@ -1479,17 +1479,67 @@ dt_btf_lookup_name_kind(dtrace_hdl_t *dtp, dt_module_t *dmp, const char *name,
>> >  	return id;
>> >  }
>> >  
>> > +/*
>> > + * Retain a descriptor as well as the ID: otherwise an unloaded object's ID
>> > + * could be reused and a later enumeration could mistake it for a cached one.
>> > + * Only IDs assigned to modules are retained, bounding descriptor use by the
>> > + * number of modules discovered by this handle.
>> > + */
>> 
>> I suppose just not reusing IDs in general, and having them only
>> increment, would end up using too many? (I can't remember under what
>> circumstances they're reused, but I didn't think it was *common*.)
>
> The thing is that we have no control over the IDs...  They are provided
> by the BTF subsystem, and we should not make any assumptions about them
> in terms of wether they could be reused or not.
>
>> How it interacts with the earlier change to never remove dt_modules when
>> their corresponding kernel module is unloaded is unclear to me -- is
>> this the bit that ensures that an unloaded module never gets reused (and
>> instead we load a new one if the module is reloaded into the kernel), or
>> what?
>
> This really has to do with the way the BTF subsystem handles modules and
> associates IDs with them.  OUr own view of modules is independent from
> that.

Aha, makes sense.

Reviewed-by: Nick Alcock <nix@esperi.org.uk>

-- 
NULL && (void)

      reply	other threads:[~2026-11-24 15:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 19:36 [PATCH 10/20] libdtrace: retain descriptors for cached module BTF IDs Kris Van Hees
2026-11-06 12:59 ` Nix
2026-11-07 15:59   ` Kris Van Hees
2026-11-24 15:40     ` Nick Alcock [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=87eccagruv.fsf@esperi.org.uk \
    --to=nix@esperi.org.uk \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=kris.van.hees@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