linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] perf: fix the probe finder location (.dwo files)
@ 2022-10-03 18:10 Henry Castro
  2022-10-04 18:54 ` Namhyung Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Henry Castro @ 2022-10-03 18:10 UTC (permalink / raw)
  To: hcvcastro
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel

If the file object is compiled using -gsplit-dwarf,
the probe finder location will fail.

Signed-off-by: Henry Castro <hcvcastro@gmail.com>
---

> Anyway I think it'd be safer to do
>
>    if (dwarf_cu_info() == 0 && unit_type == skeleton)
>        pf->cu_die = subdie;

Thank you, I have modifed the patch :)


 tools/perf/util/probe-finder.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 50d861a80f57..b27039f5f04b 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1161,7 +1161,8 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
 	struct perf_probe_point *pp = &pf->pev->point;
 	Dwarf_Off off, noff;
 	size_t cuhl;
-	Dwarf_Die *diep;
+	Dwarf_Die *diep, cudie, subdie;
+	uint8_t unit_type;
 	int ret = 0;

 	off = 0;
@@ -1200,6 +1201,14 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
 			continue;
 		}

+#if _ELFUTILS_VERSION >= 171
+		/* Check separate debug information file. */
+		if (dwarf_cu_info(pf->cu_die.cu, NULL, &unit_type,
+				  &cudie, &subdie, NULL, NULL, NULL) == 0
+		    && unit_type == DW_UT_skeleton)
+			pf->cu_die = subdie;
+#endif
+
 		/* Check if target file is included. */
 		if (pp->file)
 			pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
--
2.20.1


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

* Re: [PATCH v2] perf: fix the probe finder location (.dwo files)
  2022-10-03 18:10 [PATCH v2] perf: fix the probe finder location (.dwo files) Henry Castro
@ 2022-10-04 18:54 ` Namhyung Kim
  2022-10-05 12:47   ` [PATCH v3] " Henry Castro
  0 siblings, 1 reply; 7+ messages in thread
From: Namhyung Kim @ 2022-10-04 18:54 UTC (permalink / raw)
  To: Henry Castro
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, linux-perf-users,
	linux-kernel, Masami Hiramatsu

Cc + Masami

On Mon, Oct 3, 2022 at 11:10 AM Henry Castro <hcvcastro@gmail.com> wrote:
>
> If the file object is compiled using -gsplit-dwarf,
> the probe finder location will fail.
>
> Signed-off-by: Henry Castro <hcvcastro@gmail.com>
> ---
>
> > Anyway I think it'd be safer to do
> >
> >    if (dwarf_cu_info() == 0 && unit_type == skeleton)
> >        pf->cu_die = subdie;
>
> Thank you, I have modifed the patch :)
>
>
>  tools/perf/util/probe-finder.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 50d861a80f57..b27039f5f04b 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1161,7 +1161,8 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
>         struct perf_probe_point *pp = &pf->pev->point;
>         Dwarf_Off off, noff;
>         size_t cuhl;
> -       Dwarf_Die *diep;
> +       Dwarf_Die *diep, cudie, subdie;
> +       uint8_t unit_type;

They will be unused for earlier elfutils.

>         int ret = 0;
>
>         off = 0;
> @@ -1200,6 +1201,14 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
>                         continue;
>                 }
>
> +#if _ELFUTILS_VERSION >= 171

Nit, I think we use _ELFUTILS_PREREQ(0, 171).

> +               /* Check separate debug information file. */
> +               if (dwarf_cu_info(pf->cu_die.cu, NULL, &unit_type,
> +                                 &cudie, &subdie, NULL, NULL, NULL) == 0
> +                   && unit_type == DW_UT_skeleton)
> +                       pf->cu_die = subdie;
> +#endif

How about making it a separate function with 2 versions
depending on the elfutils?  Then you can have the variables
only if they are used.

Something like get_source_from_debuginfod() in the same
file.

Thanks,
Namhyung


> +
>                 /* Check if target file is included. */
>                 if (pp->file)
>                         pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
> --
> 2.20.1
>

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

* [PATCH v3] perf: fix the probe finder location (.dwo files)
  2022-10-04 18:54 ` Namhyung Kim
