Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2390404pxb; Thu, 28 Oct 2021 23:53:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlHuY2ltmJGk9tqs8AkMAYXaxasR0kjz3+/tMinoFQLJo617sGH3JD8W50uue7QN76Yws+ X-Received: by 2002:a17:902:e543:b0:13f:dffb:8e6 with SMTP id n3-20020a170902e54300b0013fdffb08e6mr8125201plf.27.1635490413966; Thu, 28 Oct 2021 23:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635490413; cv=none; d=google.com; s=arc-20160816; b=oayjwXMkUBrWVMSn4h1uUl5WCz+TFbDXtWYQItCeyXWtgFo89zyKjeXMfg8LHEdNOv +R6+8uQ9Lr8w8Gvja2qDMtV6JIev5/rwYrUhKRD6Lv/UYnFOFvCp9KqMJCLp6m/67hXZ HBq5iACiFDWI4U5nrVTTfjLuap6CiG8ixyzn5CXfl4YtuVlcxCZqrMuTF+Vu/xlEc/7M GYx6NDxlt73izZA/qLr2CxAkUltq9Ebr8NU/pQn9vcyhPnDOhSm+NfcCte0yt452YgxS I035G+xcWHw1gp9SHmXIsZJkNugj5kb3ZGuzBajOjfL1138w114NZauezfpQKbyKWNyN PNPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=gTeWsIJkJ1LRmr4jFrVITDwG5IX/lqRAW6O2na/WCwc=; b=sH6fHTpNw5Bm/HZs3s7dOqZlzodBjVCjatG7zGdhwhim7Jc1XsG83BJJH+yUslmpCS YNC/A2qRBfc/MdaUlTOPQf/sRtUKPO5kCkMgkAu1p9Pyw+ZBchAWQXDhkCEujtSvlRvW sZ58fbpg4YjbIela010DzaYNqm+DFBT3eaNJvtsvBS4UK6Teg86eW0ZTNjYQeEKQvJ0x CC12gsYr5QFYIcplQfQbu34vIN1f3trKVvPHy29avTXj59T0Qtqi6986/cRRmpc6uUQF kAI36ZkFKtt+9iF1+HdZnr9AnRORFzyq99IY0Rco1/fQwfDwsvNNBvCZzLnJIcANRUnr f7GQ== 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 l10si7181059pgq.267.2021.10.28.23.53.19; Thu, 28 Oct 2021 23:53:33 -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 S232161AbhJ2GyD (ORCPT + 99 others); Fri, 29 Oct 2021 02:54:03 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:14876 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232034AbhJ2Gx1 (ORCPT ); Fri, 29 Oct 2021 02:53:27 -0400 Received: from dggeme762-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HgY3Y6l10z90CJ; Fri, 29 Oct 2021 14:50:49 +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; Fri, 29 Oct 2021 14:50:54 +0800 From: Lexi Shao To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 1/2] perf symbol: ignore $a/$d symbols for ARM modules Date: Fri, 29 Oct 2021 14:50:37 +0800 Message-ID: <20211029065038.39449-2-shaolexi@huawei.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20211029065038.39449-1-shaolexi@huawei.com> References: <20211029065038.39449-1-shaolexi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.189.2] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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 Reviewed-by: James Clark --- 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