] bpf,perf: return EOPNOTSUPP for attaching bpf handler on PERF_COUNT_SW_DUMMY
Subsystems (4)
PATCH 1/1 ] bpf,perf: return EOPNOTSUPP for attaching bpf handler on PERF_COUNT_SW_DUMMY
At the moment it is not possible to attach a bpf handler to a perf event of type PERF_TYPE_SOFTWARE with a configuration of PERF_COUNT_SW_DUMMY.
--- kernel/events/core.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/events/core.c +4 -0
@@ -9668,6 +9668,10 @@ static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd)if (event->prog)return -EEXIST ; +if (event->attr.type ==PERF_TYPE_SOFTWARE && + event->attr.config ==PERF_COUNT_SW_DUMMY ) +return -EOPNOTSUPP ; + prog =bpf_prog_get_type (prog_fd,BPF_PROG_TYPE_PERF_EVENT );if (IS_ERR (prog))return PTR_ERR (prog);
Signature · 1 line
2.28.0
Quoted 3 lines · Florian Lehner
At the moment it is not possible to attach a bpf handler to a perf event of type
PERF_TYPE_SOFTWAREwith a configuration ofPERF_COUNT_SW_DUMMY.
It is possible or it is not possible?
Such "commit log as an abstract statement" patches are a mystery to a reader. Please explain what problem you're trying to solve and how it's being addressed.
Quoted 10 lines
Signed-off-by Florian Lehner <[email protected]>--- kernel/events/core.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/events/core.c +0
-0
kernel/events/core.c static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd) · line 9673
Quoted 6 lines
kernel/events/core.c +3
-0@@ -9668,6 +9668,10 @@ static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd)if (event->prog)return -EEXIST ; +if (event->attr.type ==PERF_TYPE_SOFTWARE && + event->attr.config ==PERF_COUNT_SW_DUMMY ) +return -EOPNOTSUPP ;
Is it a fix or a feature?
If it is a fix please add 'Fixes:' tag.
Quoted 9 lines · Alexei Starovoitov
Quoted 3 lines · Florian Lehner
At the moment it is not possible to attach a bpf handler to a perf event of type
PERF_TYPE_SOFTWAREwith a configuration ofPERF_COUNT_SW_DUMMY.It is possible or it is not possible?
Such "commit log as an abstract statement" patches are a mystery to a reader. Please explain what problem you're trying to solve and how it's being addressed.
Perf events of type software/dummy are just placeholder events and don't require a counting event. So attaching the bpf handler to the overflow_handler of this event does not trigger the execution of the bpf handler.
So the idea of this fix was to indicate to the user that attaching a bpf handler to such a perf event is not (yet) supported.
Quoted 13 lines
Quoted 13 lines
Signed-off-by Florian Lehner <[email protected]>--- kernel/events/core.c | 4 ++++ 1 file changed, 4 insertions(+)kernel/events/core.c +0
-0@@ -9668,6 +9668,10 @@ static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd)if (event->prog)return -EEXIST ;
Quoted 6 lines
kernel/events/core.c static int perf_event_set_bpf_handler(struct perf_event *event, u32 prog_fd) · line 9673
Quoted 3 lines
kernel/events/core.c +3
-0+if (event->attr.type ==PERF_TYPE_SOFTWARE && + event->attr.config ==PERF_COUNT_SW_DUMMY ) +return -EOPNOTSUPP ;Is it a fix or a feature?
If it is a fix please add 'Fixes:' tag.
I was not sure how to address it and so I have chosen PATCH. As bpf handlers are still not executed on such events, I also would not call it a feature.