Linux DTrace development list
 help / color / mirror / Atom feed
* [PATCH 2/3] btf: do not try to generate CTF data if there is no BTF data
@ 2025-06-23 23:37 Kris Van Hees
  2025-06-24 14:16 ` Nick Alcock
  0 siblings, 1 reply; 2+ messages in thread
From: Kris Van Hees @ 2025-06-23 23:37 UTC (permalink / raw)
  To: dtrace, dtrace-devel

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
 libdtrace/dt_module.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
index b3c8e247..eef5386a 100644
--- a/libdtrace/dt_module.c
+++ b/libdtrace/dt_module.c
@@ -864,11 +864,12 @@ static void
 dt_kern_module_find_btf(dtrace_hdl_t *dtp, dt_module_t *dmp)
 {
 	/*
-	 * The first module for which we need to collect BTF data must be the
-	 * 'vmlinux' module.
+	 * If there is no shared BTF data, and we're trying to load BTF data
+	 * fir any module other than "vmlinux", we can conclude no module has
+	 * valid BTF data.
 	 */
-	if (dtp->dt_shared_btf == NULL)
-		assert(strcmp(dmp->dm_name, "vmlinux") == 0);
+	if (dtp->dt_shared_btf == NULL && strcmp(dmp->dm_name, "vmlinux") != 0)
+		return;
 
 	dt_dprintf("Loading BTF for module %s.\n", dmp->dm_name);
 
@@ -957,8 +958,12 @@ dt_kern_module_find_ctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
 			 * data for shared_ctf from.
 			 */
 			mod = dt_module_lookup_by_name(dtp, "vmlinux");
-			dt_kern_module_ctf_from_btf(dtp, mod);
-			dtp->dt_shared_ctf = mod->dm_ctfp;
+			if (mod->dm_btf != NULL) {
+				dt_kern_module_ctf_from_btf(dtp, mod);
+				dtp->dt_shared_ctf = mod->dm_ctfp;
+			} else
+				dt_dprintf("No BTF data for vmlinux; "
+					   "looking for in-module CTF instead.\n");
 #else
 			dt_dprintf("Cannot open CTF archive %s: %s; "
 				   "looking for in-module CTF instead.\n",
@@ -1019,11 +1024,14 @@ 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 {
+	} else if (dmp->dm_btf != NULL) {
 		/* Generate CTF from BTF for the module. */
 		dt_kern_module_ctf_from_btf(dtp, dmp);
+	} else
+		dt_dprintf("No BTF data for %s; "
+			   "looking for in-module CTF instead.\n",
+			   dmp->dm_name);
 #endif
-	}
 
 	/*
 	 * No CTF archive, module not present in it, or module not loaded so
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] btf: do not try to generate CTF data if there is no BTF data
  2025-06-23 23:37 [PATCH 2/3] btf: do not try to generate CTF data if there is no BTF data Kris Van Hees
@ 2025-06-24 14:16 ` Nick Alcock
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Alcock @ 2025-06-24 14:16 UTC (permalink / raw)
  To: Kris Van Hees; +Cc: dtrace, dtrace-devel

On 24 Jun 2025, Kris Van Hees outgrape:

> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>

Reviewed-by: Nick Alcock <nick.alcock@oracle.com>

modulo the spelling nit below.

> ---
>  libdtrace/dt_module.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/libdtrace/dt_module.c b/libdtrace/dt_module.c
> index b3c8e247..eef5386a 100644
> --- a/libdtrace/dt_module.c
> +++ b/libdtrace/dt_module.c
> @@ -864,11 +864,12 @@ static void
>  dt_kern_module_find_btf(dtrace_hdl_t *dtp, dt_module_t *dmp)
>  {
>  	/*
> -	 * The first module for which we need to collect BTF data must be the
> -	 * 'vmlinux' module.
> +	 * If there is no shared BTF data, and we're trying to load BTF data
> +	 * fir any module other than "vmlinux", we can conclude no module has

s/fir/for/

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-24 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 23:37 [PATCH 2/3] btf: do not try to generate CTF data if there is no BTF data Kris Van Hees
2025-06-24 14:16 ` Nick Alcock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox