From nobody Mon Feb 9 06:25:01 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B9093783C3 for ; Thu, 22 Jan 2026 16:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769100901; cv=none; b=uchySTRGgDVe/Iw6RyKcVHIAkxAUCkfE7FHDhtNqJH9rZGj8LDRkVON0D6akB90qWYgwqT9wTU1g4bYSWDMq+FrzV50YPScaX5uED5TNbDHW6xXzdfipECcwVB/HU0PYcgZqPTh06/k2FzFrNn7q3Iu3ufibu9A7Yy9LoI2Ef9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769100901; c=relaxed/simple; bh=Fw5zeAM2zfnnadmaZE6GhH2s1pBqPvkeHIHlR9oq9uk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=ohEHkXRIHv3Fc3ywCM3WfyDZhCq0ldrE2fk/UC0fk0OHGsHAT5ci9Z4sEPBsefOsKzvHfk7TfIKaxL/SKMRDAmeZLlcFwyXA0Ci4BKnjH3qNmTI4LCbPI50LyTYORgAhf8mrwZwHNS2XDI1BcZhhKvO70mB9UBWUfmXkF5EJdNM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=vTAaLbmN; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vTAaLbmN" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-123349958b2so4890496c88.0 for ; Thu, 22 Jan 2026 08:54:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769100873; x=1769705673; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ad2GwIvXnuBM0K5HE3V72oHuf8IYiJKy1/A8wVQtlzk=; b=vTAaLbmNCYOrfQFpAB+GzHKt7eJQuE51VXLZSkLl46TWr0V35cBuKAK9uUyKEW7x6v x+iD1E+7ZNpG/8A0zEu9LRZ8gBPggtDULy6bq+BQtDXOOgn3yix6BNvCu953ljh3xS7m A/sOy6pNBEgZeefqVHu9ZSuOIBcS8AnNz5OnKL1f4v7xwjYoLBlcMl6lphwRHzx1Pifd OUDmcTXRTwSaacpf3PPZk0Noq7S+kjsK2mjBbxOzHQTE+nog/nbBlO314Sj8IMFlRgHU FoovNyqe8z4m/Pg0LsHS4IBsMv4DzLNput88ZSIY08vJ5rMuMvBKqEcOWxgHrgLl3dxn e6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769100873; x=1769705673; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ad2GwIvXnuBM0K5HE3V72oHuf8IYiJKy1/A8wVQtlzk=; b=kheBDn+MuvRig5c3bQ5/qxrRdYNbXCzqMy654KZ/SAa16LwNRbI0qacjdyMj31R1Ol IFEJF/HqF4U/7obHFv83IMzCBurehENd/mbxXVvptaBU5Utr5rJ3X7QdkIQUicn7oXU2 mgOWDpWKdjYXc+Wy99YGO+TsQ8AFDcvez2KVlbyZoPXnG+5LonjZO18kIPadFw+ICiE5 Uwgk/iEo5+D0ZkO60Y4meC9WxKXQ4OJ9CQPA7VvKZRBhAvjifbcmT+mbnfcwIjLQp0ny B9z63jm4U85hxqZEijbHKkDeNhKddNbwJvLi1f0rPY4l/SbUqyW0I/DA0UgW9azVSipU o2LA== X-Forwarded-Encrypted: i=1; AJvYcCVIvC9AO2T6Fj88NlIUYBXRWyLJCxv1itHKcjSQmd2dn29VsaGF9kJji8Pq9pN2O4sU4SHr5nyLPjWulHY=@vger.kernel.org X-Gm-Message-State: AOJu0YxKUhCxWD7qJZ/JOAKRyy1fi91CNjAOQFRQkxLDQS55nen97VY2 YBVGn/FySiXvrX2OtvpH7pjgWi3rxUbh6v/tBIKJ+pGr2TioI4J6DPyg6l9TShRq1qFrm3uNif0 B1OlnSO60jg== X-Received: from dld13.prod.google.com ([2002:a05:7022:30d:b0:121:79a7:ec2d]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:128b:b0:11f:3483:bbb0 with SMTP id a92af1059eb24-1244a72aef2mr18517708c88.19.1769100873225; Thu, 22 Jan 2026 08:54:33 -0800 (PST) Date: Thu, 22 Jan 2026 08:54:05 -0800 In-Reply-To: <20260122165407.561888-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260122165407.561888-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260122165407.561888-11-irogers@google.com> Subject: [PATCH v2 10/12] perf map_symbol: Switch from holding maps to holding thread From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , John Garry , Will Deacon , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Zecheng Li , Tianyou Li , Thomas Falcon , Julia Lawall , Suchit Karunakaran , Athira Rajeev , Aditya Bodkhe , Howard Chu , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , "Dr. David Alan Gilbert" , Shimin Guo , Sergei Trofimovich , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Ian Rogers --- tools/perf/ui/browsers/annotate.c | 2 +- tools/perf/ui/browsers/hists.c | 3 ++- tools/perf/util/addr_location.c | 4 ---- tools/perf/util/addr_location.h | 1 - .../util/annotate-arch/annotate-loongarch.c | 5 +++-- tools/perf/util/annotate-arch/annotate-s390.c | 3 ++- tools/perf/util/callchain.c | 12 +++++++----- tools/perf/util/capstone.c | 6 ++++-- tools/perf/util/db-export.c | 1 - tools/perf/util/disasm.c | 7 ++++--- tools/perf/util/event.c | 2 -- tools/perf/util/hist.c | 18 +++++++++--------- tools/perf/util/machine.c | 13 +++++++------ tools/perf/util/map_symbol.c | 5 +++-- tools/perf/util/map_symbol.h | 3 ++- tools/perf/util/sort.c | 2 +- tools/perf/util/unwind-libdw.c | 2 +- tools/perf/util/unwind-libunwind-local.c | 2 +- 18 files changed, 47 insertions(+), 44 deletions(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/ann= otate.c index 3df61cd46652..91ded9c271ee 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -601,7 +601,7 @@ static bool annotate_browser__callq(struct annotate_bro= wser *browser, return true; } =20 - target_ms.maps =3D ms->maps; + target_ms.thread =3D ms->thread; target_ms.map =3D ms->map; target_ms.sym =3D dl->ops.target.sym; annotation__unlock(notes); diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 08fecbe28a52..cfa6386e6e1d 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -3189,7 +3189,8 @@ static int evsel__hists_browse(struct evsel *evsel, i= nt nr_events, const char *h case 'k': if (browser->selection !=3D 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 =3D (verbose + 1) % 4; diff --git a/tools/perf/util/addr_location.c b/tools/perf/util/addr_locatio= n.c index 81a0b79c5e10..57e8217a00f9 100644 --- a/tools/perf/util/addr_location.c +++ b/tools/perf/util/addr_location.c @@ -7,7 +7,6 @@ void addr_location__init(struct addr_location *al) { al->thread =3D NULL; - al->maps =3D NULL; al->map =3D NULL; al->sym =3D NULL; al->srcline =3D 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); } =20 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 =3D *src; dst->thread =3D thread__get(src->thread); - dst->maps =3D maps__get(src->maps); dst->map =3D map__get(src->map); } diff --git a/tools/perf/util/addr_location.h b/tools/perf/util/addr_locatio= n.h index 64b551025216..fdc4d3f3a68b 100644 --- a/tools/perf/util/addr_location.h +++ b/tools/perf/util/addr_location.h @@ -11,7 +11,6 @@ struct symbol; =20 struct addr_location { struct thread *thread; - struct maps *maps; struct map *map; struct symbol *sym; const char *srcline; diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/per= f/util/annotate-arch/annotate-loongarch.c index 79dc116ade2f..6c94cb98a104 100644 --- a/tools/perf/util/annotate-arch/annotate-loongarch.c +++ b/tools/perf/util/annotate-arch/annotate-loongarch.c @@ -11,6 +11,7 @@ #include "../map.h" #include "../maps.h" #include "../symbol.h" +#include "../thread.h" =20 static int loongarch_call__parse(const struct arch *arch, struct ins_opera= nds *ops, struct map_symbol *ms, @@ -49,7 +50,7 @@ static int loongarch_call__parse(const struct arch *arch,= struct ins_operands *o .addr =3D map__objdump_2mem(map, ops->target.addr), }; =20 - if (maps__find_ams(ms->maps, &target) =3D=3D 0 && + if (maps__find_ams(thread__maps(ms->thread), &target) =3D=3D 0 && map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.ad= dr)) =3D=3D ops->target.addr) ops->target.sym =3D target.ms.sym; =20 @@ -93,7 +94,7 @@ static int loongarch_jump__parse(const struct arch *arch,= struct ins_operands *o =20 ops->target.outside =3D target.addr < start || target.addr > end; =20 - if (maps__find_ams(ms->maps, &target) =3D=3D 0 && + if (maps__find_ams(thread__maps(ms->thread), &target) =3D=3D 0 && map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.ad= dr)) =3D=3D ops->target.addr) ops->target.sym =3D target.ms.sym; =20 diff --git a/tools/perf/util/annotate-arch/annotate-s390.c b/tools/perf/uti= l/annotate-arch/annotate-s390.c index 7b2d27b62e6b..47573f0310c1 100644 --- a/tools/perf/util/annotate-arch/annotate-s390.c +++ b/tools/perf/util/annotate-arch/annotate-s390.c @@ -6,6 +6,7 @@ #include "../map.h" #include "../maps.h" #include "../symbol.h" +#include "../thread.h" #include "../annotate.h" #include "../annotate-data.h" =20 @@ -49,7 +50,7 @@ static int s390_call__parse(const struct arch *arch, stru= ct ins_operands *ops, .addr =3D map__objdump_2mem(map, ops->target.addr), }; =20 - if (maps__find_ams(ms->maps, &target) =3D=3D 0 && + if (maps__find_ams(thread__maps(ms->thread), &target) =3D=3D 0 && map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.ad= dr)) =3D=3D ops->target.addr) ops->target.sym =3D target.ms.sym; =20 diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 428e5350d7a2..515bb8b5da01 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -31,6 +31,7 @@ #include "callchain.h" #include "branch.h" #include "symbol.h" +#include "thread.h" #include "util.h" #include "../perf.h" =20 @@ -1042,7 +1043,7 @@ merge_chain_branch(struct callchain_cursor *cursor, =20 list_for_each_entry_safe(list, next_list, &src->val, list) { struct map_symbol ms =3D { - .maps =3D maps__get(list->ms.maps), + .thread =3D thread__get(list->ms.thread), .map =3D map__get(list->ms.map), }; callchain_cursor_append(cursor, list->ip, &ms, false, NULL, 0, 0, 0, lis= t->srcline); @@ -1147,10 +1148,11 @@ int hist_entry__append_callchain(struct hist_entry = *he, struct perf_sample *samp int fill_callchain_info(struct addr_location *al, struct callchain_cursor_= node *node, bool hide_unresolved) { - struct machine *machine =3D node->ms.maps ? maps__machine(node->ms.maps) = : NULL; + struct machine *machine =3D NULL; + + if (node->ms.thread) + machine =3D maps__machine(thread__maps(node->ms.thread)); =20 - maps__put(al->maps); - al->maps =3D maps__get(node->ms.maps); map__put(al->map); al->map =3D map__get(node->ms.map); al->sym =3D node->ms.sym; @@ -1163,7 +1165,7 @@ int fill_callchain_info(struct addr_location *al, str= uct callchain_cursor_node * if (al->map =3D=3D NULL) goto out; } - if (maps__equal(al->maps, machine__kernel_maps(machine))) { + if (maps__equal(thread__maps(al->thread), machine__kernel_maps(machine)))= { if (machine__is_host(machine)) { al->cpumode =3D PERF_RECORD_MISC_KERNEL; al->level =3D 'k'; diff --git a/tools/perf/util/capstone.c b/tools/perf/util/capstone.c index ce06cfd253ef..9216916f848f 100644 --- a/tools/perf/util/capstone.c +++ b/tools/perf/util/capstone.c @@ -268,7 +268,8 @@ int symbol__disassemble_capstone(const char *filename _= _maybe_unused, !strcmp(args->options->disassembler_style, "att")) disassembler_style =3D true; =20 - if (capstone_init(maps__machine(args->ms->maps), &handle, is_64bit, disas= sembler_style) < 0) + if (capstone_init(maps__machine(thread__maps(args->ms->thread)), &handle,= is_64bit, + disassembler_style) < 0) goto err; =20 needs_cs_close =3D true; @@ -382,7 +383,8 @@ int symbol__disassemble_capstone_powerpc(const char *fi= lename __maybe_unused, !strcmp(args->options->disassembler_style, "att")) disassembler_style =3D true; =20 - if (capstone_init(maps__machine(args->ms->maps), &handle, is_64bit, disas= sembler_style) < 0) + if (capstone_init(maps__machine(thread__maps(args->ms->thread)), &handle,= is_64bit, + disassembler_style) < 0) goto err; =20 needs_cs_close =3D true; diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c index 8f52e8cefcf3..ae9a9065aab7 100644 --- a/tools/perf/util/db-export.c +++ b/tools/perf/util/db-export.c @@ -254,7 +254,6 @@ static struct call_path *call_path_from_sample(struct d= b_export *dbe, addr_location__init(&al); al.sym =3D node->ms.sym; al.map =3D map__get(node->ms.map); - al.maps =3D maps__get(thread__maps(thread)); al.addr =3D node->ip; al.thread =3D thread__get(thread); =20 diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c index 8c3e9094600a..d81469db0aac 100644 --- a/tools/perf/util/disasm.c +++ b/tools/perf/util/disasm.c @@ -28,6 +28,7 @@ #include "namespaces.h" #include "srcline.h" #include "symbol.h" +#include "thread.h" #include "util.h" =20 static regex_t file_lineno; @@ -277,7 +278,7 @@ static int call__parse(const struct arch *arch, struct = ins_operands *ops, struct .addr =3D map__objdump_2mem(map, ops->target.addr), }; =20 - if (maps__find_ams(ms->maps, &target) =3D=3D 0 && + if (maps__find_ams(thread__maps(ms->thread), &target) =3D=3D 0 && map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.ad= dr)) =3D=3D ops->target.addr) ops->target.sym =3D target.ms.sym; =20 @@ -411,7 +412,7 @@ static int jump__parse(const struct arch *arch, struct = ins_operands *ops, struct * Actual navigation will come next, with further understanding of how * the symbol searching and disassembly should be done. */ - if (maps__find_ams(ms->maps, &target) =3D=3D 0 && + if (maps__find_ams(thread__maps(ms->thread), &target) =3D=3D 0 && map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.ad= dr)) =3D=3D ops->target.addr) ops->target.sym =3D target.ms.sym; =20 @@ -1074,7 +1075,7 @@ static int symbol__parse_objdump_line(struct symbol *= sym, .ms =3D { .map =3D map__get(map), }, }; =20 - if (!maps__find_ams(args->ms->maps, &target) && + if (!maps__find_ams(thread__maps(args->ms->thread), &target) && target.ms.sym->start =3D=3D target.al_addr) dl->ops.target.sym =3D target.ms.sym; =20 diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 2dde1044b5a7..bc045fddf7d5 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -698,7 +698,6 @@ struct map *thread__find_map(struct thread *thread, u8 = cpumode, u64 addr, struct machine *machine =3D maps__machine(maps); bool load_map =3D false; =20 - maps__zput(al->maps); map__zput(al->map); thread__zput(al->thread); al->thread =3D thread__get(thread); @@ -736,7 +735,6 @@ struct map *thread__find_map(struct thread *thread, u8 = cpumode, u64 addr, =20 return NULL; } - al->maps =3D maps__get(maps); al->map =3D maps__find(maps, al->addr); if (al->map !=3D NULL) { /* diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index ef4b569f7df4..7ffaa3d9851b 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -251,7 +251,7 @@ void hists__calc_col_len(struct hists *hists, struct hi= st_entry *h) =20 if (h->cgroup) { const char *cgrp_name =3D "unknown"; - struct cgroup *cgrp =3D cgroup__find(maps__machine(h->ms.maps)->env, + struct cgroup *cgrp =3D cgroup__find(maps__machine(thread__maps(h->ms.th= read))->env, h->cgroup); if (cgrp !=3D NULL) cgrp_name =3D cgrp->name; @@ -536,7 +536,7 @@ static int hist_entry__init(struct hist_entry *he, memset(&he->stat, 0, sizeof(he->stat)); } =20 - he->ms.maps =3D maps__get(he->ms.maps); + he->ms.thread =3D thread__get(he->ms.thread); he->ms.map =3D map__get(he->ms.map); =20 if (he->branch_info) { @@ -552,9 +552,9 @@ static int hist_entry__init(struct hist_entry *he, memcpy(he->branch_info, template->branch_info, sizeof(*he->branch_info)); =20 - he->branch_info->from.ms.maps =3D maps__get(he->branch_info->from.ms.map= s); + he->branch_info->from.ms.thread =3D thread__get(he->branch_info->from.ms= .thread); he->branch_info->from.ms.map =3D map__get(he->branch_info->from.ms.map); - he->branch_info->to.ms.maps =3D maps__get(he->branch_info->to.ms.maps); + he->branch_info->to.ms.thread =3D thread__get(he->branch_info->to.ms.thr= ead); he->branch_info->to.ms.map =3D map__get(he->branch_info->to.ms.map); } =20 @@ -810,7 +810,7 @@ __hists__add_entry(struct hists *hists, }, .cgroup =3D sample->cgroup, .ms =3D { - .maps =3D al->maps, + .thread =3D al->thread, .map =3D al->map, .sym =3D al->sym, }, @@ -890,7 +890,7 @@ struct hist_entry *hists__add_entry_block(struct hists = *hists, .block_info =3D block_info, .hists =3D hists, .ms =3D { - .maps =3D al->maps, + .thread =3D al->thread, .map =3D al->map, .sym =3D al->sym, }, @@ -1020,8 +1020,8 @@ iter_next_branch_entry(struct hist_entry_iter *iter, = struct addr_location *al) if (iter->curr >=3D iter->total) return 0; =20 - maps__put(al->maps); - al->maps =3D maps__get(bi[i].to.ms.maps); + thread__put(al->thread); + al->thread =3D thread__get(bi[i].to.ms.thread); map__put(al->map); al->map =3D map__get(bi[i].to.ms.map); al->sym =3D bi[i].to.ms.sym; @@ -1232,7 +1232,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter= *iter, .comm =3D thread__comm(al->thread), .ip =3D al->addr, .ms =3D { - .maps =3D al->maps, + .thread =3D al->thread, .map =3D al->map, .sym =3D al->sym, }, diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 30d606fbf040..5b0f5a48ffd4 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -2016,7 +2016,7 @@ static void ip__resolve_ams(struct thread *thread, ams->addr =3D ip; ams->al_addr =3D al.addr; ams->al_level =3D al.level; - ams->ms.maps =3D maps__get(al.maps); + ams->ms.thread =3D thread__get(al.thread); ams->ms.sym =3D al.sym; ams->ms.map =3D map__get(al.map); ams->phys_addr =3D 0; @@ -2037,7 +2037,7 @@ static void ip__resolve_data(struct thread *thread, ams->addr =3D addr; ams->al_addr =3D al.addr; ams->al_level =3D al.level; - ams->ms.maps =3D maps__get(al.maps); + ams->ms.thread =3D thread__get(al.thread); ams->ms.sym =3D al.sym; ams->ms.map =3D map__get(al.map); ams->phys_addr =3D phys_addr; @@ -2120,7 +2120,7 @@ static int append_inlines(struct callchain_cursor *cu= rsor, struct map_symbol *ms } =20 ilist_ms =3D (struct map_symbol) { - .maps =3D maps__get(ms->maps), + .thread =3D thread__get(ms->thread), .map =3D map__get(map), }; list_for_each_entry(ilist, &inline_node->val, list) { @@ -2220,7 +2220,7 @@ static int add_callchain_ip(struct thread *thread, iter_cycles =3D iter->cycles; } =20 - ms.maps =3D maps__get(al.maps); + ms.thread =3D thread__get(al.thread); ms.map =3D map__get(al.map); ms.sym =3D al.sym; =20 @@ -2383,7 +2383,7 @@ static void save_lbr_cursor_node(struct thread *threa= d, map_symbol__exit(&lbr_stitch->prev_lbr_cursor[idx].ms); memcpy(&lbr_stitch->prev_lbr_cursor[idx], cursor->curr, sizeof(struct callchain_cursor_node)); - lbr_stitch->prev_lbr_cursor[idx].ms.maps =3D maps__get(cursor->curr->ms.m= aps); + lbr_stitch->prev_lbr_cursor[idx].ms.thread =3D thread__get(cursor->curr->= ms.thread); lbr_stitch->prev_lbr_cursor[idx].ms.map =3D map__get(cursor->curr->ms.map= ); =20 lbr_stitch->prev_lbr_cursor[idx].valid =3D true; @@ -2596,7 +2596,8 @@ static bool has_stitched_lbr(struct thread *thread, memcpy(&stitch_node->cursor, &lbr_stitch->prev_lbr_cursor[i], sizeof(struct callchain_cursor_node)); =20 - stitch_node->cursor.ms.maps =3D maps__get(lbr_stitch->prev_lbr_cursor[i]= .ms.maps); + stitch_node->cursor.ms.thread =3D + thread__get(lbr_stitch->prev_lbr_cursor[i].ms.thread); stitch_node->cursor.ms.map =3D map__get(lbr_stitch->prev_lbr_cursor[i].m= s.map); =20 if (callee) diff --git a/tools/perf/util/map_symbol.c b/tools/perf/util/map_symbol.c index 6ad2960bc289..11bc0a7f704c 100644 --- a/tools/perf/util/map_symbol.c +++ b/tools/perf/util/map_symbol.c @@ -2,10 +2,11 @@ #include "map_symbol.h" #include "maps.h" #include "map.h" +#include "thread.h" =20 void map_symbol__exit(struct map_symbol *ms) { - maps__zput(ms->maps); + thread__zput(ms->thread); map__zput(ms->map); } =20 @@ -16,7 +17,7 @@ void addr_map_symbol__exit(struct addr_map_symbol *ams) =20 void map_symbol__copy(struct map_symbol *dst, struct map_symbol *src) { - dst->maps =3D maps__get(src->maps); + dst->thread =3D thread__get(src->thread); dst->map =3D map__get(src->map); dst->sym =3D src->sym; } diff --git a/tools/perf/util/map_symbol.h b/tools/perf/util/map_symbol.h index e370bb32ed47..7437e319f4a3 100644 --- a/tools/perf/util/map_symbol.h +++ b/tools/perf/util/map_symbol.h @@ -4,12 +4,13 @@ =20 #include =20 +struct thread; struct maps; struct map; struct symbol; =20 struct map_symbol { - struct maps *maps; + struct thread *thread; struct map *map; struct symbol *sym; }; diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index f963d61ac166..01a9d73ae348 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -1016,7 +1016,7 @@ static int hist_entry__cgroup_snprintf(struct hist_en= try *he, const char *cgrp_name =3D "N/A"; =20 if (he->cgroup) { - struct cgroup *cgrp =3D cgroup__find(maps__machine(he->ms.maps)->env, + struct cgroup *cgrp =3D cgroup__find(maps__machine(thread__maps(he->ms.t= hread))->env, he->cgroup); if (cgrp !=3D NULL) cgrp_name =3D cgrp->name; diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index c1646ef5f971..9cb0960ef905 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c @@ -161,7 +161,7 @@ static int entry(u64 ip, struct unwind_info *ui) } =20 e->ip =3D ip; - e->ms.maps =3D maps__get(al.maps); + e->ms.thread =3D thread__get(al.thread); e->ms.map =3D map__get(al.map); e->ms.sym =3D al.sym; =20 diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unw= ind-libunwind-local.c index a24b45106acd..ecf0c01fe51f 100644 --- a/tools/perf/util/unwind-libunwind-local.c +++ b/tools/perf/util/unwind-libunwind-local.c @@ -666,7 +666,7 @@ static int entry(u64 ip, struct thread *thread, e.ms.sym =3D thread__find_symbol(thread, PERF_RECORD_MISC_USER, ip, &al); e.ip =3D ip; e.ms.map =3D al.map; - e.ms.maps =3D al.maps; + e.ms.thread =3D thread__get(al.thread); =20 pr_debug("unwind: %s:ip =3D 0x%" PRIx64 " (0x%" PRIx64 ")\n", al.sym ? al.sym->name : "''", --=20 2.52.0.457.g6b5491de43-goog