Skip to content

Commit

Permalink
perf kcore_copy: Do not check /proc/modules is unchanged
Browse files Browse the repository at this point in the history
/proc/kallsyms and /proc/modules are compared before and after the copy
in order to ensure no changes during the copy.

However /proc/modules also might change due to reference counts changing
even though that does not make any difference.

Any modules loaded or unloaded should be visible in changes to kallsyms,
so it is not necessary to check /proc/modules also anyway.

Remove the comparison checking that /proc/modules is unchanged.

Fixes: fc1b691 ("perf buildid-cache: Add ability to add kcore to the cache")
Reported-by: Daniel Dao <dqminh@cloudflare.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Daniel Dao <dqminh@cloudflare.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Sep 21, 2022
1 parent 6cc4479 commit 5b427df
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tools/perf/util/symbol-elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2102,8 +2102,8 @@ static int kcore_copy__compare_file(const char *from_dir, const char *to_dir,
* unusual. One significant peculiarity is that the mapping (start -> pgoff)
* is not the same for the kernel map and the modules map. That happens because
* the data is copied adjacently whereas the original kcore has gaps. Finally,
* kallsyms and modules files are compared with their copies to check that
* modules have not been loaded or unloaded while the copies were taking place.
* kallsyms file is compared with its copy to check that modules have not been
* loaded or unloaded while the copies were taking place.
*
* Return: %0 on success, %-1 on failure.
*/
Expand Down Expand Up @@ -2166,9 +2166,6 @@ int kcore_copy(const char *from_dir, const char *to_dir)
goto out_extract_close;
}

if (kcore_copy__compare_file(from_dir, to_dir, "modules"))
goto out_extract_close;

if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms"))
goto out_extract_close;

Expand Down

0 comments on commit 5b427df

Please sign in to comment.