Re: [PATCH v2 2/8] perf jitdump: Directly mark the jitdump DSO

Arnaldo Carvalho de Melo
2025-04-25T15:12:28Z

On Thu, Apr 24, 2025 at 12:58:25PM -0700, Ian Rogers wrote:
> The DSO being generated was being accessed through a thread's maps,
> this is unnecessary as the dso can just be directly found. This avoids
> problems with passing a NULL evsel which may be inspected to determine
> properties of a callchain when using the buildid DSO marking code.

And this patch had to be moved after:

"perf dso: Move build_id to dso_id"

As it uses fields that were introduced there.

Thanks,

- Arnaldo

> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/util/jitdump.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c
> index 624964f01b5f..b062b1f234b6 100644
> --- a/tools/perf/util/jitdump.c
> +++ b/tools/perf/util/jitdump.c
> @@ -14,9 +14,9 @@
> #include <sys/mman.h>
> #include <linux/stringify.h>
>
> -#include "build-id.h"
> #include "event.h"
> #include "debug.h"
> +#include "dso.h"
> #include "evlist.h"
> #include "namespaces.h"
> #include "symbol.h"
> @@ -531,9 +531,22 @@ static int jit_repipe_code_load(struct jit_buf_desc *jd, union jr_entry *jr)
> /*
> * mark dso as use to generate buildid in the header
> */
> - if (!ret)
> - build_id__mark_dso_hit(tool, event, &sample, NULL, jd->machine);
> -
> + if (!ret) {
> + struct dso_id dso_id = {
> + {
> + .maj = event->mmap2.maj,
> + .min = event->mmap2.min,
> + .ino = event->mmap2.ino,
> + .ino_generation = event->mmap2.ino_generation,
> + },
> + .mmap2_valid = true,
> + .mmap2_ino_generation_valid = true,
> + };
> + struct dso *dso = machine__findnew_dso_id(jd->machine, filename, &dso_id);
> +
> + if (dso)
> + dso__set_hit(dso);
> + }
> out:
> perf_sample__exit(&sample);
> free(event);
> --
> 2.49.0.850.g28803427d3-goog