libbpf: remove sample_period init in perf_buffer
RFC PATCH 1/1 libbpf: remove sample_period init in perf_buffer
It seems that sample_period no used in perf buffer, actually only wakeup_events valid about events aggregation for wakeup. So remove it to avoid causing confusion.
--- tools/lib/bpf/libbpf.c | 1 - 1 file changed, 1 deletion(-)
tools/lib/bpf/libbpf.c +0 -1
@@ -13306,7 +13306,6 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt, attr.config =PERF_COUNT_SW_BPF_OUTPUT ; attr.type =PERF_TYPE_SOFTWARE ; attr.sample_type =PERF_SAMPLE_RAW ; - attr.sample_period = sample_period; attr.wakeup_events = sample_period; p.attr = &attr;
Signature · 1 line
2.43.0
Quoted 3 lines · Tao Chen
It seems that
sample_periodno used in perf buffer, actually onlywakeup_eventsvalid about events aggregation for wakeup. So remove it to avoid causing confusion.
I don't see too much confusion in keeping it, but I think it should be safe to remove it
PERF_COUNT_SW_BPF_OUTPUT is "trigered" by bpf_perf_event_output, AFAICS there's no path checking on sample_period for this event used in context of perf_buffer__new, Namhyung, thoughts?
thanks,
jirka
Quoted 22 lines
Fixes fb84b8224655 ("libbpf: add perf buffer API")Signed-off-by Tao Chen <[email protected]>--- tools/lib/bpf/libbpf.c | 1 - 1 file changed, 1 deletion(-)tools/lib/bpf/libbpf.c +0
-1@@ -13306,7 +13306,6 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt, attr.config =PERF_COUNT_SW_BPF_OUTPUT ; attr.type =PERF_TYPE_SOFTWARE ; attr.sample_type =PERF_SAMPLE_RAW ; - attr.sample_period = sample_period; attr.wakeup_events = sample_period; p.attr = &attr;Signature · 1 line
2.43.0
Namhyung Kim
Acked-byHello,
Quoted 11 lines · Jiri Olsa
Quoted 3 lines · Tao Chen
It seems that
sample_periodno used in perf buffer, actually onlywakeup_eventsvalid about events aggregation for wakeup. So remove it to avoid causing confusion.I don't see too much confusion in keeping it, but I think it should be safe to remove it
PERF_COUNT_SW_BPF_OUTPUTis "trigered" bybpf_perf_event_output, AFAICS there's no path checking onsample_periodfor this event used in context ofperf_buffer__new, Namhyung, thoughts?
It seems to be ok to call mmap(2) for non-sampling events.
Thanks,
Namhyung
Quoted 23 lines
Quoted 23 lines
Fixes fb84b8224655 ("libbpf: add perf buffer API")Signed-off-by Tao Chen <[email protected]>--- tools/lib/bpf/libbpf.c | 1 - 1 file changed, 1 deletion(-)tools/lib/bpf/libbpf.c +0
-1@@ -13306,7 +13306,6 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt, attr.config =PERF_COUNT_SW_BPF_OUTPUT ; attr.type =PERF_TYPE_SOFTWARE ; attr.sample_type =PERF_SAMPLE_RAW ; - attr.sample_period = sample_period; attr.wakeup_events = sample_period; p.attr = &attr;Signature · 1 line
2.43.0
Jiri Olsa
Acked-byQuoted 11 lines · Namhyung Kim
Hello,
Quoted 8 lines · Jiri Olsa
Quoted 3 lines · Tao Chen
It seems that
sample_periodno used in perf buffer, actually onlywakeup_eventsvalid about events aggregation for wakeup. So remove it to avoid causing confusion.I don't see too much confusion in keeping it, but I think it should be safe to remove it
Quoted 7 lines
Quoted 3 lines
PERF_COUNT_SW_BPF_OUTPUTis "trigered" bybpf_perf_event_output, AFAICS there's no path checking onsample_periodfor this event used in context ofperf_buffer__new, Namhyung, thoughts?It seems to be ok to call mmap(2) for non-sampling events.
Acked-by Namhyung Kim <[email protected]>
Tao Chen,
could you please resend without rfc tag? plz keeps acks
thanks,
jirka
Quoted 27 lines
Thanks,
NamhyungQuoted 23 lines
Quoted 23 lines
Fixes fb84b8224655 ("libbpf: add perf buffer API")Signed-off-by Tao Chen <[email protected]>--- tools/lib/bpf/libbpf.c | 1 - 1 file changed, 1 deletion(-)tools/lib/bpf/libbpf.c +0
-1@@ -13306,7 +13306,6 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt, attr.config =PERF_COUNT_SW_BPF_OUTPUT ; attr.type =PERF_TYPE_SOFTWARE ; attr.sample_type =PERF_SAMPLE_RAW ; - attr.sample_period = sample_period; attr.wakeup_events = sample_period; p.attr = &attr;Signature · 1 line
2.43.0
Quoted 16 lines · Jiri Olsa
Quoted 15 lines · Namhyung Kim
Hello,
Quoted 11 lines · Jiri Olsa
Quoted 3 lines · Tao Chen
It seems that
sample_periodno used in perf buffer, actually onlywakeup_eventsvalid about events aggregation for wakeup. So remove it to avoid causing confusion.I don't see too much confusion in keeping it, but I think it should be safe to remove it
PERF_COUNT_SW_BPF_OUTPUTis "trigered" bybpf_perf_event_output, AFAICS there's no path checking onsample_periodfor this event used in context ofperf_buffer__new, Namhyung, thoughts?
Quoted 7 lines
Quoted 3 lines
It seems to be ok to call mmap(2) for non-sampling events.
Acked-by Namhyung Kim <[email protected]>Tao Chen,
could you please resend without rfc tag? plz keeps acks
sure, will resend it, thanks.
Quoted 33 lines
Acked-by Jiri Olsa <[email protected]>thanks,
jirkaQuoted 27 lines
Thanks,
NamhyungQuoted 23 lines
Quoted 23 lines
Fixes fb84b8224655 ("libbpf: add perf buffer API")Signed-off-by Tao Chen <[email protected]>--- tools/lib/bpf/libbpf.c | 1 - 1 file changed, 1 deletion(-)tools/lib/bpf/libbpf.c +0
-1@@ -13306,7 +13306,6 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt, attr.config =PERF_COUNT_SW_BPF_OUTPUT ; attr.type =PERF_TYPE_SOFTWARE ; attr.sample_type =PERF_SAMPLE_RAW ; - attr.sample_period = sample_period; attr.wakeup_events = sample_period; p.attr = &attr;Signature · 1 line
2.43.0
Signature · 2 lines
Best Regards Tao Chen