mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] perf annotate: Remove s390 basr instruction from call table
@ 2018-02-28 13:33 Thomas Richter
  2018-02-28 13:33 ` [PATCH 2/2] perf annotate: Fix s390 target function disassembly Thomas Richter
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2018-02-28 13:33 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter

Perf annotate displays function call assembler instructions
with a right arrow. Hitting enter on this line/instruction
causes the browser to disassemble this target function and
show it on the screen.

S390 assembler instruction 'basr %r1,%r2'
jumps to address stored in register 2. Since the
target address is unknown to perf it can not be handled.

Therefore remove the right arrow from such an instruction
as the target function can not be identified.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 tools/perf/arch/s390/annotate/instructions.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c
index 8c72b44444cb..05f53bd092d4 100644
--- a/tools/perf/arch/s390/annotate/instructions.c
+++ b/tools/perf/arch/s390/annotate/instructions.c
@@ -12,8 +12,7 @@ static struct ins_ops *s390__associate_ins_ops(struct arch *arch, const char *na
 		ops = &jump_ops;
 	/* override call/returns */
 	if (!strcmp(name, "bras") ||
-	    !strcmp(name, "brasl") ||
-	    !strcmp(name, "basr"))
+	    !strcmp(name, "brasl"))
 		ops = &call_ops;
 	if (!strcmp(name, "br"))
 		ops = &ret_ops;
-- 
2.14.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] perf annotate: Fix s390 target function disassembly
  2018-02-28 13:33 [PATCH 1/2] perf annotate: Remove s390 basr instruction from call table Thomas Richter
@ 2018-02-28 13:33 ` Thomas Richter
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Richter @ 2018-02-28 13:33 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter

Perf annotate displays function call assembler instructions
with a right arrow. Hitting enter on this line/instruction
causes the browser to disassemble this target function and
show it on the screen.  On s390 this results in an error
message 'symbol not found'.

The function call assembly line parsing does not handle
the s390 bras and brasl instructions. Function call__parse
expects the target as first operand:
	callq	e9140 <__fxstat>
S390 has a register number as first operand:
	brasl	%r14,41d60 <abort>
Therefore the target addresses on s390 are always zero
which is an invalid address.

Fix this by skipping the first operand on s390.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 tools/perf/util/annotate.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 28b233c3dcbe..5a90aa88076d 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -188,7 +188,13 @@ static int call__parse(struct arch *arch, struct ins_operands *ops, struct map *
 {
 	char *endptr, *tok, *name;
 
-	ops->target.addr = strtoull(ops->raw, &endptr, 16);
+	if (!strcmp(arch->name, "s390")) {
+		ops->target.addr =  0;
+		tok = strchr(ops->raw, ',');
+		if (tok)
+			ops->target.addr = strtoull(tok + 1, &endptr, 16);
+	} else
+		ops->target.addr = strtoull(ops->raw, &endptr, 16);
 
 	name = strchr(endptr, '<');
 	if (name == NULL)
-- 
2.14.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-28 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 13:33 [PATCH 1/2] perf annotate: Remove s390 basr instruction from call table Thomas Richter
2018-02-28 13:33 ` [PATCH 2/2] perf annotate: Fix s390 target function disassembly Thomas Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®