public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>, He Kuang <hekuang@huawei.com>,
	"wangnan0@huawei.com" <wangnan0@huawei.com>,
	"a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"jolsa@kernel.org" <jolsa@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf tools: Support bpf prologue for arm64
Date: Wed, 2 Sep 2015 11:34:55 +0100	[thread overview]
Message-ID: <20150902103455.GH25720@arm.com> (raw)
In-Reply-To: <20150831201628.GH4423@kernel.org>

On Mon, Aug 31, 2015 at 09:16:28PM +0100, Arnaldo Carvalho de Melo wrote:
> Em Sat, Aug 29, 2015 at 03:16:52AM +0000, He Kuang escreveu:
> > This patch implements arch_get_reg_info() for arm64 to enable
> > HAVE_BPF_PROLOGUE feature. For arm64, structure pt_regs is not composed
> > by fields of register names but an array of regs, so here we simply
> > multiply fixed register size by index number to get the byte offset.
> 
> Hi Jean, Will, are you ok with this? Can I have Acked-by or Reviewed-by
> tags from you?

Any idea what this applies against? It's difficult to review it without
knowing what PERF_HAVE_ARCH_GET_REG_INFO or HAVE_BPF_PROLOGUE are.

Anyway, a couple of small comments below.

> He, please try to add the authors of the files you change in the CC
> list.
> 
> - Arnaldo
>  
> > Signed-off-by: He Kuang <hekuang@huawei.com>
> > ---
> >  tools/perf/arch/arm64/Makefile          |  1 +
> >  tools/perf/arch/arm64/util/dwarf-regs.c | 26 ++++++++++++++++++++++++++
> >  2 files changed, 27 insertions(+)

Any plan to do arch/arm/ too?

> > diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
> > index 7fbca17..1256e6e 100644
> > --- a/tools/perf/arch/arm64/Makefile
> > +++ b/tools/perf/arch/arm64/Makefile
> > @@ -1,3 +1,4 @@
> >  ifndef NO_DWARF
> >  PERF_HAVE_DWARF_REGS := 1
> >  endif
> > +PERF_HAVE_ARCH_GET_REG_INFO := 1
> > diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c
> > index d49efeb..cb2c50a 100644
> > --- a/tools/perf/arch/arm64/util/dwarf-regs.c
> > +++ b/tools/perf/arch/arm64/util/dwarf-regs.c
> > @@ -10,6 +10,10 @@
> >  
> >  #include <stddef.h>
> >  #include <dwarf-regs.h>
> > +#include <string.h>
> > +#include <linux/ptrace.h>
> > +
> > +#define PT_REG_SIZE (sizeof(((struct user_pt_regs *)0)->regs[0]))

Why not add an "offset" field to pt_regs_dwarfnum and just calculate
that using offsetof in the GPR_DWARFNUM_NAME macro?

> >  
> >  struct pt_regs_dwarfnum {
> >  	const char *name;
> > @@ -78,3 +82,25 @@ const char *get_arch_regstr(unsigned int n)
> >  			return roff->name;
> >  	return NULL;
> >  }
> > +
> > +#ifdef HAVE_BPF_PROLOGUE
> > +int arch_get_reg_info(const char *name, int *offset)
> > +{
> > +	const struct pt_regs_dwarfnum *roff;
> > +
> > +	if (!name || !offset)
> > +		return -1;
> > +
> > +	for (roff = regdwarfnum_table; roff->name != NULL; roff++) {
> > +		if (!strcmp(roff->name, name)) {
> > +			if (roff->dwarfnum < 0)

When is this ever true? Do we need up update REG_DWARFNUM_END to use
a negative index?

Will

  parent reply	other threads:[~2015-09-02 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-29  3:16 [PATCH] perf tools: Support bpf prologue for arm64 He Kuang
2015-08-31 20:16 ` Arnaldo Carvalho de Melo
2015-09-01  2:04   ` He Kuang
2015-09-02 10:34   ` Will Deacon [this message]
2015-09-02 10:50     ` Wangnan (F)

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=20150902103455.GH25720@arm.com \
    --to=will.deacon@arm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=hekuang@huawei.com \
    --cc=jean.pihet@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=wangnan0@huawei.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