From nobody Fri Dec 19 20:38:09 2025 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0BA51A76BC; Wed, 8 Jan 2025 10:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736331610; cv=none; b=gOyfFk/j/4vcwpfP4XLXQL03Kvd3L84Ef+/k2B44EXy7vnoDFRy06V1y8zE2E0XrtfwBHWz7pkRupxzUAkb3WM8CebxXXvmF1ybcqfQay2oVRbO+ECsMUHn9/CJtMu/nyKmF5fY8Ozt6J0zVdf0oiXHORLHxnx2w8GbW6ZMuEO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736331610; c=relaxed/simple; bh=aS/ZNfXIjryjj5nOlcTWB1iEKCpllVRaNmysQEkDomU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rDDdbmfFwrmdzp6vKhL2Me2xycI7+zFeBgRp9WuNBIGDtk08yCHsz/6W95Jc7wpAS/qmI5LNM6n8ggck40XpHNEB8uObBVIWkmq1iVYFZ9wu4Ns6A3WCZkC3dGEsCRydAgQ6LWA+CAiFDo1WZE7goc+RiyJtQwSGG2L4hN5MsRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4YSjtl6Lmzz9sPd; Wed, 8 Jan 2025 10:54:23 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I1ahVG1ecuQY; Wed, 8 Jan 2025 10:54:23 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4YSjtl5TCfz9rvV; Wed, 8 Jan 2025 10:54:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A7CDE8B768; Wed, 8 Jan 2025 10:54:23 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0zJmuMvXIIQ5; Wed, 8 Jan 2025 10:54:23 +0100 (CET) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.235.99]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 069258B767; Wed, 8 Jan 2025 10:54:22 +0100 (CET) From: Christophe Leroy To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH v2] perf: Fix display of kernel symbols Date: Wed, 8 Jan 2025 10:54:20 +0100 Message-ID: <2ea4501209d5363bac71a6757fe91c0747558a42.1736329923.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.47.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1736330060; l=2170; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=aS/ZNfXIjryjj5nOlcTWB1iEKCpllVRaNmysQEkDomU=; b=Z4Xvjo3Ubo9KZUR3Sfefad8rhGPY4SVug257NxyG9MhFE4E+egMqtewWN8CabnRwYGhNCe8qs T0kvu0s7piiDUICSW3h8OJ/YRA4oP00x1pJZtnPMAg0GuP+zhnOGX8d X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since commit 659ad3492b91 ("perf maps: Switch from rbtree to lazily sorted array for addresses"), perf doesn't display anymore kernel symbols on powerpc, allthough it still detects them as kernel addresses. # Overhead Command Shared Object Symbol # ........ .......... ............. ....................................= .. # 80.49% Coeur main [unknown] [k] 0xc005f0f8 3.91% Coeur main gau [.] engine_loop.constprop.0.isra.0 1.72% Coeur main [unknown] [k] 0xc005f11c 1.09% Coeur main [unknown] [k] 0xc01f82c8 0.44% Coeur main libc.so.6 [.] epoll_wait 0.38% Coeur main [unknown] [k] 0xc0011718 0.36% Coeur main [unknown] [k] 0xc01f45c0 This is because function maps__find_next_entry() now returns current entry instead of next entry, leading to kernel map end address getting mis-configured with its own start address instead of the start address of the following map. Fix it by really taking the next entry, also make sure that entry follows current one by making sure entries are sorted. Fixes: 659ad3492b91 ("perf maps: Switch from rbtree to lazily sorted array = for addresses") Signed-off-by: Christophe Leroy Reviewed-by: Arnaldo Carvalho de Melo Reviewed-by: Ian Rogers --- v2: Make sure the entries are sorted, if not sort them. --- tools/perf/util/maps.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index 432399cbe5dd..09c9cc326c08 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -1136,8 +1136,13 @@ struct map *maps__find_next_entry(struct maps *maps,= struct map *map) struct map *result =3D NULL; =20 down_read(maps__lock(maps)); + while (!maps__maps_by_address_sorted(maps)) { + up_read(maps__lock(maps)); + maps__sort_by_address(maps); + down_read(maps__lock(maps)); + } i =3D maps__by_address_index(maps, map); - if (i < maps__nr_maps(maps)) + if (++i < maps__nr_maps(maps)) result =3D map__get(maps__maps_by_address(maps)[i]); =20 up_read(maps__lock(maps)); --=20 2.47.0