linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
	Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>,
	Michael Petlan <mpetlan@redhat.com>,
	linux-perf-users@vger.kernel.org, linux-s390@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH 3/5] perf util: Introduce architecture specific errno/name mapping
Date: Thu, 18 Jan 2018 11:11:06 -0300	[thread overview]
Message-ID: <20180118141105.GD18383@kernel.org> (raw)
In-Reply-To: <20180118113320.GC4600@linux.vnet.ibm.com>

Em Thu, Jan 18, 2018 at 12:33:20PM +0100, Hendrik Brueckner escreveu:
> On Thu, Jan 18, 2018 at 07:49:53AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Jan 18, 2018 at 11:07:33AM +0100, Jiri Olsa escreveu:
> > > On Tue, Jan 16, 2018 at 10:46:29AM +0100, Hendrik Brueckner wrote:
> > > 
> > > SNIP
> > > 
> > > > index 12dec6e..90ce14f 100644
> > > > --- a/tools/perf/Makefile.config
> > > > +++ b/tools/perf/Makefile.config
> > > > @@ -249,7 +249,7 @@ INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
> > > >  INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/
> > > >  INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/
> > > >  
> > > > -# $(obj-perf)      for generated common-cmds.h
> > > > +# $(obj-perf)      for generated common-cmds.h and errno-names.c
> > > >  # $(obj-perf)/util for generated bison/flex headers
> > > >  ifneq ($(OUTPUT),)
> > > >  INC_FLAGS += -I$(obj-perf)/util
> > > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > > > index 9fdefd7..332b4b4 100644
> > > > --- a/tools/perf/Makefile.perf
> > > > +++ b/tools/perf/Makefile.perf
> > > > @@ -518,6 +518,9 @@ $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
> > > >  $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
> > > >  	$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
> > > >  
> > > > +$(OUTPUT)util/errno-names.c: util/generate-errno-names.sh
> > > > +	$(QUIET_GEN). util/generate-errno-names.sh "$(CC)" "$(srctree)/tools" > $@+ && mv $@+ $@
> > > 
> > > so this generates errno-names.c with following code:
> > > 
> > > const char *arch_errno_to_name(const char *arch, int err)
> > > {
> > >         if (!strcmp(arch, "alpha"))
> > >                 return errno_to_name__alpha(err);
> > >         if (!strcmp(arch, "arm"))
> > >                 return errno_to_name__arm(err);
> > >         if (!strcmp(arch, "arm64"))
> > >                 return errno_to_name__arm64(err);
> > > 
> > > 
> > > is there a reason why we want all archs compiled in?
> > > I'd think we just need the arch perf is built in
> > 
> > think about:
> > 
> > On an arm64 system:
> > 
> > 	perf trace record -a sleep 1
> > 
> > scp that to an x86_64 system and do:
> > 
> > 	perf trace -i perf.data
> > 
> > But doing that strcmp per call seems excessive, perhaps we could have
> > something like:
> > 
> > 	trace->arch = arch_syscalls__init(arch_name);
> > 
> > 	char *s = arch_syscalls__strerrno(trace->arch, err);
> > 
> > Have to look at the code to find the right naming according to what we
> > already have.
> 
> Another idea to get rid of the strcmp's is to introduce an arch enum
> and let normalize_arch() in util/env.c return an enum number and handle
> the arch stuff then on the enum.  Where necessary, the arch string can
> be used.  But for "internal" purposes, an enum would be better.

Right, we can go on improving things, but I think that after you get the
generated directory sorted out I'll apply your patches in the current
form, and then we can go on improving things from there, ok?

- Arnaldo

  reply	other threads:[~2018-01-18 14:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16  9:46 [PATCH 0/5] perf trace: Introduce arch-specific errno code/name mappings Hendrik Brueckner
2018-01-16  9:46 ` [PATCH 1/5] tools include arch: Grab a copy of errno.h for arch's supported by perf Hendrik Brueckner
2018-01-16  9:46 ` [PATCH 2/5] tools include asm-generic: Grab errno.h and errno-base.h Hendrik Brueckner
2018-01-16  9:46 ` [PATCH 3/5] perf util: Introduce architecture specific errno/name mapping Hendrik Brueckner
2018-01-16 13:58   ` Arnaldo Carvalho de Melo
2018-01-17  8:49     ` Hendrik Brueckner
2018-01-18 10:07   ` Jiri Olsa
2018-01-18 10:49     ` Arnaldo Carvalho de Melo
2018-01-18 11:33       ` Hendrik Brueckner
2018-01-18 14:11         ` Arnaldo Carvalho de Melo [this message]
2018-01-18 12:19       ` Jiri Olsa
2018-01-16  9:46 ` [PATCH 4/5] perf trace: Obtain errno values by using arch_errno_to_name() Hendrik Brueckner
2018-01-16  9:46 ` [PATCH 5/5] perf trace: Remove audit-libs dependency if syscall tables are present Hendrik Brueckner

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=20180118141105.GD18383@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=tmricht@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).