From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnaldo Carvalho de Melo Subject: Re: [PATCH Resent] perf annotate: Fix s390 target function disassembly Date: Tue, 6 Mar 2018 11:04:49 -0300 Message-ID: <20180306140449.GD10176@kernel.org> References: <20180306123955.98802-1-tmricht@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20180306123955.98802-1-tmricht@linux.vnet.ibm.com> Sender: linux-kernel-owner@vger.kernel.org To: Thomas Richter Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com List-Id: linux-perf-users.vger.kernel.org Em Tue, Mar 06, 2018 at 01:39:55PM +0100, Thomas Richter escreveu: > 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 'The called function was 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 > 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 > Tested-by: Christian Borntraeger > Reviewed-by: Hendrik Brueckner > --- > tools/perf/util/annotate.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index 49ff825f745c..feb6006b676d 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -192,6 +192,14 @@ static int call__parse(struct arch *arch, struct ins_operands *ops, struct map * > }; > > ops->target.addr = strtoull(ops->raw, &endptr, 16); > + if (!strcmp(arch->name, "s390")) { > + /* s390 function call 1st operand is register */ > + tok = strchr(ops->raw, ','); > + if (tok) > + ops->target.addr = strtoull(tok + 1, &endptr, 16); > + else > + ops->target.addr = 0; > + } else > + ops->target.addr = strtoull(ops->raw, &endptr, 16); Do we have to do this here? Can't we have a s390_call__parse() and set that in the s/390 instructions? We should avoid arch specific stuff in the common code, and we could even have a call_reg__parse() perhaps? One that knows that the first operand is a reg and it should _always_ skip te first one, be it on s/390 or elsewhere? - Arnaldo > name = strchr(endptr, '<'); > if (name == NULL) > -- > 2.14.3