From: Nick Alcock <nick.alcock@oracle.com>
To: Kris Van Hees <kris.van.hees@oracle.com>
Cc: dtrace@lists.linux.dev
Subject: Re: [DTrace-devel] [PATCH] btf: ensure BTF-to-CTF conversion works for modules
Date: Thu, 25 Jul 2024 17:02:26 +0100 [thread overview]
Message-ID: <87ikwtxxwt.fsf@esperi.org.uk> (raw)
In-Reply-To: <SN7PR10MB6287CB0F14DD5FBF62319CBDC2AB2@SN7PR10MB6287.namprd10.prod.outlook.com> (Kris Van Hees via DTrace-devel's message of "Thu, 25 Jul 2024 00:56:11 -0400")
On 25 Jul 2024, Kris Van Hees via DTrace-devel verbalised:
> The recent introduction of code to always load BTF data for modules
> broke the BTF-to-CTF conversion for modules. This patch ensures that
> the BTF-to-CTF convertor code is called from any module that does not
> contain CTF data.
>
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> libdtrace/dt_module.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
> index 5e608446..cbbb1d3c 100644
> --- a/libdtrace/dt_module.c
> +++ b/libdtrace/dt_module.c
> @@ -962,8 +962,8 @@ dt_kern_module_find_ctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
> dt_dprintf("Cannot open CTF archive %s: %s; "
> "looking for in-module CTF instead.\n",
> ctfa_name, ctf_errmsg(dtp->dt_ctferr));
> -#endif
> return;
> +#endif
> }
I'm having to refresh old memories here, so this could be wrong, but...
... this hunk seems wrong to me. Why is this return here at all? The
original implementation (before the converter) tries to load the shared
CTF from a variety of places (of which this is just the first) then goes
on to try to load standalone module CTF if the CTF for this module isn't
present in it. With that return in there, if the CTFA isn't found we
fail to look for CTF at all on the libdtrace-ctf (!HAVE_LIBCTF) pathway,
which is precisely the time in which some of those fallbacks (.ko.ctf
etc) may be needed.
Why not just drop the return?
> if (dtp->dt_ctfa_path == NULL)
> @@ -1018,6 +1018,11 @@ dt_kern_module_find_ctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
>
> dmp->dm_flags |= DT_DM_CTF_ARCHIVED;
> ctf_setspecific(dmp->dm_ctfp, dmp);
> +#ifdef HAVE_LIBCTF
> + } else {
> + /* Generate CTF from BTF for the module. */
> + dt_kern_module_ctf_from_btf(dtp, dmp);
> +#endif
> }
This should probably be one conditional later, so that we only build
from BTF if there is no out-of-tree module with CTF in it. (i.e. at the
very end.)
--
NULL && (void)
prev parent reply other threads:[~2024-07-25 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-25 4:56 [PATCH] btf: ensure BTF-to-CTF conversion works for modules Kris Van Hees
2024-07-25 10:49 ` [DTrace-devel] " Alan Maguire
2024-07-25 16:02 ` 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=87ikwtxxwt.fsf@esperi.org.uk \
--to=nick.alcock@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