Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1339879pxb; Thu, 28 Oct 2021 01:47:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl1JMwQUdymh7DMczst2hB7CHhcAAmOF35kXY1udVzFHAMfZ9t3b+yHd/Kw/GtPXA5uoPn X-Received: by 2002:a05:6402:447:: with SMTP id p7mr4314730edw.261.1635410820612; Thu, 28 Oct 2021 01:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635410820; cv=none; d=google.com; s=arc-20160816; b=pHdXmwK5YJKs3EAednwUMWOeAXdehVQON4vGxPdp3YXsB3RhfjFRFZXopA8xiDCDGn ddbVTZ3iN+ZglU9+UPh0FMJ1TKuXYYdDJp9JTiTx3IjdfGjDugeqPMBbu0Yf67DsrU3y Z9nvUelHJdgHB+b5fQerYTeiZ8/4NsRUtK1QVkKWZmC1Q6hv5Jb4Sa84sx3Edv4PMKFF Zb8AHpCtb9B1mHhfHNVel8Qis7gzjiOGzFrCQGn7XUx8zMzxyZhc9+IThR9la238T8LZ jJiyy1iTftHZAfzHBJGYPghMBGX83Cd3BrGsMAzPLbqK26AC2qRp74r5XmT6IJh4nf1J rlPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=6Gm0pXNpocGVhkcFxXQSyfVtbHdw1+RiwevPyrna5LM=; b=cqpf5XICCg5W0m66c3evahCSM4S2efkfgPoHd8NeTiziqRqmJQ3vCvgILfTeLOtUbf lK7TNOJCUtpPwHwAV8qGfKSrCHE2qI+cJAq5dgRtiR7RKvzB5XLVSVnqVgHbzeFVmiLQ iiaNEwFOre6ZiTWWLc1DKC7wIlxDESLkV4Cc0BzfXQIb5ObXyCDCi1WvYc8NZXd9ojMC YkNXUzYo9kf3DiL3YPli1OkebkZINqfXf+iQGLpZrzIurjnab2Z77gU3aW6t517AFhf4 ER5A4vKjAVPtXbwYY3NnfGv5ymBl5N+sPDC2R99+UqpcNl8cw6OuLqXR7j0edRBh2YMK dUGw== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sh10si4357611ejc.268.2021.10.28.01.46.31; Thu, 28 Oct 2021 01:47:00 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbhJ1Iq5 (ORCPT + 99 others); Thu, 28 Oct 2021 04:46:57 -0400 Received: from foss.arm.com ([217.140.110.172]:52350 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbhJ1Iq4 (ORCPT ); Thu, 28 Oct 2021 04:46:56 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA3101FB; Thu, 28 Oct 2021 01:44:29 -0700 (PDT) Received: from [10.32.36.26] (e121896.Emea.Arm.com [10.32.36.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 44B973F70D; Thu, 28 Oct 2021 01:44:27 -0700 (PDT) Subject: Re: [PATCH] perf symbol: ignore $a/$d symbols for ARM modules To: Lexi Shao , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: acme@kernel.org, mark.rutland@arm.com, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, qiuxi1@huawei.com, nixiaoming@huawei.com, wangbing6@huawei.com References: <20211027095235.123358-1-shaolexi@huawei.com> From: James Clark Message-ID: <0631949b-6cde-dee6-6a77-5b826938ce79@arm.com> Date: Thu, 28 Oct 2021 09:44:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211027095235.123358-1-shaolexi@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/10/2021 10:52, Lexi Shao wrote: > 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 >