Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp881695pxb; Wed, 27 Oct 2021 14:23:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI3VJk/IAx/Rr26VzeZ3qA0Rt6TXW8XtsTuc5upP8qyDuisDDv+XedHAZK15AJbig6lMB/ X-Received: by 2002:a05:6402:348a:: with SMTP id v10mr503532edc.0.1635369812142; Wed, 27 Oct 2021 14:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369812; cv=none; d=google.com; s=arc-20160816; b=OcOA1Sxq7JJxUV/fQEX8YejL2JuXD9aloxs19oCSHaWq48fQnH/zi/WEdN4b8/xk3I oqI/zm9ROUJ+5wurvNuHuxwCSBsa+Jv/gpcnJaIxwATDq0i661RbMoC6Y/7SqkBle8B4 chsqO/U4DTuntn4wFH5c8H8TT92J3y5wNQYMhL29GYDPC7tlAIlGjHslP9pYgmI+ewOe W0GZa92P1NVPJFx0kBg/C+o0zg+kPHMM22p3eedK6X2c0W3XhPQEeTyZx8geQzy79UHb UfIM6sfijq6cXYUXLCH51AA5LvgHx9cEjIf8J9+e2p4/5iW7jDWzF9DRwQz3CHFUCcbj +7nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=3wOLZNDfYdNiCzACfCWaxGKUC8taCTbb/ZVjYT8ijUk=; b=B/fGzJ21HT0wQfTJFuzjg54QprjgDrGzFnQdkfRf+yEdCSAYJXtps8bU0vjk4WD4a3 APgs47RTDk4Tr9l6zACdkD312MphHh/+a4V4tKVFBMZSi+Qk4n3qqCrHELim7SRApbow AynCTa3JTMFp2+PvQ1od55ylBx+rlxlo2OWNlQKrR6e/Bg9JVHLGv+2R4xzs+pQ3bV3z SLpyhB2Ns3wYEd4madx9geNjIESnDTiu6pWhRvaSAmFkW0xtabG59RTAxgpdO3+7xTUF E4deaCzX9RfZZjx5mtdy+2SKzcQOiNvAiNSGWKJb+m0AZnp0MosClY1iTJHXUiFYk79i pSqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qk12si1443977ejc.741.2021.10.27.14.23.03; Wed, 27 Oct 2021 14:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238827AbhJ0JzI (ORCPT + 97 others); Wed, 27 Oct 2021 05:55:08 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:26197 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235583AbhJ0JzH (ORCPT ); Wed, 27 Oct 2021 05:55:07 -0400 Received: from dggeme762-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4HfP8h6XbRz8tt7; Wed, 27 Oct 2021 17:51:16 +0800 (CST) Received: from huawei.com (10.67.189.2) by dggeme762-chm.china.huawei.com (10.3.19.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Wed, 27 Oct 2021 17:52:38 +0800 From: Lexi Shao To: , CC: , , , , , , , , , , Subject: [PATCH] perf symbol: ignore $a/$d symbols for ARM modules Date: Wed, 27 Oct 2021 17:52:35 +0800 Message-ID: <20211027095235.123358-1-shaolexi@huawei.com> X-Mailer: git-send-email 2.12.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme762-chm.china.huawei.com (10.3.19.108) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On ARM machine, kernel symbols from modules can be resolved to $a instead of printing the actual symbol name. Ignore symbols starting with "$" when building kallsyms rbtree. A sample stacktrace is shown as follows: c0f2e39c schedule_hrtimeout+0x14 ([kernel.kallsyms]) bf4a66d8 $a+0x78 ([test_module]) c0a4f5f4 kthread+0x15c ([kernel.kallsyms]) c0a001f8 ret_from_fork+0x14 ([kernel.kallsyms]) On ARM machine, $a/$d symbols are used by the compiler to mark the beginning of code/data part in code section. These symbols are filtered out when linking vmlinux(see scripts/kallsyms.c ignored_prefixes), but are left on modules. So there are $a symbols in /proc/kallsyms which share the same addresses with the actual module symbols and confuses perf when resolving symbols. After this patch, the module symbol name is printed: c0f2e39c schedule_hrtimeout+0x14 ([kernel.kallsyms]) bf4a66d8 test_func+0x78 ([test_module]) c0a4f5f4 kthread+0x15c ([kernel.kallsyms]) c0a001f8 ret_from_fork+0x14 ([kernel.kallsyms]) Signed-off-by: Lexi Shao --- tools/perf/util/symbol.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 0fc9a5410739..35116aed74eb 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -702,6 +702,10 @@ static int map__process_kallsym_symbol(void *arg, const char *name, if (!symbol_type__filter(type)) return 0; + /* Ignore local symbols for ARM modules */ + if (name[0] == '$') + return 0; + /* * module symbols are not sorted so we add all * symbols, setting length to 0, and rely on -- 2.12.3