From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Kim Phillips <kim.phillips@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Anton Blanchard <anton@samba.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Jiri Olsa <jolsa@redhat.com>, Mark Rutland <mark.rutland@arm.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>,
Robin Murphy <robin.murphy@arm.com>,
Taeung Song <treeze.taeung@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.18 15/65] perf annotate: Fix parsing aarch64 branch instructions after objdump update
Date: Mon, 1 Oct 2018 00:38:12 +0000 [thread overview]
Message-ID: <20181001003754.146961-15-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20181001003754.146961-1-alexander.levin@microsoft.com>
From: Kim Phillips <kim.phillips@arm.com>
[ 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 <unwind_frame+0x18c> // b.hs, dffff7ecc47b
AFTER : ↓ b.cs 18c
BEFORE: → b.cc ffff200008d8d9cc <get_alloc_profile+0x31c> // 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 <kim.phillips@arm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Taeung Song <treeze.taeung@gmail.com>
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 <acme@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
tools/perf/util/annotate.c | 22 +++++++++++++++++++++-
tools/perf/util/annotate.h | 1 +
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 31a1e18c7bf2..3b05219c3ed7 100644
--- 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 <generic_exec_single+0x314> // 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 __maybe_unused, struct ins_operands *op
};
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 __maybe_unused, struct ins_operands *op
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 *ins, char *bf, size_t size,
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;
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index a4c0d91907e6..61e0c7fd5efd 100644
--- 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;
--
2.17.1
next prev parent reply other threads:[~2018-10-01 0:53 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 0:38 [PATCH AUTOSEL 4.18 01/65] netfilter: xt_cluster: add dependency on conntrack module Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 03/65] HID: intel-ish-hid: Enable Sunrise Point-H ish driver Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 02/65] netfilter: xt_checksum: ignore gso skbs Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 04/65] HID: add support for Apple Magic Keyboards Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 05/65] usb: gadget: fotg210-udc: Fix memory leak of fotg210->ep[i] Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 06/65] pinctrl: msm: Really mask level interrupts to prevent latching Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 07/65] HID: hid-saitek: Add device ID for RAT 7 Contagion Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 09/65] scsi: iscsi: target: Fix conn_ops double free Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 08/65] scsi: iscsi: target: Set conn->sess to NULL when iscsi_login_set_conn_values fails Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 10/65] scsi: qedi: Add the CRC size within iSCSI NVM image Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 11/65] perf annotate: Properly interpret indirect call Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 13/65] perf util: Fix bad memory access in trace info Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 12/65] perf evsel: Fix potential null pointer dereference in perf_evsel__new_idx() Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 14/65] perf probe powerpc: Ignore SyS symbols irrespective of endianness Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 16/65] netfilter: kconfig: nat related expression depend on nftables core Sasha Levin
2018-10-01 0:38 ` Sasha Levin [this message]
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 17/65] netfilter: nf_tables: release chain in flushing set Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 18/65] Revert "iio: temperature: maxim_thermocouple: add MAX31856 part" Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 19/65] iio: imu: st_lsm6dsx: take into account ts samples in wm configuration Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 20/65] RDMA/ucma: check fd type in ucma_migrate_id() Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 21/65] riscv: Do not overwrite initrd_start and initrd_end Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 22/65] HID: sensor-hub: Restore fixup for Lenovo ThinkPad Helix 2 sensor hub report Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 24/65] USB: yurex: Check for truncation in yurex_read() Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 23/65] usb: host: xhci-plat: Iterate over parent nodes for finding quirks Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 26/65] bnxt_re: Fix couple of memory leaks that could lead to IOMMU call traces Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 25/65] nvmet-rdma: fix possible bogus dereference under heavy load Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 27/65] net/mlx5: Consider PCI domain in search for next dev Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 28/65] HID: i2c-hid: Don't reset device upon system resume Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 29/65] dm raid: fix reshape race on small devices Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 31/65] drm/nouveau/mmu: don't attempt to dereference vmm without valid instance pointer Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 30/65] drm/nouveau: fix oops in client init failure path Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 33/65] drm/nouveau/disp: fix DP disable race Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 32/65] drm/nouveau/TBDdevinit: don't fail when PMU/PRE_OS is missing from VBIOS Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 35/65] dm raid: fix stripe adding reshape deadlock Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 34/65] drm/nouveau/disp/gm200-: enforce identity-mapped SOR assignment for LVDS/eDP panels Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 37/65] dm raid: fix RAID leg rebuild errors Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 36/65] dm raid: fix rebuild of specific devices by updating superblock Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 38/65] r8169: set TxConfig register after TX / RX is enabled, just like RxConfig Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 40/65] net: ena: fix surprise unplug NULL dereference kernel crash Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 39/65] fs/cifs: suppress a string overflow warning Sasha Levin
2018-10-01 1:22 ` Stephen Rothwell
2018-10-01 23:48 ` Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 41/65] net: ena: fix driver when PAGE_SIZE == 64kB Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 42/65] net: ena: fix device destruction to gracefully free resources Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 43/65] net: ena: fix potential double ena_destroy_device() Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 44/65] net: ena: fix missing lock during device destruction Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 46/65] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 45/65] net: ena: fix missing calls to READ_ONCE Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 47/65] sched/topology: Set correct NUMA topology type Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 48/65] dm thin metadata: try to avoid ever aborting transactions Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 49/65] netfilter: conntrack: timeout interface depend on CONFIG_NF_CONNTRACK_TIMEOUT Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 51/65] netfilter: xt_hashlimit: use s->file instead of s->private Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 50/65] netfilter: nfnetlink_queue: Solve the NFQUEUE/conntrack clash for NF_REPEAT Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 52/65] arch/hexagon: fix kernel/dma.c build warning Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 53/65] hexagon: modify ffs() and fls() to return int Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 54/65] drm/amdgpu: Fix SDMA hang in prt mode v2 Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 55/65] arm64: jump_label.h: use asm_volatile_goto macro instead of "asm goto" Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 56/65] drm/amdgpu: fix error handling in amdgpu_cs_user_fence_chunk Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 57/65] r8169: Clear RTL_FLAG_TASK_*_PENDING when clearing RTL_FLAG_TASK_ENABLED Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 58/65] s390/qeth: use vzalloc for QUERY OAT buffer Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 59/65] s390/qeth: don't dump past end of unknown HW header Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 60/65] cifs: read overflow in is_valid_oplock_break() Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 61/65] asm-generic: io: Fix ioport_map() for !CONFIG_GENERIC_IOMAP && CONFIG_INDIRECT_PIO Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 62/65] xen/manage: don't complain about an empty value in control/sysrq node Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 63/65] xen: avoid crash in disable_hotplug_cpu Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 64/65] xen: fix GCC warning and remove duplicate EVTCHN_ROW/EVTCHN_COL usage Sasha Levin
2018-10-01 0:38 ` [PATCH AUTOSEL 4.18 65/65] x86/APM: Fix build warning when PROC_FS is not enabled Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181001003754.146961-15-alexander.levin@microsoft.com \
--to=alexander.levin@microsoft.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=anton@samba.org \
--cc=borntraeger@de.ibm.com \
--cc=jolsa@redhat.com \
--cc=kim.phillips@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=treeze.taeung@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome