Commit c4e3a003 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo
Browse files

perf map_symbol: Switch from holding maps to holding thread



maps may belong to >1 thread. In contexts like symbolization
information from the thread may be useful, such as the ELF machine.

As the maps can be gained from the thread switch from holding maps in
struct map_symbol to holding the thread.

Holding the maps in addr_location is also redundant, switch this to
using thread__maps.

Reviewed-by: default avatarJames Clark <james.clark@linaro.org>
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Cc: Will Deacon <will@kernel.org>
Cc: Zecheng Li <zecheng@google.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 5301cc69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -601,7 +601,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
		return true;
	}

	target_ms.maps = ms->maps;
	target_ms.thread = ms->thread;
	target_ms.map = ms->map;
	target_ms.sym = dl->ops.target.sym;
	annotation__unlock(notes);
+2 −1
Original line number Diff line number Diff line
@@ -3189,7 +3189,8 @@ static int evsel__hists_browse(struct evsel *evsel, int nr_events, const char *h
		case 'k':
			if (browser->selection != NULL)
				hists_browser__zoom_map(browser,
					      maps__machine(browser->selection->maps)->vmlinux_map);
					maps__machine(thread__maps(browser->selection->thread)
						     )->vmlinux_map);
			continue;
		case 'V':
			verbose = (verbose + 1) % 4;
+0 −4
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
void addr_location__init(struct addr_location *al)
{
	al->thread = NULL;
	al->maps = NULL;
	al->map = NULL;
	al->sym = NULL;
	al->srcline = NULL;
@@ -30,16 +29,13 @@ void addr_location__exit(struct addr_location *al)
{
	map__zput(al->map);
	thread__zput(al->thread);
	maps__zput(al->maps);
}

void addr_location__copy(struct addr_location *dst, struct addr_location *src)
{
	thread__put(dst->thread);
	maps__put(dst->maps);
	map__put(dst->map);
	*dst = *src;
	dst->thread = thread__get(src->thread);
	dst->maps = maps__get(src->maps);
	dst->map = map__get(src->map);
}
+0 −1
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ struct symbol;

struct addr_location {
	struct thread *thread;
	struct maps   *maps;
	struct map    *map;
	struct symbol *sym;
	const char    *srcline;
+3 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include "../map.h"
#include "../maps.h"
#include "../symbol.h"
#include "../thread.h"

static int loongarch_call__parse(const struct arch *arch, struct ins_operands *ops,
				 struct map_symbol *ms,
@@ -49,7 +50,7 @@ static int loongarch_call__parse(const struct arch *arch, struct ins_operands *o
		.addr = map__objdump_2mem(map, ops->target.addr),
	};

	if (maps__find_ams(ms->maps, &target) == 0 &&
	if (maps__find_ams(thread__maps(ms->thread), &target) == 0 &&
	    map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
		ops->target.sym = target.ms.sym;

@@ -93,7 +94,7 @@ static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *o

	ops->target.outside = target.addr < start || target.addr > end;

	if (maps__find_ams(ms->maps, &target) == 0 &&
	if (maps__find_ams(thread__maps(ms->thread), &target) == 0 &&
	    map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
		ops->target.sym = target.ms.sym;

Loading