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: Victor Kamensky X-Patchwork-Id: 5686371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2514FC058D for ; Thu, 22 Jan 2015 16:05:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 998F42021A for ; Thu, 22 Jan 2015 16:05:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8185B20034 for ; Thu, 22 Jan 2015 16:05:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEKDa-0000Kh-AD; Thu, 22 Jan 2015 16:02:50 +0000 Received: from mail-qc0-f175.google.com ([209.85.216.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YEKDT-0000E7-W4 for linux-arm-kernel@lists.infradead.org; Thu, 22 Jan 2015 16:02:48 +0000 Received: by mail-qc0-f175.google.com with SMTP id c9so1903291qcz.6 for ; Thu, 22 Jan 2015 08:02:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=zIXEG3JNbUfWVaSodMfVDDPaorADHz+dcVDQM36Frn8=; b=ktyUt5baSxM+qN5tHeJohggEqWVXRHU5ud/OxsdPF6eVhHABh7pFQ/hyzx2mQzxKUm FMZQWpPn8FxtCk0/oY8b6cIpIUy+TsZ2grItg8kvOWAkkbFYTT3z1T7wGWI04seB9vLf 8KAROAIpMYjiKhZ4idrMb1dgkrWxa5ifbYm2X4sLL54eQx7pOwdgWowMksEQRhNmdyy/ HustxIrCUj4TAbptrQLv6KivXt5rNTMiRpO5mHYedlVQPRtmMrMbhKdMudvnZ4h19sW9 fINmpGxNm1uz2Gbt+/fvRMQn2JbgKXwxp/TS5UI5Dey2T1a0dALm/dWUYTC1HiihZvIm b+4Q== X-Gm-Message-State: ALoCoQnsCmRW3wDdWRjx1OoLp4vB3Hkz8jRm/8uTkn2xH79hyyM0N8nV4kKJlrRMhYRjGAPO0xDb 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150122_080244_224653_5B6C2E98 X-CRM114-Status: GOOD ( 20.82 ) X-Spam-Score: -0.7 (/) Cc: Avi Kivity , Peter Zijlstra , Will Deacon , Adrian Hunter , Arnaldo Carvalho de Melo , open list , Ingo Molnar , Paul Mackerras , Anton Blanchard , David Ahern , Masami Hiramatsu , Namhyung Kim , Jiri Olsa , Dave Martin , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }