Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672006

Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events

From Adrian Hunter <adrian.hunter@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
Date 2017-06-21 22:30 +0200
Message-ID <tUUqd-2L1-3@gated-at.bofh.it> (permalink)
References <tLiNb-3tM-7@gated-at.bofh.it> <tUL3A-4SB-23@gated-at.bofh.it> <tUOkP-6Mr-29@gated-at.bofh.it> <tUQZj-aB-1@gated-at.bofh.it> <tURC2-HR-13@gated-at.bofh.it>
Organization Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki

Show all headers | View raw


On 06/21/2017 08:29 PM, Arnaldo Carvalho de Melo wrote:
> 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?

That seems fine.  Pedantically it should be (INT_MAX + 1U) otherwise it will
be negative on a 32-bit system.

> 
>>> 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
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events Adrian Hunter <adrian.hunter@intel.com> - 2017-06-21 12:30 +0200
  Re: [PATCH V3 20/37] perf script: Add 'synth' event type for  synthesized events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-21 16:00 +0200
    Re: [PATCH V3 20/37] perf script: Add 'synth' event type for  synthesized events Adrian Hunter <adrian.hunter@intel.com> - 2017-06-21 18:50 +0200
      Re: [PATCH V3 20/37] perf script: Add 'synth' event type for  synthesized events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-21 19:30 +0200
        Re: [PATCH V3 20/37] perf script: Add 'synth' event type for  synthesized events Adrian Hunter <adrian.hunter@intel.com> - 2017-06-21 22:30 +0200
          Re: [PATCH V3 20/37] perf script: Add 'synth' event type for  synthesized events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-22 17:10 +0200
  [tip:perf/core] perf script: Add 'synth' event type for synthesized  events tip-bot for Adrian Hunter <tipbot@zytor.com> - 2017-07-01 11:00 +0200

csiph-web