* [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer
@ 2025-04-22 9:15 Tao Chen
2025-04-22 13:43 ` Jiri Olsa
0 siblings, 1 reply; 5+ messages in thread
From: Tao Chen @ 2025-04-22 9:15 UTC (permalink / raw)
To: andrii, eddyz87, ast, daniel, martin.lau, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa
Cc: bpf, linux-kernel, Tao Chen
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.
Fixes: fb84b8224655 ("libbpf: add perf buffer API")
Signed-off-by: Tao Chen <chen.dylane@linux.dev>
---
tools/lib/bpf/libbpf.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 194809da5172..1830e3c011a5 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -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;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer 2025-04-22 9:15 [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer Tao Chen @ 2025-04-22 13:43 ` Jiri Olsa 2025-04-22 19:05 ` Namhyung Kim 0 siblings, 1 reply; 5+ messages in thread From: Jiri Olsa @ 2025-04-22 13:43 UTC (permalink / raw) To: Tao Chen, Namhyung Kim Cc: andrii, eddyz87, ast, daniel, martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, bpf, linux-kernel On Tue, Apr 22, 2025 at 05:15:58PM +0800, Tao Chen wrote: > 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. 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 > > Fixes: fb84b8224655 ("libbpf: add perf buffer API") > Signed-off-by: Tao Chen <chen.dylane@linux.dev> > --- > tools/lib/bpf/libbpf.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 194809da5172..1830e3c011a5 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -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; > -- > 2.43.0 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer 2025-04-22 13:43 ` Jiri Olsa @ 2025-04-22 19:05 ` Namhyung Kim 2025-04-23 15:51 ` Jiri Olsa 0 siblings, 1 reply; 5+ messages in thread From: Namhyung Kim @ 2025-04-22 19:05 UTC (permalink / raw) To: Jiri Olsa Cc: Tao Chen, andrii, eddyz87, ast, daniel, martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, bpf, linux-kernel Hello, On Tue, Apr 22, 2025 at 03:43:43PM +0200, Jiri Olsa wrote: > On Tue, Apr 22, 2025 at 05:15:58PM +0800, Tao Chen wrote: > > 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. > > 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? It seems to be ok to call mmap(2) for non-sampling events. Acked-by: Namhyung Kim <namhyung@kernel.org> Thanks, Namhyung > > > > > Fixes: fb84b8224655 ("libbpf: add perf buffer API") > > Signed-off-by: Tao Chen <chen.dylane@linux.dev> > > --- > > tools/lib/bpf/libbpf.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > index 194809da5172..1830e3c011a5 100644 > > --- a/tools/lib/bpf/libbpf.c > > +++ b/tools/lib/bpf/libbpf.c > > @@ -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; > > -- > > 2.43.0 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer 2025-04-22 19:05 ` Namhyung Kim @ 2025-04-23 15:51 ` Jiri Olsa 2025-04-23 16:26 ` Tao Chen 0 siblings, 1 reply; 5+ messages in thread From: Jiri Olsa @ 2025-04-23 15:51 UTC (permalink / raw) To: Namhyung Kim Cc: Jiri Olsa, Tao Chen, andrii, eddyz87, ast, daniel, martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, bpf, linux-kernel On Tue, Apr 22, 2025 at 12:05:55PM -0700, Namhyung Kim wrote: > Hello, > > On Tue, Apr 22, 2025 at 03:43:43PM +0200, Jiri Olsa wrote: > > On Tue, Apr 22, 2025 at 05:15:58PM +0800, Tao Chen wrote: > > > 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. > > > > 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? > > It seems to be ok to call mmap(2) for non-sampling events. > > Acked-by: Namhyung Kim <namhyung@kernel.org> Tao Chen, could you please resend without rfc tag? plz keeps acks Acked-by: Jiri Olsa <jolsa@kernel.org> thanks, jirka > > Thanks, > Namhyung > > > > > > > > > Fixes: fb84b8224655 ("libbpf: add perf buffer API") > > > Signed-off-by: Tao Chen <chen.dylane@linux.dev> > > > --- > > > tools/lib/bpf/libbpf.c | 1 - > > > 1 file changed, 1 deletion(-) > > > > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > > index 194809da5172..1830e3c011a5 100644 > > > --- a/tools/lib/bpf/libbpf.c > > > +++ b/tools/lib/bpf/libbpf.c > > > @@ -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; > > > -- > > > 2.43.0 > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer 2025-04-23 15:51 ` Jiri Olsa @ 2025-04-23 16:26 ` Tao Chen 0 siblings, 0 replies; 5+ messages in thread From: Tao Chen @ 2025-04-23 16:26 UTC (permalink / raw) To: Jiri Olsa, Namhyung Kim Cc: andrii, eddyz87, ast, daniel, martin.lau, song, yonghong.song, john.fastabend, kpsingh, sdf, haoluo, bpf, linux-kernel 在 2025/4/23 23:51, Jiri Olsa 写道: > On Tue, Apr 22, 2025 at 12:05:55PM -0700, Namhyung Kim wrote: >> Hello, >> >> On Tue, Apr 22, 2025 at 03:43:43PM +0200, Jiri Olsa wrote: >>> On Tue, Apr 22, 2025 at 05:15:58PM +0800, Tao Chen wrote: >>>> 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. >>> >>> 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? >> >> It seems to be ok to call mmap(2) for non-sampling events. >> >> Acked-by: Namhyung Kim <namhyung@kernel.org> > > Tao Chen, > could you please resend without rfc tag? plz keeps acks > sure, will resend it, thanks. > Acked-by: Jiri Olsa <jolsa@kernel.org> > > thanks, > jirka > > >> >> Thanks, >> Namhyung >> >>> >>>> >>>> Fixes: fb84b8224655 ("libbpf: add perf buffer API") >>>> Signed-off-by: Tao Chen <chen.dylane@linux.dev> >>>> --- >>>> tools/lib/bpf/libbpf.c | 1 - >>>> 1 file changed, 1 deletion(-) >>>> >>>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c >>>> index 194809da5172..1830e3c011a5 100644 >>>> --- a/tools/lib/bpf/libbpf.c >>>> +++ b/tools/lib/bpf/libbpf.c >>>> @@ -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; >>>> -- >>>> 2.43.0 >>>> -- Best Regards Tao Chen ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-04-23 16:26 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-04-22 9:15 [RFC PATCH bpf-next] libbpf: remove sample_period init in perf_buffer Tao Chen 2025-04-22 13:43 ` Jiri Olsa 2025-04-22 19:05 ` Namhyung Kim 2025-04-23 15:51 ` Jiri Olsa 2025-04-23 16:26 ` Tao Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox