From patchwork Mon Oct 8 15:41:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 980641 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="la+FCTeZ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="s7xeVCTg"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42TPlb4P7Lz9s8T for ; Tue, 9 Oct 2018 02:43:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:From:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=09EZdZFXd1oCoxWyY0RCWGANaa7pz0L8RSNpIMglSoI=; b=la+FCTeZpMaH9P /yt0XSXK8WJ1uCdHnBGsYuPk3AqkN07dTjdPhCsJ0gPmd+TbjzHlsIpPww58dZ8Cm7RrN9j+mv5L3 NW5gsrsnlFFCFMY9885rNqBm8GioNJvjF8V+Mmy1r+4/pvm+gnwk9m7oW6IS9xCphgho+Wwote6YI C1BaiawfNALgd7eB1sWEug78zRgiscDX4kBDHBX9TJqZQ625WY33FX1/zrOMD6gr2H4+czsKJQC7U U2P/ukRfo3T3ep+c1kkI4GDjLmLjN8ZHU5tcZBFgZBn7kJ2J7w7VL4wzWDGVIpnbsALBI2wHckzEt ePxmbV8syfCbI/O4kEbg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9Xgh-0002hI-Iu; Mon, 08 Oct 2018 15:43:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9Xgb-0002fS-K9 for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2018 15:43:11 +0000 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FA582086D; Mon, 8 Oct 2018 15:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539013379; bh=6W4HH/JBzTxe223+iA2EOkXXuUgEb55OQKvjE1y5x1o=; h=Subject:To:Cc:From:Date:From; b=s7xeVCTgOSVY2e80SN5H4TpocAyvriwi3YSajD+p/MP9I0HdAsHFF2Mg/Pj8nr39y Rlbey7il89n1QE2F3R3gz51DD/oodHmdJxcejbXEsBKT7D8QtmcJd6ro9xfIttmVPr MuGHG7NwBWtEuuYrD597X2rIm9PimOAoWY6Z5+7U= Subject: Patch "perf annotate: Fix parsing aarch64 branch instructions after objdump update" has been added to the 4.18-stable tree To: 20180827125340.a2f7e291901d17cea05daba4@arm.com, acme@redhat.com, alexander.levin@microsoft.com, alexander.shishkin@linux.intel.com, anton@samba.org, borntraeger@de.ibm.com, gregkh@linuxfoundation.org, jolsa@redhat.com, kim.phillips@arm.com, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, namhyung@kernel.org, peterz@infradead.org, ravi.bangoria@linux.vnet.ibm.com, robin.murphy@arm.com, treeze.taeung@gmail.com From: Date: Mon, 08 Oct 2018 17:41:02 +0200 Message-ID: <15390132623119@kroah.com> MIME-Version: 1.0 X-stable: commit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181008_084309_697094_30FBB394 X-CRM114-Status: GOOD ( 17.85 ) X-Spam-Score: -5.1 (-----) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-5.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.4 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable-commits@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org This is a note to let you know that I've just added the patch titled perf annotate: Fix parsing aarch64 branch instructions after objdump update to the 4.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: perf-annotate-fix-parsing-aarch64-branch-instructions-after-objdump-update.patch and it can be found in the queue-4.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From foo@baz Mon Oct 8 17:39:53 CEST 2018 From: Kim Phillips Date: Mon, 27 Aug 2018 12:53:40 -0500 Subject: perf annotate: Fix parsing aarch64 branch instructions after objdump update From: Kim Phillips [ Upstream commit 4e67b2a5df5d3f341776d12ee575e00ca3ef92de ] Starting with binutils 2.28, aarch64 objdump adds comments to the disassembly output to show the alternative names of a condition code [1]. It is assumed that commas in objdump comments could occur in other arches now or in the future, so this fix is arch-independent. The fix could have been done with arm64 specific jump__parse and jump__scnprintf functions, but the jump__scnprintf instruction would have to have its comment character be a literal, since the scnprintf functions cannot receive a struct arch easily. This inconvenience also applies to the generic jump__scnprintf, which is why we add a raw_comment pointer to struct ins_operands, so the __parse function assigns it to be re-used by its corresponding __scnprintf function. Example differences in 'perf annotate --stdio2' output on an aarch64 perf.data file: BEFORE: → b.cs ffff200008133d1c // b.hs, dffff7ecc47b AFTER : ↓ b.cs 18c BEFORE: → b.cc ffff200008d8d9cc // b.lo, b.ul, dffff727295b AFTER : ↓ b.cc 31c The branch target labels 18c and 31c also now appear in the output: BEFORE: add x26, x29, #0x80 AFTER : 18c: add x26, x29, #0x80 BEFORE: add x21, x21, #0x8 AFTER : 31c: add x21, x21, #0x8 The Fixes: tag below is added so stable branches will get the update; it doesn't necessarily mean that commit was broken at the time, rather it didn't withstand the aarch64 objdump update. Tested no difference in output for sample x86_64, power arch perf.data files. [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=bb7eff5206e4795ac79c177a80fe9f4630aaf730 Signed-off-by: Kim Phillips Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Anton Blanchard Cc: Christian Borntraeger Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Cc: Robin Murphy Cc: Taeung Song Cc: linux-arm-kernel@lists.infradead.org Fixes: b13bbeee5ee6 ("perf annotate: Fix branch instruction with multiple operands") Link: http://lkml.kernel.org/r/20180827125340.a2f7e291901d17cea05daba4@arm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/annotate.c | 22 +++++++++++++++++++++- tools/perf/util/annotate.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) Patches currently in stable-queue which might be from kim.phillips@arm.com are queue-4.18/perf-annotate-properly-interpret-indirect-call.patch queue-4.18/perf-annotate-fix-parsing-aarch64-branch-instructions-after-objdump-update.patch --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -281,7 +281,19 @@ bool ins__is_call(const struct ins *ins) return ins->ops == &call_ops || ins->ops == &s390_call_ops; } -static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *ops, struct map_symbol *ms) +/* + * Prevents from matching commas in the comment section, e.g.: + * ffff200008446e70: b.cs ffff2000084470f4 // b.hs, b.nlast + */ +static inline const char *validate_comma(const char *c, struct ins_operands *ops) +{ + if (ops->raw_comment && c > ops->raw_comment) + return NULL; + + return c; +} + +static int jump__parse(struct arch *arch, struct ins_operands *ops, struct map_symbol *ms) { struct map *map = ms->map; struct symbol *sym = ms->sym; @@ -290,6 +302,10 @@ static int jump__parse(struct arch *arch }; const char *c = strchr(ops->raw, ','); u64 start, end; + + ops->raw_comment = strchr(ops->raw, arch->objdump.comment_char); + c = validate_comma(c, ops); + /* * Examples of lines to parse for the _cpp_lex_token@@Base * function: @@ -309,6 +325,7 @@ static int jump__parse(struct arch *arch ops->target.addr = strtoull(c, NULL, 16); if (!ops->target.addr) { c = strchr(c, ','); + c = validate_comma(c, ops); if (c++ != NULL) ops->target.addr = strtoull(c, NULL, 16); } @@ -366,9 +383,12 @@ static int jump__scnprintf(struct ins *i return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.sym->name); c = strchr(ops->raw, ','); + c = validate_comma(c, ops); + if (c != NULL) { const char *c2 = strchr(c + 1, ','); + c2 = validate_comma(c2, ops); /* check for 3-op insn */ if (c2 != NULL) c = c2; --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -21,6 +21,7 @@ struct ins { struct ins_operands { char *raw; + char *raw_comment; struct { char *raw; char *name;