From patchwork Wed Jan 14 18:38:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vkamensky X-Patchwork-Id: 43128 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C7AEC20D60 for ; Wed, 14 Jan 2015 18:38:47 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id t10sf5170900eei.2 for ; Wed, 14 Jan 2015 10:38:47 -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=YYVeRhoYIRKjthC31JRJS42GOEVCGBe0sTvuEXdkaE0=; b=lpQQtqGo62dOrICNTbA+9pfqSbniKg59fhyIG0QJZhuB3oLDnez8BcADDee5eKRytw kcHcYkp80KSZ0/ourke1Wrjm2YLoPopnOfOlSaRiSsHQ5BBQU98TwDLee0MhsMYj8KB0 Z3RC4tCewD8gcI7d+KuKQiLhvu+h9QTyRsKfOWsln93k53ito247bJF6sX+XmkfCb83e GDME+t0pHvIcOLDUH6xLS/fROKRhPiwG3C6zf9qt9b1g2u//d9MO5zIkMQYwiiF+n7fp TDUT0ELPvvUehctT7DzBz3CYjqoM3uIFGR8b32uUg6GqOKM3Oyn4ZWOEou2Oc/krVxNV Wsdw== X-Gm-Message-State: ALoCoQkqROHkOw+JrTKO4Xigzio4cm4QzMdaME/ASy+0yPpS0JJfORyxuB21frOP1EcATSZx8HYD X-Received: by 10.152.7.99 with SMTP id i3mr7958laa.9.1421260726943; Wed, 14 Jan 2015 10:38:46 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.232 with SMTP id h8ls166147lam.3.gmail; Wed, 14 Jan 2015 10:38:46 -0800 (PST) X-Received: by 10.112.54.167 with SMTP id k7mr5516461lbp.72.1421260726765; Wed, 14 Jan 2015 10:38:46 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id kg2si28089341lbc.4.2015.01.14.10.38.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Jan 2015 10:38:46 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so9708839lab.6 for ; Wed, 14 Jan 2015 10:38:46 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr5544420lbb.2.1421260726298; Wed, 14 Jan 2015 10:38:46 -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 c8csp1787726lbb; Wed, 14 Jan 2015 10:38:45 -0800 (PST) X-Received: by 10.66.164.200 with SMTP id ys8mr7909005pab.130.1421260724287; Wed, 14 Jan 2015 10:38:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nu9si31460330pbb.238.2015.01.14.10.38.42; Wed, 14 Jan 2015 10:38:44 -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 S1754384AbbANSil (ORCPT + 28 others); Wed, 14 Jan 2015 13:38:41 -0500 Received: from mail-qg0-f42.google.com ([209.85.192.42]:38588 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751902AbbANSij (ORCPT ); Wed, 14 Jan 2015 13:38:39 -0500 Received: by mail-qg0-f42.google.com with SMTP id q108so8328078qgd.1 for ; Wed, 14 Jan 2015 10:38:38 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.140.108.74 with SMTP id i68mr8830661qgf.35.1421260718729; Wed, 14 Jan 2015 10:38:38 -0800 (PST) Received: by 10.229.245.202 with HTTP; Wed, 14 Jan 2015 10:38:38 -0800 (PST) In-Reply-To: <20150114112210.GF4050@arm.com> References: <1421168344-5363-1-git-send-email-victor.kamensky@linaro.org> <20150114112210.GF4050@arm.com> Date: Wed, 14 Jan 2015 10:38:38 -0800 Message-ID: Subject: Re: [PATCH 1/2] perf symbols: Ignore mapping symbols on aarch64 From: Victor Kamensky To: Will Deacon Cc: Arnaldo Carvalho de Melo , Namhyung Kim , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Adrian Hunter , Jiri Olsa , Avi Kivity , Masami Hiramatsu , Anton Blanchard , David Ahern , Dave P Martin , "linux-kernel@vger.kernel.org" , "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.215.47 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 14 January 2015 at 03:22, Will Deacon wrote: > On Tue, Jan 13, 2015 at 04:59:03PM +0000, Victor Kamensky wrote: >> 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. >> >> 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: Dave Martin >> --- >> tools/perf/util/symbol-elf.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c >> index 06fcd1b..1e188dd 100644 >> --- a/tools/perf/util/symbol-elf.c >> +++ b/tools/perf/util/symbol-elf.c >> @@ -862,6 +862,14 @@ int dso__load_sym(struct dso *dso, struct map *map, >> !strcmp(elf_name, "$t")) >> 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")) >> + continue; >> + } > > Do we need to skip $x.* and $d.* too? I doubt GCC generates them, but they > are permitted by the ELF ABI. Fair enough. But I think it would need to be done for both EM_ARM and EM_AARCH64. My above patch follows EM_ARM current case. Also it seems that it would be quite rare case, as ABI suggests symbols with dot notation should be used in manual asm where assembler does not support multiple definitions of the same symbol. Will something like the following suffice? I can add that as separate follow up patch in this small series. Tested with explicit "$x.func1" symbol introduced in manual asm. >From fed6caab410ddcaf487ff23a3908eca129e50b89 Mon Sep 17 00:00:00 2001 From: Victor Kamensky Date: Wed, 14 Jan 2015 07:42:41 -0800 Subject: [PATCH 3/3] perf symbols: improve abi compliance in arm mapping symbols handling 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: Will Deacon Signed-off-by: Victor Kamensky --- tools/perf/util/symbol-elf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 1e188dd..ae92c27 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -859,7 +859,10 @@ int dso__load_sym(struct dso *dso, struct map *map, if (ehdr.e_machine == EM_ARM) { if (!strcmp(elf_name, "$a") || !strcmp(elf_name, "$d") || - !strcmp(elf_name, "$t")) + !strcmp(elf_name, "$t") || + !strncmp(elf_name, "$a.", 3) || + !strncmp(elf_name, "$d.", 3) || + !strncmp(elf_name, "$t.", 3)) continue; } /* Reject Aarch64 ELF "mapping symbols": these aren't unique and @@ -867,7 +870,9 @@ int dso__load_sym(struct dso *dso, struct map *map, * output: */ if (ehdr.e_machine == EM_AARCH64) { if (!strcmp(elf_name, "$x") || - !strcmp(elf_name, "$d")) + !strcmp(elf_name, "$d") || + !strncmp(elf_name, "$x.", 3) || + !strncmp(elf_name, "$d.", 3)) continue; }