You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perf Event Array map user-mode API implementation with tests (#4302)
* Perf Event Array map user-mode API implementation with tests
* CR Feedback
* Refactored and Unified the Ring Buffer and perf event array user mode API. Incorporated test fixes from Michael.
* Fixed build and Test issues
* Review Feedback Changes
* Fixed the AV in Perf_Buffer_free
* Used Conditional Variables to wait for callbacks to complete
* Added support for Using multiple subscription rings
* CR Comments
* Rename `_ebpf_map_subscription_ring` to `_ebpf_map_async_query_context`
For better readability, renaming `_ebpf_map_subscription_ring` to `_ebpf_map_async_query_context`.
* More CR comments
* Added Check to make sure ring_buffer_new does not pass more than 1 CPU ID
* More CR Feedback
---------
Co-authored-by: Shankar Seal <74580197+shankarseal@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/PerfEventArray.md
+11-43Lines changed: 11 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,31 +25,26 @@ There are 3 primary differences between ring buffer maps and perf event arrays:
25
25
- `perf_event_output` takes the bpf context as an argument and the helper implementation copies the payload.
26
26
- The payload is whatever the data pointer of the program context points to (e.g. packet data including headers). The payload does not include the bpf program context structure itself.
27
27
28
-
The main motivation for this proposal is to efficiently support payload capture from the context in bpf programs.
28
+
The main motivation for this implementation is to efficiently support payload capture from the context in bpf programs.
29
29
- Supporting ring buffer reserve and submit in ebpf-for-windows is currently blocked on verifier support [#273](https://github.com/vbpf/ebpf-verifier/issues/273).
30
30
- Without reserve+submit, using `ringbuf_output` for payload capture requires using a per-CPU array as scratch space to append the payload to the event before calling ringbuf_output.
31
31
- The CTXLEN field in the flags of `perf_event_output` tells the kernel to append bytes from the payload to the record, avoiding the extra copy.
32
32
- On Linux this works for specific program types, on Windows this will work for any program type with a data pointer in the context.
33
33
34
34
35
-
## Proposal
35
+
The implementation behaviour matches Linux, but currently only supports user-space consumers and bpf-program producers with a subset of the features.
36
36
37
-
The proposed behaviour matches Linux, but currently only supports user-space consumers and bpf-program producers with a subset of the features.
37
+
The perf buffers are implemented using the existing per-CPU and ring buffer map support in ebpf-for-windows.
38
38
39
-
The plan is to implement perf buffers using the existing per-CPU and ring buffer map support in ebpf-for-windows.
40
-
41
-
To match Linux behaviour, by default the callback will only be called inside calls to `perf_buffer__poll()`.
42
-
If the PERFBUF_FLAG_AUTO_CALLBACK flag is set, the callback will be automatically invoked when there is data available.
43
-
44
-
1. Implement a new map type `BPF_MAP_TYPE_PERF_EVENT_ARRAY`.
39
+
1. Implements a new map type `BPF_MAP_TYPE_PERF_EVENT_ARRAY`.
45
40
1. Linux-compatible default behaviour.
46
41
- With Linux-compatible behaviour and bpf interfaces, additional features from Linux should be possible to add in the future.
47
42
2. Only support the perf ringbuffer (not other Linux perf features).
48
43
- Only support bpf program producers with a single user-space consumer per event array.
49
44
- Features not supported include perf counters, hardware-generated perf events,
50
45
attaching bpf programs to perf events, and sending events from user-space to bpf programs.
51
46
3. In addition to the Linux behaviour, automatically invoke the callback if the auto callback flag is set.
0 commit comments