Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Thu, Nov 26, 2020 at 02:57:06PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Nov 26, 2020 at 06:00:23PM +0100, Jiri Olsa escreveu: > > Adding support to specify perf data file as -a option file > > argument, > > > > If the file is detected to be perf data file, it is processed > > and all dso objects with sample hit are stored to the build > > id cache. > > Would be interesting if the steps to have that debuginfod server running > at that 192.168.122.174:8002 URL were spelled out here, for > completeness. right, will add that jirka > > - Arnaldo > > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > > perf.data > > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > > > By default we store only dso with hits, but it's possible to > > specify 'all' to store all dso objects, like: > > -a perf.data,all > > > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > > perf.data,all > > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > > OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko > > OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko > > OK e896b4329cf9f190f1a0fae933f425ff8f71b052 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko > > OK 5bedc933cb59e053ecb472f327bd73c548364479 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko > > OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko > > OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko > > OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko > > OK 31ab0da5ad81e6803280177f507a95f3053d585e > > /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko > > OK f6154bca47c149f48c942fcc3d653041dd285c65 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko > > OK 723f5852de81590d54b23b38c160d3618b41951b > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko > > OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko > > OK 38292b862cf3ff87489508fdb4895efa45780813 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko > > OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko > > OK 5ca8958388f6688452ecc2cb83d6031394c659ad > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko > > OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko > > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd > > OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so > > OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 > > OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 > > /usr/lib64/libunistring.so.2.1.0 > > ... > > > > Once perf data is specified, no other file can be specified in > > the option, otherwise it causes syntax error. > > > > Signed-off-by: Jiri Olsa > > --- > > .../perf/Documentation/perf-buildid-cache.txt | 12 +- > > tools/perf/builtin-buildid-cache.c| 213 +- > > tools/perf/util/probe-event.c | 6 +- > > 3 files changed, 225 insertions(+), 6 deletions(-) > > > > diff --git a/tools/perf/Documentation/perf-buildid-cache.txt > > b/tools/perf/Documentation/perf-buildid-cache.txt > > index f6de0952ff3c..b77da5138bca 100644 > > --- a/tools/perf/Documentation/perf-buildid-cache.txt > > +++ b/tools/perf/Documentation/perf-buildid-cache.txt > > @@ -23,7 +23,17 @@ OPTIONS > > --- > > -a:: > > --add=:: > > -Add specified file to the cache. > > +Add specified file or perf.data binaries to the cache. > > + > > +If the file is detected to be perf data file, it is processed > > +and all dso objects with sample hit are stored to the cache. > > + > > +It's possible to specify 'all' to store all dso objects, like: > > +-a perf.data,all > > + > > +Once perf data is specified, no other file can be specified in > > +the option, otherwise it causes syntax error. > > + > > -f:: > > --force:: > > Don't complain, do it. > > diff --git a/tools/perf/builtin-buildid-cache.c > >
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
Em Thu, Nov 26, 2020 at 06:00:23PM +0100, Jiri Olsa escreveu: > Adding support to specify perf data file as -a option file > argument, > > If the file is detected to be perf data file, it is processed > and all dso objects with sample hit are stored to the build > id cache. Would be interesting if the steps to have that debuginfod server running at that 192.168.122.174:8002 URL were spelled out here, for completeness. - Arnaldo > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > perf.data > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > By default we store only dso with hits, but it's possible to > specify 'all' to store all dso objects, like: > -a perf.data,all > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > perf.data,all > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd > /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko > OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb > /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko > OK e896b4329cf9f190f1a0fae933f425ff8f71b052 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko > OK 5bedc933cb59e053ecb472f327bd73c548364479 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko > OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko > OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko > OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko > OK 31ab0da5ad81e6803280177f507a95f3053d585e > /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko > OK f6154bca47c149f48c942fcc3d653041dd285c65 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko > OK 723f5852de81590d54b23b38c160d3618b41951b > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko > OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko > OK 38292b862cf3ff87489508fdb4895efa45780813 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko > OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko > OK 5ca8958388f6688452ecc2cb83d6031394c659ad > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko > OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd > OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so > OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 > OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 > /usr/lib64/libunistring.so.2.1.0 > ... > > Once perf data is specified, no other file can be specified in > the option, otherwise it causes syntax error. > > Signed-off-by: Jiri Olsa > --- > .../perf/Documentation/perf-buildid-cache.txt | 12 +- > tools/perf/builtin-buildid-cache.c| 213 +- > tools/perf/util/probe-event.c | 6 +- > 3 files changed, 225 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/Documentation/perf-buildid-cache.txt > b/tools/perf/Documentation/perf-buildid-cache.txt > index f6de0952ff3c..b77da5138bca 100644 > --- a/tools/perf/Documentation/perf-buildid-cache.txt > +++ b/tools/perf/Documentation/perf-buildid-cache.txt > @@ -23,7 +23,17 @@ OPTIONS > --- > -a:: > --add=:: > -Add specified file to the cache. > +Add specified file or perf.data binaries to the cache. > + > +If the file is detected to be perf data file, it is processed > +and all dso objects with sample hit are stored to the cache. > + > +It's possible to specify 'all' to store all dso objects, like: > +-a perf.data,all > + > +Once perf data is specified, no other file can be specified in > +the option, otherwise it causes syntax error. > + > -f:: > --force:: > Don't complain, do it. > diff --git a/tools/perf/builtin-buildid-cache.c > b/tools/perf/builtin-buildid-cache.c > index a25411926e48..f0afb2c89e03 100644 > --- a/tools/perf/builtin-buildid-cache.c > +++ b/tools/perf/builtin-buildid-cache.c > @@ -29,6 +29,11 @@ > #include "util/probe-file.h" > #include > #include > +#include > +#include > +#ifdef HAVE_DEBUGINFOD_SUPPORT >
[PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
Adding support to specify perf data file as -a option file argument, If the file is detected to be perf data file, it is processed and all dso objects with sample hit are stored to the build id cache. $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a perf.data OK 5dcec522abf136fcfd3128f47e131f2365834dd7 /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf OK 5784f813b727a50cfd3363234aef9fcbab685cc4 /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko By default we store only dso with hits, but it's possible to specify 'all' to store all dso objects, like: -a perf.data,all $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a perf.data,all OK 5dcec522abf136fcfd3128f47e131f2365834dd7 /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko OK e896b4329cf9f190f1a0fae933f425ff8f71b052 /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko OK 5bedc933cb59e053ecb472f327bd73c548364479 /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko OK 31ab0da5ad81e6803280177f507a95f3053d585e /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko OK f6154bca47c149f48c942fcc3d653041dd285c65 /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko OK 723f5852de81590d54b23b38c160d3618b41951b /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko OK 38292b862cf3ff87489508fdb4895efa45780813 /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko OK 5ca8958388f6688452ecc2cb83d6031394c659ad /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko OK 5784f813b727a50cfd3363234aef9fcbab685cc4 /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 /usr/lib64/libunistring.so.2.1.0 ... Once perf data is specified, no other file can be specified in the option, otherwise it causes syntax error. Signed-off-by: Jiri Olsa --- .../perf/Documentation/perf-buildid-cache.txt | 12 +- tools/perf/builtin-buildid-cache.c| 213 +- tools/perf/util/probe-event.c | 6 +- 3 files changed, 225 insertions(+), 6 deletions(-) diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt index f6de0952ff3c..b77da5138bca 100644 --- a/tools/perf/Documentation/perf-buildid-cache.txt +++ b/tools/perf/Documentation/perf-buildid-cache.txt @@ -23,7 +23,17 @@ OPTIONS --- -a:: --add=:: -Add specified file to the cache. +Add specified file or perf.data binaries to the cache. + +If the file is detected to be perf data file, it is processed +and all dso objects with sample hit are stored to the cache. + +It's possible to specify 'all' to store all dso objects, like: +-a perf.data,all + +Once perf data is specified, no other file can be specified in +the option, otherwise it causes syntax error. + -f:: --force:: Don't complain, do it. diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c index a25411926e48..f0afb2c89e03 100644 --- a/tools/perf/builtin-buildid-cache.c +++ b/tools/perf/builtin-buildid-cache.c @@ -29,6 +29,11 @@ #include "util/probe-file.h" #include #include +#include +#include +#ifdef HAVE_DEBUGINFOD_SUPPORT +#include +#endif static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid) { @@ -348,6 +353,203 @@ static int build_id_cache__show_all(void) return 0; } +#ifdef HAVE_DEBUGINFOD_SUPPORT +static int call_debuginfod(const char *sbuild_id, char **path, bool debuginfo) +{ + debuginfod_client *c; + int fd; + + c = debuginfod_begin(); + if (c == NULL) + return -1; + +
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Thu, Nov 26, 2020 at 1:36 AM Jiri Olsa wrote: > > On Wed, Nov 25, 2020 at 10:00:10PM +0900, Namhyung Kim wrote: > > On Tue, Nov 24, 2020 at 8:06 AM Jiri Olsa wrote: > > > > > > Adding support to specify perf data file as -a option file > > > argument, > > > > > > If the file is detected to be perf data file, it is processed > > > and all dso objects with sample hit are stored to the build > > > id cache. > > > > > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > > > perf.data > > > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > > > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > > > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > > > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > > > > > By default we store only dso with hits, but it's possible to > > > specify 'all' to store all dso objects, like: > > > -a perf.data,all > > > > I think we can add -A/--add-all like we have -p and -P. > > hm, the thing is that 'all' is specific for perf data file: '-a perf.data' > hence -A 'file' would make no sense, only for '-A perf.data', so the current > 'all' parameter seems less confusing to me Yeah, I also thought about the '-A perf.data' form. But I won't insist on it strongly, it's up to you. :) Thanks, Namhyung
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Wed, Nov 25, 2020 at 10:00:10PM +0900, Namhyung Kim wrote: > On Tue, Nov 24, 2020 at 8:06 AM Jiri Olsa wrote: > > > > Adding support to specify perf data file as -a option file > > argument, > > > > If the file is detected to be perf data file, it is processed > > and all dso objects with sample hit are stored to the build > > id cache. > > > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > > perf.data > > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > > > By default we store only dso with hits, but it's possible to > > specify 'all' to store all dso objects, like: > > -a perf.data,all > > I think we can add -A/--add-all like we have -p and -P. hm, the thing is that 'all' is specific for perf data file: '-a perf.data' hence -A 'file' would make no sense, only for '-A perf.data', so the current 'all' parameter seems less confusing to me thanks, jirka > > > > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > > perf.data,all > > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > > OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko > > OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko > > OK e896b4329cf9f190f1a0fae933f425ff8f71b052 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko > > OK 5bedc933cb59e053ecb472f327bd73c548364479 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko > > OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko > > OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko > > OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko > > OK 31ab0da5ad81e6803280177f507a95f3053d585e > > /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko > > OK f6154bca47c149f48c942fcc3d653041dd285c65 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko > > OK 723f5852de81590d54b23b38c160d3618b41951b > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko > > OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko > > OK 38292b862cf3ff87489508fdb4895efa45780813 > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko > > OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 > > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko > > OK 5ca8958388f6688452ecc2cb83d6031394c659ad > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko > > OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d > > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko > > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd > > OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so > > OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 > > OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 > > /usr/lib64/libunistring.so.2.1.0 > > ... > > > > Once perf data is specified, no other file can be specified in > > the option, otherwise it causes syntax error. > > > > Signed-off-by: Jiri Olsa > > --- > > .../perf/Documentation/perf-buildid-cache.txt | 12 +- > > tools/perf/builtin-buildid-cache.c| 215 +- > > tools/perf/util/probe-event.c | 6 +- > > 3 files changed, 227 insertions(+), 6 deletions(-) > > > > diff --git a/tools/perf/Documentation/perf-buildid-cache.txt > > b/tools/perf/Documentation/perf-buildid-cache.txt > > index f6de0952ff3c..b77da5138bca 100644 > > --- a/tools/perf/Documentation/perf-buildid-cache.txt > > +++ b/tools/perf/Documentation/perf-buildid-cache.txt > > @@ -23,7 +23,17 @@ OPTIONS > > --- > > -a:: > > --add=:: > > -Add specified file to the cache. > > +Add specified file or perf.data binaries to the cache. > > + > > +If the file is detected to be perf data file, it is processed > > +and all dso objects with sample hit are stored to the cache. > > + > > +It's possible to specify 'all' to store all dso objects, like: > > +-a perf.data,all > > + > > +Once perf data is specified, no other file can be specified in > > +the option, otherwise it causes syntax error. > > + > > -f:: > > --force:: > > Don't complain, do it. > >
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Wed, Nov 25, 2020 at 10:29:11PM +0900, Namhyung Kim wrote: SNIP > > +#ifdef HAVE_DEBUGINFOD_SUPPORT > > +static int call_debuginfod(const char *sbuild_id, char **path, bool > > debuginfo) > > +{ > > + debuginfod_client *c; > > + int fd; > > + > > + c = debuginfod_begin(); > > + if (c == NULL) > > + return -1; > > + > > + pr_debug("trying debuginfod for executable <%s> ... ", sbuild_id); > > + > > + if (debuginfo) { > > + fd = debuginfod_find_debuginfo(c, (const unsigned char *) > > sbuild_id, > > + 0, path); > > + } else { > > + fd = debuginfod_find_executable(c, (const unsigned char *) > > sbuild_id, > > + 0, path); > > + } > > + if (fd >= 0) > > + close(fd); /* retaining reference by realname */ > > + > > + debuginfod_end(c); > > + pr_debug("%s%s\n", *path ? "OK " : "FAILED", *path ? *path : ""); > > + return *path ? 0 : -1; > > +} > > +#else > > +static int call_debuginfod(const char *sbuild_id __maybe_unused, > > + char **path __maybe_unused, > > + bool debuginfo __maybe_unused) > > +{ > > + return -1; > > +} > > +#endif > > + > > +struct dso_store_data { > > + bool hits; > > + bool force_download; > > Where is it set? it's not, I wanted to add it, but then never needed it, so it stayed without an option.. I'll remove it thanks, jirka
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Tue, Nov 24, 2020 at 8:06 AM Jiri Olsa wrote: > > Adding support to specify perf data file as -a option file > argument, > > If the file is detected to be perf data file, it is processed > and all dso objects with sample hit are stored to the build > id cache. > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > perf.data > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > By default we store only dso with hits, but it's possible to > specify 'all' to store all dso objects, like: > -a perf.data,all > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > perf.data,all > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd > /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko > OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb > /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko > OK e896b4329cf9f190f1a0fae933f425ff8f71b052 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko > OK 5bedc933cb59e053ecb472f327bd73c548364479 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko > OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko > OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko > OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko > OK 31ab0da5ad81e6803280177f507a95f3053d585e > /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko > OK f6154bca47c149f48c942fcc3d653041dd285c65 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko > OK 723f5852de81590d54b23b38c160d3618b41951b > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko > OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko > OK 38292b862cf3ff87489508fdb4895efa45780813 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko > OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko > OK 5ca8958388f6688452ecc2cb83d6031394c659ad > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko > OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd > OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so > OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 > OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 > /usr/lib64/libunistring.so.2.1.0 > ... > > Once perf data is specified, no other file can be specified in > the option, otherwise it causes syntax error. > > Signed-off-by: Jiri Olsa > --- > .../perf/Documentation/perf-buildid-cache.txt | 12 +- > tools/perf/builtin-buildid-cache.c| 215 +- > tools/perf/util/probe-event.c | 6 +- > 3 files changed, 227 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/Documentation/perf-buildid-cache.txt > b/tools/perf/Documentation/perf-buildid-cache.txt > index f6de0952ff3c..b77da5138bca 100644 > --- a/tools/perf/Documentation/perf-buildid-cache.txt > +++ b/tools/perf/Documentation/perf-buildid-cache.txt > @@ -23,7 +23,17 @@ OPTIONS > --- > -a:: > --add=:: > -Add specified file to the cache. > +Add specified file or perf.data binaries to the cache. > + > +If the file is detected to be perf data file, it is processed > +and all dso objects with sample hit are stored to the cache. > + > +It's possible to specify 'all' to store all dso objects, like: > +-a perf.data,all > + > +Once perf data is specified, no other file can be specified in > +the option, otherwise it causes syntax error. > + > -f:: > --force:: > Don't complain, do it. > diff --git a/tools/perf/builtin-buildid-cache.c > b/tools/perf/builtin-buildid-cache.c > index a25411926e48..0bfb54ee1e5e 100644 > --- a/tools/perf/builtin-buildid-cache.c > +++ b/tools/perf/builtin-buildid-cache.c > @@ -29,6 +29,11 @@ > #include "util/probe-file.h" > #include > #include > +#include > +#include > +#ifdef HAVE_DEBUGINFOD_SUPPORT > +#include > +#endif > > static int build_id_cache__kcore_buildid(const char *proc_dir, char > *sbuildid) > { > @@ -348,6 +353,205 @@ static int build_id_cache__show_all(void) >
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Wed, Nov 25, 2020 at 10:00 PM Namhyung Kim wrote: > > On Tue, Nov 24, 2020 at 8:06 AM Jiri Olsa wrote: > > diff --git a/tools/perf/builtin-buildid-cache.c > > b/tools/perf/builtin-buildid-cache.c > > index a25411926e48..0bfb54ee1e5e 100644 > > --- a/tools/perf/builtin-buildid-cache.c > > +++ b/tools/perf/builtin-buildid-cache.c > > @@ -29,6 +29,11 @@ > > #include "util/probe-file.h" > > #include > > #include > > +#include > > +#include > > +#ifdef HAVE_DEBUGINFOD_SUPPORT > > +#include > > +#endif > > > > static int build_id_cache__kcore_buildid(const char *proc_dir, char > > *sbuildid) > > { > > @@ -348,6 +353,205 @@ static int build_id_cache__show_all(void) > > return 0; > > } > > > > +#ifdef HAVE_DEBUGINFOD_SUPPORT > > I think this part belongs to the next patch...? > > Thanks, > Namhyung Oh, I've missed we already have the debuginfod support. Thanks, Namhyung
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Tue, Nov 24, 2020 at 8:06 AM Jiri Olsa wrote: > > Adding support to specify perf data file as -a option file > argument, > > If the file is detected to be perf data file, it is processed > and all dso objects with sample hit are stored to the build > id cache. > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > perf.data > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > By default we store only dso with hits, but it's possible to > specify 'all' to store all dso objects, like: > -a perf.data,all I think we can add -A/--add-all like we have -p and -P. > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > perf.data,all > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd > /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko > OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb > /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko > OK e896b4329cf9f190f1a0fae933f425ff8f71b052 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko > OK 5bedc933cb59e053ecb472f327bd73c548364479 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko > OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko > OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko > OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko > OK 31ab0da5ad81e6803280177f507a95f3053d585e > /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko > OK f6154bca47c149f48c942fcc3d653041dd285c65 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko > OK 723f5852de81590d54b23b38c160d3618b41951b > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko > OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko > OK 38292b862cf3ff87489508fdb4895efa45780813 > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko > OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 > /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko > OK 5ca8958388f6688452ecc2cb83d6031394c659ad > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko > OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d > /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd > OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so > OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 > OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 > /usr/lib64/libunistring.so.2.1.0 > ... > > Once perf data is specified, no other file can be specified in > the option, otherwise it causes syntax error. > > Signed-off-by: Jiri Olsa > --- > .../perf/Documentation/perf-buildid-cache.txt | 12 +- > tools/perf/builtin-buildid-cache.c| 215 +- > tools/perf/util/probe-event.c | 6 +- > 3 files changed, 227 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/Documentation/perf-buildid-cache.txt > b/tools/perf/Documentation/perf-buildid-cache.txt > index f6de0952ff3c..b77da5138bca 100644 > --- a/tools/perf/Documentation/perf-buildid-cache.txt > +++ b/tools/perf/Documentation/perf-buildid-cache.txt > @@ -23,7 +23,17 @@ OPTIONS > --- > -a:: > --add=:: > -Add specified file to the cache. > +Add specified file or perf.data binaries to the cache. > + > +If the file is detected to be perf data file, it is processed > +and all dso objects with sample hit are stored to the cache. > + > +It's possible to specify 'all' to store all dso objects, like: > +-a perf.data,all > + > +Once perf data is specified, no other file can be specified in > +the option, otherwise it causes syntax error. > + > -f:: > --force:: > Don't complain, do it. > diff --git a/tools/perf/builtin-buildid-cache.c > b/tools/perf/builtin-buildid-cache.c > index a25411926e48..0bfb54ee1e5e 100644 > --- a/tools/perf/builtin-buildid-cache.c > +++ b/tools/perf/builtin-buildid-cache.c > @@ -29,6 +29,11 @@ > #include "util/probe-file.h" > #include > #include > +#include > +#include > +#ifdef HAVE_DEBUGINFOD_SUPPORT > +#include > +#endif > > static int build_id_cache__kcore_buildid(const char *proc_dir, char > *sbuildid) > { > @@
[PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
Adding support to specify perf data file as -a option file argument, If the file is detected to be perf data file, it is processed and all dso objects with sample hit are stored to the build id cache. $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a perf.data OK 5dcec522abf136fcfd3128f47e131f2365834dd7 /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf OK 5784f813b727a50cfd3363234aef9fcbab685cc4 /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko By default we store only dso with hits, but it's possible to specify 'all' to store all dso objects, like: -a perf.data,all $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a perf.data,all OK 5dcec522abf136fcfd3128f47e131f2365834dd7 /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf OK 6ce92dc7c31f12fe5b7775a2bb8b14a3546ce2cd /lib/modules/5.10.0-rc2speed+/kernel/drivers/firmware/qemu_fw_cfg.ko OK bf3f6d32dccc159f841fc3658c241d0e74c61fbb /lib/modules/5.10.0-rc2speed+/kernel/drivers/block/virtio_blk.ko OK e896b4329cf9f190f1a0fae933f425ff8f71b052 /lib/modules/5.10.0-rc2speed+/kernel/drivers/char/virtio_console.ko OK 5bedc933cb59e053ecb472f327bd73c548364479 /lib/modules/5.10.0-rc2speed+/kernel/drivers/input/serio/serio_raw.ko OK cecc506368a8b7a473a5f900d26f0d3d914a9c23 /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32c-intel.ko OK 91076fb3646d061a0a42cf7bddb339a665ee4f80 /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/ghash-clmulni-intel.ko OK 4e2a304d788bb8e2e950bc82a5944e042afa0bf2 /lib/modules/5.10.0-rc2speed+/kernel/drivers/media/cec/core/cec.ko OK 31ab0da5ad81e6803280177f507a95f3053d585e /lib/modules/5.10.0-rc2speed+/kernel/lib/libcrc32c.ko OK f6154bca47c149f48c942fcc3d653041dd285c65 /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/ttm/ttm.ko OK 723f5852de81590d54b23b38c160d3618b41951b /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crct10dif-pclmul.ko OK 06b1eab7f141cbc3e5a5db47909c8ab5cb242e40 /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_ttm_helper.ko OK 38292b862cf3ff87489508fdb4895efa45780813 /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/qxl/qxl.ko OK cdf51e58609bf2ce4837a7b195e0ccae0a930907 /lib/modules/5.10.0-rc2speed+/kernel/arch/x86/crypto/crc32-pclmul.ko OK 5ca8958388f6688452ecc2cb83d6031394c659ad /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm.ko OK 236bc4e4f38bf3559007566cb32b3dcc1bc28d2d /lib/modules/5.10.0-rc2speed+/kernel/drivers/gpu/drm/drm_kms_helper.ko OK 5784f813b727a50cfd3363234aef9fcbab685cc4 /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko OK 66db2be3efaa43bb5a5c481986e9554e1885cc69 /usr/lib/systemd/systemd OK 7db607d9f2de89860d9639712da64c8bacd31e4b /usr/lib64/libm-2.30.so OK 55b5f9652e1d17c1dd58f62628d5063428e5db91 /usr/lib64/libudev.so.1.6.15 OK 63b97070bf097130713bb6c89cf7100b5f3c9b17 /usr/lib64/libunistring.so.2.1.0 ... Once perf data is specified, no other file can be specified in the option, otherwise it causes syntax error. Signed-off-by: Jiri Olsa --- .../perf/Documentation/perf-buildid-cache.txt | 12 +- tools/perf/builtin-buildid-cache.c| 215 +- tools/perf/util/probe-event.c | 6 +- 3 files changed, 227 insertions(+), 6 deletions(-) diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt index f6de0952ff3c..b77da5138bca 100644 --- a/tools/perf/Documentation/perf-buildid-cache.txt +++ b/tools/perf/Documentation/perf-buildid-cache.txt @@ -23,7 +23,17 @@ OPTIONS --- -a:: --add=:: -Add specified file to the cache. +Add specified file or perf.data binaries to the cache. + +If the file is detected to be perf data file, it is processed +and all dso objects with sample hit are stored to the cache. + +It's possible to specify 'all' to store all dso objects, like: +-a perf.data,all + +Once perf data is specified, no other file can be specified in +the option, otherwise it causes syntax error. + -f:: --force:: Don't complain, do it. diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c index a25411926e48..0bfb54ee1e5e 100644 --- a/tools/perf/builtin-buildid-cache.c +++ b/tools/perf/builtin-buildid-cache.c @@ -29,6 +29,11 @@ #include "util/probe-file.h" #include #include +#include +#include +#ifdef HAVE_DEBUGINFOD_SUPPORT +#include +#endif static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid) { @@ -348,6 +353,205 @@ static int build_id_cache__show_all(void) return 0; } +#ifdef HAVE_DEBUGINFOD_SUPPORT +static int call_debuginfod(const char *sbuild_id, char **path, bool debuginfo) +{ + debuginfod_client *c; + int fd; + + c = debuginfod_begin(); + if (c == NULL) + return -1; + +