@ 2022-10-05 12:47   ` Henry Castro
  2022-10-17 12:37     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 7+ messages in thread
From: Henry Castro @ 2022-10-05 12:47 UTC (permalink / raw)
  To: namhyung
  Cc: Henry Castro, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, linux-perf-users, linux-kernel

If the file object is compiled using -gsplit-dwarf,
the probe finder location will fail.

Signed-off-by: Henry Castro <hcvcastro@gmail.com>
---

> Nit, I think we use _ELFUTILS_PREREQ(0, 171).
Thank you

> How about making it a separate function with 2 versions
> depending on the elfutils?  Then you can have the variables
> only if they are used.

> Something like get_source_from_debuginfod() in the same
> file.

Sounds good, but I prefer simplicity in the patch =),
what do you think about
{
	Dwarf_Die cudie, subdie;
	if (dwarf_cu_info() ..)
	..
}

to resolve unused variable?
}


 tools/perf/util/probe-finder.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 50d861a80f57..5f6781e712db 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1200,6 +1200,20 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
 			continue;
 		}

+#if _ELFUTILS_PREREQ(0, 171)
+		{
+			uint8_t unit_type;
+			Dwarf_Die cudie, subdie;
+
+			/* Check separate debug information file. */
+			if (dwarf_cu_info(pf->cu_die.cu, NULL,
+					  &unit_type, &cudie,
+					  &subdie, NULL,
+					  NULL, NULL) == 0
+			    && unit_type == DW_UT_skeleton)
+				pf->cu_die = subdie;
+		}
+#endif
 		/* Check if target file is included. */
 		if (pp->file)
 			pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
--
2.20.1


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

* Re: [PATCH v3] perf: fix the probe finder location (.dwo files)
  2022-10-05 12:47   ` [PATCH v3] " Henry Castro
@ 2022-10-17 12:37     ` Arnaldo Carvalho de Melo
  2023-01-29 23:21       ` Henry Castro
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-10-17 12:37 UTC (permalink / raw)
  To: Masami Hiramatsu, Namhyung Kim, Henry Castro
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, linux-perf-users, linux-kernel

Em Wed, Oct 05, 2022 at 08:47:02AM -0400, Henry Castro escreveu:
> If the file object is compiled using -gsplit-dwarf,
> the probe finder location will fail.
> 
> Signed-off-by: Henry Castro <hcvcastro@gmail.com>
> ---
> 
> > Nit, I think we use _ELFUTILS_PREREQ(0, 171).
> Thank you

Masami, are you ok with this?

Namyung, how about you?

Thanks,

- Arnaldo
 
> > How about making it a separate function with 2 versions
> > depending on the elfutils?  Then you can have the variables
> > only if they are used.
> 
> > Something like get_source_from_debuginfod() in the same
> > file.
> 
> Sounds good, but I prefer simplicity in the patch =),
> what do you think about
> {
> 	Dwarf_Die cudie, subdie;
> 	if (dwarf_cu_info() ..)
> 	..
> }
> 
> to resolve unused variable?
> }
> 
> 
>  tools/perf/util/probe-finder.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 50d861a80f57..5f6781e712db 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1200,6 +1200,20 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
>  			continue;
>  		}
> 
> +#if _ELFUTILS_PREREQ(0, 171)
> +		{
> +			uint8_t unit_type;
> +			Dwarf_Die cudie, subdie;
> +
> +			/* Check separate debug information file. */
> +			if (dwarf_cu_info(pf->cu_die.cu, NULL,
> +					  &unit_type, &cudie,
> +					  &subdie, NULL,
> +					  NULL, NULL) == 0
> +			    && unit_type == DW_UT_skeleton)
> +				pf->cu_die = subdie;
> +		}
> +#endif
>  		/* Check if target file is included. */
>  		if (pp->file)
>  			pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
> --
> 2.20.1

-- 

- Arnaldo

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

* [PATCH v3] perf: fix the probe finder location (.dwo files)
  2022-10-17 12:37     ` Arnaldo Carvalho de Melo
@ 2023-01-29 23:21       ` Henry Castro
  2023-02-02  1:21         ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 7+ messages in thread
From: Henry Castro @ 2023-01-29 23:21 UTC (permalink / raw)
  To: namhyung
  Cc: Henry Castro, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Masami Hiramatsu (Google),
	linux-perf-users, linux-kernel

If the file object is compiled using -gsplit-dwarf,
the probe finder location will fail.

Signed-off-by: Henry Castro <hcvcastro@gmail.com>
---

Hi,

Polite ping?  Any feedback?

Regards
Henry

 tools/perf/util/probe-finder.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 50d861a80f57..5f6781e712db 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1200,6 +1200,20 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
 			continue;
 		}

+#if _ELFUTILS_PREREQ(0, 171)
+		{
+			uint8_t unit_type;
+			Dwarf_Die cudie, subdie;
+
+			/* Check separate debug information file. */
+			if (dwarf_cu_info(pf->cu_die.cu, NULL,
+					  &unit_type, &cudie,
+					  &subdie, NULL,
+					  NULL, NULL) == 0
+			    && unit_type == DW_UT_skeleton)
+				pf->cu_die = subdie;
+		}
+#endif
 		/* Check if target file is included. */
 		if (pp->file)
 			pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
