RE: [PATCH V5 3/3] perf tool: check buildid for symoff

From: Liang, Kan
Date: Tue Nov 25 2014 - 12:19:48 EST




> > + data__for_each_file_new(i, d) {
> > + k_dsos_tmp = &d->session->machines.host.kernel_dsos;
> > + u_dsos_tmp = &d->session->machines.host.user_dsos;
> > +
> > + if (!dsos__build_ids_equal(base_k_dsos, k_dsos_tmp))
> > + pr_warning("The perf.data come from different
> kernel. "
> > + "The kernel symbol offset may vary for
> different kernel.\n");
> > +
> > + if (!dsos__build_ids_equal(base_u_dsos, u_dsos_tmp))
>
> looks like at this time not all dsos on the list have the buildids read..
>

Right, I shouldn't assume all dsos have biuldids. I will modify the
dsos__build_ids_equal to check has_build_id.
If neither dsos have build_id, it will print
pr_debug ("Cannot get build_id for all dsos\n") once, and continue to do
next dso compare.

All the buildid compare related warnings will also be printed once.

> I tried to put in here the perf_session__read_build_ids call but it keeps
> showing me warning below:
>
> > + pr_warning("The perf.data come from different
> user binary. "
> > + "The user space symbol offset may vary
> for different
> > +binaries.\n");
>
> for following workload:
>
> [jolsa@krava perf]$ ./perf record ls
> ...
> [ perf record: Woken up 1 times to write data ] [ perf record: Captured and
> wrote 0.012 MB perf.data (~540 samples) ] [jolsa@krava perf]$ ./perf
> record ls ...
> [ perf record: Woken up 1 times to write data ] [ perf record: Captured and
> wrote 0.012 MB perf.data (~540 samples) ] [jolsa@krava perf]$ ./perf diff -
> s symoff The perf.data come from different user binary. The user space
> symbol offset may vary for different binaries.
> # Event 'cycles'
> ...

Another reason for the false warning is that we use long_name to find the dso_b.
However, the long_name is not unique.
The vmlinux dso is added when processing header. Its long name and short name
are same. (E.g. /lib/modules/3.18.0-rc3-01635-g05066a2-dirty/build/vmlinux)
When processing sample, vmlinux is loaded. Two new dsos are added for section
"init.text" and "exit.text". They also have the long name
/lib/modules/3.18.0-rc3-01635-g05066a2-dirty/build/vmlinux. But their short
name are different, [kernel.vmlinux].init.text and [kernel.vmlinux].exit.text.

So I will change the dsos__build_ids_equal to find the dso by short_name.

Kan
>
>
> jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/