From patchwork Thu Jan 22 16:02:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vkamensky X-Patchwork-Id: 43524 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 51775240DB for ; Thu, 22 Jan 2015 16:02:36 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id pn19sf1547698lab.2 for ; Thu, 22 Jan 2015 08:02:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=LVPT2LzdrTkhraQcxv7jpbd5YeJY0aDn7nRHw5DR7iM=; b=Ns3ZYfBeErEtEpTTR1EhjVzL0ySdz2YhZNO8ClSHCAjKEdI47qVyjhAGH33IPcufdu LunNH2SSFbU3Ry/Bpxxza8gkGZIOBP80AivetX7Zwtt/gFba4fwWKW1GrMEvkvQNLeAV W6lZ4Sv8noXaB8MlOm6NkxlAOxmY98cTDO6agPlAs9eM3scihBpoSCTy24IFdmXsFHWZ BaDh7Qck5dsLJ40BXtoxNFcZpbV4oBNomL90u4pIU4HI9kxfAO2uD1odTkr1b3UPOu9e W/rn6c1TuDWOP/YuENqfmmuH9Y/9rGRmRo+Y4E0KPE3aY54Uc53s0FPeQ3IxNFXLjb0i CY6A== X-Gm-Message-State: ALoCoQmqFSfyiwZs1F0kOzi7ONJXbknliwbIU7N+mMAx5PGRRRf+gWRXB98X9PzfnnCIcNGYcTSn X-Received: by 10.112.171.74 with SMTP id as10mr351351lbc.8.1421942555237; Thu, 22 Jan 2015 08:02:35 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.98 with SMTP id l2ls174584laf.73.gmail; Thu, 22 Jan 2015 08:02:35 -0800 (PST) X-Received: by 10.112.173.202 with SMTP id bm10mr2567991lbc.24.1421942555018; Thu, 22 Jan 2015 08:02:35 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id un3si21127937lbb.21.2015.01.22.08.02.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2015 08:02:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so2352504lbv.4 for ; Thu, 22 Jan 2015 08:02:34 -0800 (PST) X-Received: by 10.112.125.41 with SMTP id mn9mr2520327lbb.80.1421942554818; Thu, 22 Jan 2015 08:02:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp309180lbb; Thu, 22 Jan 2015 08:02:31 -0800 (PST) X-Received: by 10.66.119.193 with SMTP id kw1mr3493197pab.64.1421942549341; Thu, 22 Jan 2015 08:02:29 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id to5si12583127pbc.133.2015.01.22.08.02.28; Thu, 22 Jan 2015 08:02:29 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752925AbbAVQCY (ORCPT + 28 others); Thu, 22 Jan 2015 11:02:24 -0500 Received: from mail-qa0-f49.google.com ([209.85.216.49]:64135 "EHLO mail-qa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbbAVQCW (ORCPT ); Thu, 22 Jan 2015 11:02:22 -0500 Received: by mail-qa0-f49.google.com with SMTP id v8so1743567qal.8 for ; Thu, 22 Jan 2015 08:02:21 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.229.240.130 with SMTP id la2mr3948388qcb.9.1421942540956; Thu, 22 Jan 2015 08:02:20 -0800 (PST) Received: by 10.229.68.197 with HTTP; Thu, 22 Jan 2015 08:02:20 -0800 (PST) In-Reply-To: <20150122152908.GA26493@n2100.arm.linux.org.uk> References: <1421902378-3634-1-git-send-email-victor.kamensky@linaro.org> <1421902378-3634-3-git-send-email-victor.kamensky@linaro.org> <20150122152908.GA26493@n2100.arm.linux.org.uk> Date: Thu, 22 Jan 2015 08:02:20 -0800 Message-ID: Subject: Re: [PATCH V2 2/3] perf symbols: improve abi compliance in arm mapping symbols handling From: Victor Kamensky To: Russell King - ARM Linux Cc: Arnaldo Carvalho de Melo , Namhyung Kim , David Ahern , Will Deacon , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Adrian Hunter , Jiri Olsa , Avi Kivity , Masami Hiramatsu , Anton Blanchard , Dave Martin , open list , "linux-arm-kernel@lists.infradead.org" Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: victor.kamensky@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 22 January 2015 at 07:29, Russell King - ARM Linux wrote: > On Wed, Jan 21, 2015 at 08:52:57PM -0800, Victor Kamensky wrote: >> Both Arm and Aarch64 ELF ABI allow mapping symbols be in from >> either "$d" or "$d.". But current code that handles mapping >> symbols only deals with the first, dollar character and a single >> letter, case. >> >> The patch adds handling of the second case with period >> followed by any characters. >> >> Suggested-by: Russell King >> Suggested-by: Will Deacon >> Signed-off-by: Victor Kamensky >> Acked-by: Will Deacon >> Cc: Peter Zijlstra >> Cc: Paul Mackerras >> Cc: Ingo Molnar >> Cc: Arnaldo Carvalho de Melo >> Cc: Adrian Hunter >> Cc: Jiri Olsa >> Cc: Namhyung Kim >> Cc: Avi Kivity >> Cc: Masami Hiramatsu >> Cc: Anton Blanchard >> Cc: David Ahern >> Cc: Dave Martin >> --- >> tools/perf/util/symbol-elf.c | 9 ++++----- >> 1 file changed, 4 insertions(+), 5 deletions(-) >> >> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c >> index 1e188dd..7fd35d6 100644 >> --- a/tools/perf/util/symbol-elf.c >> +++ b/tools/perf/util/symbol-elf.c >> @@ -857,17 +857,16 @@ int dso__load_sym(struct dso *dso, struct map *map, >> * don't identify functions, so will confuse the profile >> * output: */ >> if (ehdr.e_machine == EM_ARM) { >> - if (!strcmp(elf_name, "$a") || >> - !strcmp(elf_name, "$d") || >> - !strcmp(elf_name, "$t")) >> + if (elf_name[0] == '$' && strchr("adt", elf_name[1]) >> + && (elf_name[2] == '\0' || elf_name[2] == '.')) >> continue; >> } >> /* Reject Aarch64 ELF "mapping symbols": these aren't unique and >> * don't identify functions, so will confuse the profile >> * output: */ >> if (ehdr.e_machine == EM_AARCH64) { >> - if (!strcmp(elf_name, "$x") || >> - !strcmp(elf_name, "$d")) >> + if (elf_name[0] == '$' && strchr("dx", elf_name[1]) >> + && (elf_name[2] == '\0' || elf_name[2] == '.')) >> continue; >> } > > Why not fix this first? Then, all you'd need to do would be to change > the test for EM_ARM to EM_ARM or EM_AARCH64, and add the 'x' into the > strchr() string. In previously discussed [1] I proposed two variants and ask for people's preferences. Will replied that he did not care and let me choose that I like. It seems to me that you more like variant 2 (provided here for reference again). It would replace patch 1 and patch 2 of version 2. Please confirm. I don't practically care much and can use either. I personally preferred variant 1 because in variant 2 $x will be filtered on ARM V7, but V7 ABI does not say anything about $x, only Aarch64 does. I.e special symbols do to match between V7 and V8 exactly. But as it is already in other places like kallsyms, I agree practically it may not matter. If you give your node to variant 2 (as below) I can report this miniseries: Please let me know Variant 2: >From c8d08ebddc61203daf21b17c891c26c1d08e14f1 Mon Sep 17 00:00:00 2001 From: Victor Kamensky Date: Mon, 12 Jan 2015 14:13:36 -0800 Subject: [PATCH 1/2] perf symbols: Ignore mapping symbols on aarch64 Aarch64 ELF files use mapping symbols with special names $x, $d to identify regions of Aarch64 code (see Aarch64 ELF ABI - "ARM IHI 0056B", section "4.5.4 Mapping symbols"). The patch filters out these symbols at load time, similar to "696b97a perf symbols: Ignore mapping symbols on ARM" changes done for ARM before V8. Also added handling of mapping symbols that has format "$d." and similar for both cases. Note we are not making difference between EM_ARM and EM_AARCH64 mapping symbols instead code handles superset of both. Signed-off-by: Victor Kamensky Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Cc: Avi Kivity Cc: Masami Hiramatsu Cc: Anton Blanchard Cc: David Ahern Cc: Will Deacon Cc: Russell King Cc: Dave Martin --- tools/perf/util/symbol-elf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 06fcd1b..b2eb0f9 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -856,10 +856,9 @@ int dso__load_sym(struct dso *dso, struct map *map, /* Reject ARM ELF "mapping symbols": these aren't unique and * don't identify functions, so will confuse the profile * output: */ - if (ehdr.e_machine == EM_ARM) { - if (!strcmp(elf_name, "$a") || - !strcmp(elf_name, "$d") || - !strcmp(elf_name, "$t")) + if (ehdr.e_machine == EM_ARM || ehdr.e_machine == EM_AARCH64) { + if (elf_name[0] == '$' && strchr("adtx", elf_name[1]) + && (elf_name[2] == '\0' || elf_name[2] == '.')) continue; }