--
2.20.1


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

* Re: [PATCH v3] perf: fix the probe finder location (.dwo files)
  2023-01-29 23:21       ` Henry Castro
@ 2023-02-02  1:21         ` Arnaldo Carvalho de Melo
  2023-02-02  2:55           ` Namhyung Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-02-02  1:21 UTC (permalink / raw)
  To: Namhyung Kim, Henry Castro
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Masami Hiramatsu (Google),
	linux-perf-users, linux-kernel

Em Sun, Jan 29, 2023 at 07:21:28PM -0400, Henry Castro escreveu:
> If the file object is compiled using -gsplit-dwarf,
> the probe finder location will fail.
> 
> Signed-off-by: Henry Castro <hcvcastro@gmail.com>
> ---
> 
> Hi,
> 
> Polite ping?  Any feedback?

Namhyung, are you ok now? Masami, can you please take a look and provide
an Acked-by or Reviewed-by?

- Arnaldo
 
> Regards
> Henry
> 
>  tools/perf/util/probe-finder.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 50d861a80f57..5f6781e712db 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1200,6 +1200,20 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
>  			continue;
>  		}
> 
> +#if _ELFUTILS_PREREQ(0, 171)
> +		{
> +			uint8_t unit_type;
> +			Dwarf_Die cudie, subdie;
> +
> +			/* Check separate debug information file. */
> +			if (dwarf_cu_info(pf->cu_die.cu, NULL,
> +					  &unit_type, &cudie,
> +					  &subdie, NULL,
> +					  NULL, NULL) == 0
> +			    && unit_type == DW_UT_skeleton)
> +				pf->cu_die = subdie;
> +		}
> +#endif
>  		/* Check if target file is included. */
>  		if (pp->file)
>  			pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
> --
> 2.20.1
> 

-- 

- Arnaldo

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

* Re: [PATCH v3] perf: fix the probe finder location (.dwo files)
  2023-02-02  1:21         ` Arnaldo Carvalho de Melo
@ 2023-02-02  2:55           ` Namhyung Kim
  0 siblings, 0 replies; 7+ messages in thread
From: Namhyung Kim @ 2023-02-02  2:55 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Henry Castro, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Masami Hiramatsu (Google),
	linux-perf-users, linux-kernel

Hello,

On Wed, Feb 1, 2023 at 5:22 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> Em Sun, Jan 29, 2023 at 07:21:28PM -0400, Henry Castro escreveu:
> > If the file object is compiled using -gsplit-dwarf,
> > the probe finder location will fail.
> >
> > Signed-off-by: Henry Castro <hcvcastro@gmail.com>
> > ---
> >
> > Hi,
> >
> > Polite ping?  Any feedback?
>
> Namhyung, are you ok now? Masami, can you please take a look and provide
> an Acked-by or Reviewed-by?

Sorry about that.  I completely missed this..
Now it looks ok, but it'd be nice if Masami could review this.

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> >  tools/perf/util/probe-finder.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> > index 50d861a80f57..5f6781e712db 100644
> > --- a/tools/perf/util/probe-finder.c
> > +++ b/tools/perf/util/probe-finder.c
> > @@ -1200,6 +1200,20 @@ static int debuginfo__find_probe_location(struct debuginfo *dbg,
> >                       continue;
> >               }
> >
> > +#if _ELFUTILS_PREREQ(0, 171)
> > +             {
> > +                     uint8_t unit_type;
> > +                     Dwarf_Die cudie, subdie;
> > +
> > +                     /* Check separate debug information file. */
> > +                     if (dwarf_cu_info(pf->cu_die.cu, NULL,
> > +                                       &unit_type, &cudie,
> > +                                       &subdie, NULL,
> > +                                       NULL, NULL) == 0
> > +                         && unit_type == DW_UT_skeleton)
> > +                             pf->cu_die = subdie;
> > +             }
> > +#endif
> >               /* Check if target file is included. */
> >               if (pp->file)
> >                       pf->fname = cu_find_realpath(&pf->cu_die, pp->file);
> > --
> > 2.20.1
> >
>
> --
>
> - Arnaldo

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

end of thread, other threads:[~2023-02-02  2:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-03 18:10 [PATCH v2] perf: fix the probe finder location (.dwo files) Henry Castro
2022-10-04 18:54 ` Namhyung Kim
2022-10-05 12:47   ` [PATCH v3] " Henry Castro
2022-10-17 12:37     ` Arnaldo Carvalho de Melo
2023-01-29 23:21       ` Henry Castro
2023-02-02  1:21         ` Arnaldo Carvalho de Melo
2023-02-02  2:55           ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).