How about limiting refresh ioctl to sampling events ?
Hello Peter,
I'm looking at the perf event stuff and wondering if perf_event_refresh() should be limited to sampling events.
Does the following make sense ?
kernel/perf_event.c +1 -1
@@ -1072,7 +1072,7 @@ static int perf_event_refresh(struct perf_event *event, int refresh)/* * not supported on inherited events */ -if (event->attr.inherit) +if (event->attr.inherit || !event->attr.sample_period)return -EINVAL ;atomic_add (refresh, &event->event_limit);
Thanks
Signature · 1 line
Franck
Quoted 12 lines · Franck Bui-Huu
Hello Peter,
I'm looking at the perf event stuff and wondering if
perf_event_refresh()should be limited to sampling events.Does the following make sense ?
kernel/perf_event.c +0
-0
kernel/perf_event.c static int perf_event_refresh(struct perf_event *event, int refresh) · line 1078
Quoted 8 lines
kernel/perf_event.c +1
-1@@ -1072,7 +1072,7 @@ static int perf_event_refresh(struct perf_event *event, int refresh)/* * not supported on inherited events */ -if (event->attr.inherit) +if (event->attr.inherit || !event->attr.sample_period)return -EINVAL ;atomic_add (refresh, &event->event_limit);
Yes it does, please submit as a proper patch.
Quoted 21 lines · Peter Zijlstra
Quoted 20 lines · Franck Bui-Huu
Hello Peter,
I'm looking at the perf event stuff and wondering if
perf_event_refresh()should be limited to sampling events.Does the following make sense ?
kernel/perf_event.c +1
-1@@ -1072,7 +1072,7 @@ static int perf_event_refresh(struct perf_event *event, int refresh)/* * not supported on inherited events */ -if (event->attr.inherit) +if (event->attr.inherit || !event->attr.sample_period)return -EINVAL ;
Quoted 3 lines
kernel/perf_event.c static int perf_event_refresh(struct perf_event *event, int refresh) · line 1078
Quoted 1 line
kernel/perf_event.c +0
-0atomic_add (refresh, &event->event_limit);Yes it does, please submit as a proper patch.
Ok.
I'm also wondering if you would accept a second patch which will introduce:
static inline bool is_sampling_event(struct perf_event *event)
{
return event->attr.sample_period != 0;
}That would make the code slighlty easier to read IMHO.
Signature · 1 line
Franck
Quoted 32 lines · Franck Bui-Huu
Quoted 21 lines · Peter Zijlstra
Quoted 20 lines · Franck Bui-Huu
Hello Peter,
I'm looking at the perf event stuff and wondering if
perf_event_refresh()should be limited to sampling events.Does the following make sense ?
kernel/perf_event.c +1
-1@@ -1072,7 +1072,7 @@ static int perf_event_refresh(struct perf_event *event, int refresh)/* * not supported on inherited events */ -if (event->attr.inherit) +if (event->attr.inherit || !event->attr.sample_period)return -EINVAL ;Quoted 3 lines
kernel/perf_event.c static int perf_event_refresh(struct perf_event *event, int refresh) · line 1078
Quoted 1 line
kernel/perf_event.c +0
-0atomic_add (refresh, &event->event_limit);Yes it does, please submit as a proper patch.
Ok.
I'm also wondering if you would accept a second patch which will introduce:
Quoted 7 lines
static inline bool
is_sampling_event(struct perf_event *event){ return event->attr.sample_period != 0; }That would make the code slighlty easier to read IMHO.
Sure, Francis might want that too, he found another something like this.
Peter Zijlstra <[email protected]> writes:
[...]
Quoted 8 lines
Quoted 8 lines
I'm also wondering if you would accept a second patch which will introduce:
static inline bool
is_sampling_event(struct perf_event *event){ return event->attr.sample_period != 0; }
Quoted 4 lines
Quoted 2 lines
That would make the code slighlty easier to read IMHO.
Sure, Francis might want that too, he found another something like this.
Yes there's another issue when counting events are used: they call perf_event_output() when 'period_left' gets 0 where as they should not.
Signature · 1 line
Francis