perf tools: Automatically use guest kcore_dir if present
When registering a guest machine using machine_pid from the id index, check perf.data for a matching kcore_dir subdirectory and set the kallsyms file name accordingly. If set, use it to find the machine's kernel symbols and object code (from kcore). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: kvm@vger.kernel.org Link: https://lore.kernel.org/r/20220711093218.10967-23-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
65691e9ff0
commit
a5367ecb53
5 changed files with 27 additions and 2 deletions
|
|
@ -518,6 +518,25 @@ char *perf_data__kallsyms_name(struct perf_data *data)
|
|||
return kallsyms_name;
|
||||
}
|
||||
|
||||
char *perf_data__guest_kallsyms_name(struct perf_data *data, pid_t machine_pid)
|
||||
{
|
||||
char *kallsyms_name;
|
||||
struct stat st;
|
||||
|
||||
if (!data->is_dir)
|
||||
return NULL;
|
||||
|
||||
if (asprintf(&kallsyms_name, "%s/kcore_dir__%d/kallsyms", data->path, machine_pid) < 0)
|
||||
return NULL;
|
||||
|
||||
if (stat(kallsyms_name, &st)) {
|
||||
free(kallsyms_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return kallsyms_name;
|
||||
}
|
||||
|
||||
bool is_perf_data(const char *path)
|
||||
{
|
||||
bool ret = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue