From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam01on0099.outbound.protection.outlook.com ([104.47.34.99]:35296 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751547AbeA1W0I (ORCPT ); Sun, 28 Jan 2018 17:26:08 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Ravi Bangoria , Alexander Shishkin , Jiri Olsa , "Namhyung Kim" , Peter Zijlstra , Taeung Song , Arnaldo Carvalho de Melo , "Sasha Levin" Subject: [PATCH AUTOSEL for 4.14 012/100] perf annotate: Do not truncate instruction names at 6 chars Date: Sun, 28 Jan 2018 22:26:03 +0000 Message-ID: <20180128222547.7398-12-alexander.levin@microsoft.com> References: <20180128222547.7398-1-alexander.levin@microsoft.com> In-Reply-To: <20180128222547.7398-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Ravi Bangoria [ Upstream commit 05d0e62d9fa0f1002cf82009ef31b36174da5472 ] There are many instructions, esp on PowerPC, whose mnemonics are longer than 6 characters. Using precision limit causes truncation of such mnemonics. Fix this by removing precision limit. Note that, 'width' is still 6, so alignment won't get affected for length <=3D 6. Before: li r11,-1 xscvdp vs1,vs1 add. r10,r10,r11 After: li r11,-1 xscvdpsxds vs1,vs1 add. r10,r10,r11 Reported-by: Donald Stence Signed-off-by: Ravi Bangoria Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Taeung Song Link: http://lkml.kernel.org/r/20171114032540.4564-1-ravi.bangoria@linux.vn= et.ibm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/annotate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index aa66791b1bfc..41d415707264 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -166,7 +166,7 @@ static void ins__delete(struct ins_operands *ops) static int ins__raw_scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops) { - return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); + return scnprintf(bf, size, "%-6s %s", ins->name, ops->raw); } =20 int ins__scnprintf(struct ins *ins, char *bf, size_t size, @@ -231,12 +231,12 @@ static int call__scnprintf(struct ins *ins, char *bf,= size_t size, struct ins_operands *ops) { if (ops->target.name) - return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name); + return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.name); =20 if (ops->target.addr =3D=3D 0) return ins__raw_scnprintf(ins, bf, size, ops); =20 - return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.add= r); + return scnprintf(bf, size, "%-6s *%" PRIx64, ins->name, ops->target.addr)= ; } =20 static struct ins_ops call_ops =3D { @@ -300,7 +300,7 @@ static int jump__scnprintf(struct ins *ins, char *bf, s= ize_t size, c++; } =20 - return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, + return scnprintf(bf, size, "%-6s %.*s%" PRIx64, ins->name, c ? c - ops->raw : 0, ops->raw, ops->target.offset); } @@ -373,7 +373,7 @@ static int lock__scnprintf(struct ins *ins, char *bf, s= ize_t size, if (ops->locked.ins.ops =3D=3D NULL) return ins__raw_scnprintf(ins, bf, size, ops); =20 - printed =3D scnprintf(bf, size, "%-6.6s ", ins->name); + printed =3D scnprintf(bf, size, "%-6s ", ins->name); return printed + ins__scnprintf(&ops->locked.ins, bf + printed, size - printed, ops->locked.ops); } @@ -449,7 +449,7 @@ static int mov__parse(struct arch *arch, struct ins_ope= rands *ops, struct map *m static int mov__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops) { - return scnprintf(bf, size, "%-6.6s %s,%s", ins->name, + return scnprintf(bf, size, "%-6s %s,%s", ins->name, ops->source.name ?: ops->source.raw, ops->target.name ?: ops->target.raw); } @@ -489,7 +489,7 @@ static int dec__parse(struct arch *arch __maybe_unused,= struct ins_operands *ops static int dec__scnprintf(struct ins *ins, char *bf, size_t size, struct ins_operands *ops) { - return scnprintf(bf, size, "%-6.6s %s", ins->name, + return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.name ?: ops->target.raw); } =20 @@ -501,7 +501,7 @@ static struct ins_ops dec_ops =3D { static int nop__scnprintf(struct ins *ins __maybe_unused, char *bf, size_t= size, struct ins_operands *ops __maybe_unused) { - return scnprintf(bf, size, "%-6.6s", "nop"); + return scnprintf(bf, size, "%-6s", "nop"); } =20 static struct ins_ops nop_ops =3D { @@ -925,7 +925,7 @@ void disasm_line__free(struct disasm_line *dl) int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, = bool raw) { if (raw || !dl->ins.ops) - return scnprintf(bf, size, "%-6.6s %s", dl->ins.name, dl->ops.raw); + return scnprintf(bf, size, "%-6s %s", dl->ins.name, dl->ops.raw); =20 return ins__scnprintf(&dl->ins, bf, size, &dl->ops); } --=20 2.11.0