* Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
[not found] ` <1498040239-32418-1-git-send-email-adrian.hunter@intel.com>
@ 2017-06-21 13:51 ` Arnaldo Carvalho de Melo
2017-06-21 16:41 ` Adrian Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-21 13:51 UTC (permalink / raw)
To: Adrian Hunter
Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan,
David Ahern, Alexander Shishkin, linux-perf-users, linux-kernel
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_).
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
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
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2017-06-21 16:41 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan,
David Ahern, Alexander Shishkin, linux-perf-users, linux-kernel
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.
> 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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
2017-06-21 16:41 ` Adrian Hunter
@ 2017-06-21 17:29 ` Arnaldo Carvalho de Melo
2017-06-21 20:20 ` Adrian Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-21 17:29 UTC (permalink / raw)
To: Adrian Hunter
Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan,
David Ahern, Alexander Shishkin, linux-perf-users, linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
2017-06-21 17:29 ` Arnaldo Carvalho de Melo
@ 2017-06-21 20:20 ` Adrian Hunter
2017-06-22 14:59 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2017-06-21 20:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan,
David Ahern, Alexander Shishkin, linux-perf-users, linux-kernel
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3 20/37] perf script: Add 'synth' event type for synthesized events
2017-06-21 20:20 ` Adrian Hunter
@ 2017-06-22 14:59 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-22 14:59 UTC (permalink / raw)
To: Adrian Hunter
Cc: Andi Kleen, Peter Zijlstra, Jiri Olsa, Namhyung Kim, Wang Nan,
David Ahern, Alexander Shishkin, linux-perf-users, linux-kernel
Em Wed, Jun 21, 2017 at 11:20:03PM +0300, Adrian Hunter escreveu:
> 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:
> >> 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.
oh, not pedantic at all, thanks for the fix, will update your patch and
continue from there, Ingo already pulled everything up to this point,
btw.
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-22 14:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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
2017-06-21 20:20 ` Adrian Hunter
2017-06-22 14:59 ` Arnaldo Carvalho de Melo
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).