Commit 36cee69f authored by Namhyung Kim's avatar Namhyung Kim

perf tools: Do not remove addr_location.thread in thread__find_map()

The thread__find_map() is to find a map for a given address in the
given thread's address space.  It searches maps based on the cpu mode
and fills various information in the addr_location data structure.

It might change al->maps and al->map, but not al->thread.  Then I
think no reason to not set the al->thread at the beginning.

Also get rid of the duplicate 'al->map = NULL' part.

Fixes: 0dd5041c ("perf addr_location: Add init/exit/copy functions")
Acked-by: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarJames Clark <james.clark@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 628eaa4e
...@@ -581,15 +581,14 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, ...@@ -581,15 +581,14 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
maps__zput(al->maps); maps__zput(al->maps);
map__zput(al->map); map__zput(al->map);
thread__zput(al->thread); thread__zput(al->thread);
al->thread = thread__get(thread);
al->addr = addr; al->addr = addr;
al->cpumode = cpumode; al->cpumode = cpumode;
al->filtered = 0; al->filtered = 0;
if (machine == NULL) { if (machine == NULL)
al->map = NULL;
return NULL; return NULL;
}
if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) { if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
al->level = 'k'; al->level = 'k';
...@@ -605,7 +604,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, ...@@ -605,7 +604,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
al->level = 'u'; al->level = 'u';
} else { } else {
al->level = 'H'; al->level = 'H';
al->map = NULL;
if ((cpumode == PERF_RECORD_MISC_GUEST_USER || if ((cpumode == PERF_RECORD_MISC_GUEST_USER ||
cpumode == PERF_RECORD_MISC_GUEST_KERNEL) && cpumode == PERF_RECORD_MISC_GUEST_KERNEL) &&
...@@ -619,7 +617,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr, ...@@ -619,7 +617,6 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
return NULL; return NULL;
} }
al->maps = maps__get(maps); al->maps = maps__get(maps);
al->thread = thread__get(thread);
al->map = map__get(maps__find(maps, al->addr)); al->map = map__get(maps__find(maps, al->addr));
if (al->map != NULL) { if (al->map != NULL) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment