linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>, David Ahern <dsahern@gmail.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
Date: Wed, 21 Jun 2017 14:29:11 -0300	[thread overview]
Message-ID: <20170621172911.GQ13640@kernel.org> (raw)
In-Reply-To: <66cdc4e6-58a4-e365-8a76-112daf71baf9@intel.com>

Em Wed, Jun 21, 2017 at 07:41:04PM +0300, Adrian Hunter escreveu:
> On 06/21/2017 04:51 PM, Arnaldo Carvalho de Melo wrote:
> > Em Wed, Jun 21, 2017 at 01:17:19PM +0300, Adrian Hunter escreveu:
> >> +++ b/tools/perf/util/event.h
> >> @@ -252,6 +252,9 @@ enum auxtrace_error_type {
> >>        PERF_AUXTRACE_ERROR_MAX
> >> };
> > 
> >> +/* Attribute type for custom synthesized events */
> >> +#define PERF_TYPE_SYNTH		3000000000
> > 
> > Why don't you make it PERF_TYPE_MAX and bump PERF_TYPE_MAX by one? I.e.
> > this way we have what can be in attr.type in a nice enumeration, can
> > validate it more easily (attr.type < PERF_TYPE_MAX) and will not need to 
> > do those conversions to/from OUTPUT_TYPE_/PERF_TYPE_).
 
> PERF_TYPE_ is dynamically allocated above PERF_TYPE_MAX for PMUs.  Presently
> perf_pmu_register() calls idr_alloc() with end=0 which limits the allocation
> to INT_MAX.

Oh, forgot about that, guess a comment right beside PERF_TYPE_MAX is in
demand :-\

So why not:

/*
 * PERF_TYPE_ is dynamically allocated above PERF_TYPE_MAX for PMUs.  Presently
 * perf_pmu_register() calls idr_alloc() with end=0 which limits the allocation
 * to INT_MAX.
 */
#define PERF_TYPE_SYNTH		(INT_MAX + 1L)

I.e. wouldn't be some arbitrarily huge value, but one right after what
was defined as the area for the dynamicly allocated PERF_TYPE_
"namespace" for PMUs, right?

> > Peter: now its not the PERF_RECORD_ namespace that userspaces want a
> > chunk of, its PERF_TYPE_, which so far has been pretty stable, grabing
> > _one_ for event synthesizing things like Intel PT (and ARM's coresight,
> > I think) directly at include/uapi/linux/perf_event.h's perf_type_id enum
> > looks cleaner, no?

- Arnaldo

  reply	other threads:[~2017-06-21 17:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1495786658-18063-21-git-send-email-adrian.hunter@intel.com>
     [not found] ` <1498040239-32418-1-git-send-email-adrian.hunter@intel.com>
2017-06-21 13:51   ` [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events Arnaldo Carvalho de Melo
2017-06-21 16:41     ` Adrian Hunter
2017-06-21 17:29       ` Arnaldo Carvalho de Melo [this message]
2017-06-21 20:20         ` Adrian Hunter
2017-06-22 14:59           ` Arnaldo Carvalho de Melo

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=20170621172911.GQ13640@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).