From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3CBE236435; Tue, 17 Jun 2025 16:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750178568; cv=none; b=m2dvr3mD/NylOPTVlHiwKjCVuGZOQNGXhoWXn3gMHdf+AfUTQcZbzTOrqNbF4ocIIIYchbSDLxcYfFt9vFeSf7V4XI39RKaDWuKhBKNPOv6ZEQR1Ln4kDntkG6+uhDHF3HNtIw/bmDzSvyxMotSSnukk6VRYmHaqK7Vr8XJ/dCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750178568; c=relaxed/simple; bh=Bdy664Lx0aO6RyyzFvyzDNh4IpctPAAKZpdUNmc/RxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pUHFZn3CE9o5+FNXhb3kMEJR1uQub1HWks88bot3PSsPZ0uCPtPLGQyaWIAYJe/mmOeGvj4I9gX7+GDZpRo3dKjd1dOhO1z8N1u6pTnCxXWtZ+dtIbMlGVMlfKFbqBqhViPD9QMPFKtBjBPFr8PfMwrOVKC/LY/m6GSrscPpjUY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HE8FBw5N; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HE8FBw5N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2094C4CEE3; Tue, 17 Jun 2025 16:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750178568; bh=Bdy664Lx0aO6RyyzFvyzDNh4IpctPAAKZpdUNmc/RxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HE8FBw5NtyJ71xDUSEZUcFe91um8nN745K2xXWZTxn4EaDQNRPuXIKvO5nUyVsX6W rWuQcnrv8UYw8md5Mzw/O/uI8sXtkfJUvsKB2EVaWSovj1Bmpx2vY7lJvtQWcFRkdi KCR0Di24jjL0MMg2u3WSqXv+o+OyQO8wSDu1O074= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ian Rogers , Adrian Hunter , Alexander Shishkin , Andi Kleen , Athira Rajeev , Ben Gainey , Chaitanya S Prakash , Charlie Jenkins , Chun-Tse Shao , Colin Ian King , Dmitriy Vyukov , "Dr. David Alan Gilbert" , Graham Woodward , Howard Chu , Ilkka Koskinen , Ingo Molnar , James Clark , Jiri Olsa , John Garry , Kajol Jain , Kan Liang , =?UTF-8?q?Krzysztof=20=C5=81opatowski?= , Leo Yan , Levi Yun , Li Huafei , linux-arm-kernel@lists.infradead.org, Mark Rutland , =?UTF-8?q?Martin=20Li=C5=A1ka?= , Masami Hiramatsu , Matt Fleming , Mike Leach , Namhyung Kim , Peter Zijlstra , Ravi Bangoria , Song Liu , "Steinar H. Gunderson" , Stephen Brennan , Steve Clevenger , Thomas Falcon , Veronika Molnarova , Weilin Wang , Will Deacon , Yicong Yang , Yujie Liu , Zhongqiu Han , Zixian Cai , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.15 487/780] perf callchain: Always populate the addr_location map when adding IP Date: Tue, 17 Jun 2025 17:23:15 +0200 Message-ID: <20250617152511.321697149@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152451.485330293@linuxfoundation.org> References: <20250617152451.485330293@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ian Rogers [ Upstream commit a913ef6fd883c05bd6538ed21ee1e773f0d750b7 ] Dropping symbols also meant the callchain maps wasn't populated, but the callchain map is needed to find the DSO. Plumb the symbols option better, falling back to thread__find_map() rather than thread__find_symbol() when symbols are disabled. Fixes: 02b2705017d2e5ad ("perf callchain: Allow symbols to be optional when resolving a callchain") Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Athira Rajeev Cc: Ben Gainey Cc: Chaitanya S Prakash Cc: Charlie Jenkins Cc: Chun-Tse Shao Cc: Colin Ian King Cc: Dmitriy Vyukov Cc: Dr. David Alan Gilbert Cc: Graham Woodward Cc: Howard Chu Cc: Ilkka Koskinen Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Krzysztof Łopatowski Cc: Leo Yan Cc: Levi Yun Cc: Li Huafei Cc: linux-arm-kernel@lists.infradead.org Cc: Mark Rutland Cc: Martin Liška Cc: Masami Hiramatsu Cc: Matt Fleming Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Song Liu Cc: Steinar H. Gunderson Cc: Stephen Brennan Cc: Steve Clevenger Cc: Thomas Falcon Cc: Veronika Molnarova Cc: Weilin Wang Cc: Will Deacon Cc: Yicong Yang Cc: Yujie Liu Cc: Zhongqiu Han Cc: Zixian Cai Link: https://lore.kernel.org/r/20250529044000.759937-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/machine.c | 6 ++++-- tools/perf/util/thread.c | 8 ++++++-- tools/perf/util/thread.h | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 2531b373f2cf7..b048165b10c14 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1976,7 +1976,7 @@ static void ip__resolve_ams(struct thread *thread, * Thus, we have to try consecutively until we find a match * or else, the symbol is unknown */ - thread__find_cpumode_addr_location(thread, ip, &al); + thread__find_cpumode_addr_location(thread, ip, /*symbols=*/true, &al); ams->addr = ip; ams->al_addr = al.addr; @@ -2078,7 +2078,7 @@ static int add_callchain_ip(struct thread *thread, al.sym = NULL; al.srcline = NULL; if (!cpumode) { - thread__find_cpumode_addr_location(thread, ip, &al); + thread__find_cpumode_addr_location(thread, ip, symbols, &al); } else { if (ip >= PERF_CONTEXT_MAX) { switch (ip) { @@ -2106,6 +2106,8 @@ static int add_callchain_ip(struct thread *thread, } if (symbols) thread__find_symbol(thread, *cpumode, ip, &al); + else + thread__find_map(thread, *cpumode, ip, &al); } if (al.sym != NULL) { diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 89585f53c1d5c..10a01f8fbd400 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -410,7 +410,7 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp, bo } void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, - struct addr_location *al) + bool symbols, struct addr_location *al) { size_t i; const u8 cpumodes[] = { @@ -421,7 +421,11 @@ void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, }; for (i = 0; i < ARRAY_SIZE(cpumodes); i++) { - thread__find_symbol(thread, cpumodes[i], addr, al); + if (symbols) + thread__find_symbol(thread, cpumodes[i], addr, al); + else + thread__find_map(thread, cpumodes[i], addr, al); + if (al->map) break; } diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index cd574a896418a..2b90bbed7a612 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -126,7 +126,7 @@ struct symbol *thread__find_symbol_fb(struct thread *thread, u8 cpumode, u64 addr, struct addr_location *al); void thread__find_cpumode_addr_location(struct thread *thread, u64 addr, - struct addr_location *al); + bool symbols, struct addr_location *al); int thread__memcpy(struct thread *thread, struct machine *machine, void *buf, u64 ip, int len, bool *is64bit); -- 2.39.5