Hi Jiri, On Mon, Jun 5, 2017 at 6:58 PM, Jiri Olsa <[email protected]> wrote: > On Sat, Jun 03, 2017 at 11:00:31AM +0900, Namhyung Kim wrote: >> Move decompress_kmodule() to util/dso.c and split it to two functions >> returning fd and (decompressed) file path. Existing user only wants the >> fd version but the path version will be used soon. >> >> Signed-off-by: Namhyung Kim <[email protected]> >> --- >> tools/perf/util/dso.c | 51 >> ++++++++++++++++++++++++++++++++++++++++++++ >> tools/perf/util/dso.h | 3 +++ >> tools/perf/util/symbol-elf.c | 36 +------------------------------ >> 3 files changed, 55 insertions(+), 35 deletions(-) >> >> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c >> index b27d127cdf68..fc4747a8c283 100644 >> --- a/tools/perf/util/dso.c >> +++ b/tools/perf/util/dso.c >> @@ -248,6 +248,57 @@ bool dso__needs_decompress(struct dso *dso) >> dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; >> } >> >> +static int decompress_kmodule(struct dso *dso, const char *name, char >> *tmpbuf) >> +{ >> + int fd = -1; >> + struct kmod_path m; >> + >> + if (!dso__needs_decompress(dso)) >> + return -1; > > the original code had also DSO_BINARY_TYPE__BUILD_ID_CACHE check, > not sure why though.. ;-)
It's because decompressed modules which were found in the build-id cache didn't set dso->symtab_type properly. It was fixed by my previous patch so checking symtab_type will cover the (compressed) build-id cache case too now. Thanks, Namhyung

