Deprecate async ring/perf buffer APIs and AUTO_CALLBACK usage#5354
Conversation
|
@copilot There are build failures from unsuppressed warnings - carefully address them. |
Addressed in commit 5bc5e18. I traced the CI failures to |
5bc5e18 to
0c942a5
Compare
|
@copilot Rename the deprecated functions so they can be internal-only functions (to address dthaler's comments) and add wrappers (with the current names) for the now-deprecated public functions. |
Updated in fac3f9f: I split the implementations into internal-only constructors ( |
bb39d2f to
f678604
Compare
1 similar comment
|
General comment: it seems the deprecated APIs are being used in test code in a lot of places. Should we cleanup test code in the following way:
Rest of the changes look good. |
Address review feedback: instead of disabling C4996 for the whole file, suppress it only around the code that invokes the deprecated ring/perf buffer APIs. Use single-line #pragma warning(suppress : 4996) for isolated call sites and push/disable/pop blocks for test cases with several deprecated calls.
Remove the newly-added file-wide #pragma warning(disable : 4996) from socket_tests, end_to_end, common_tests, and libbpf_test, replacing each with suppression scoped to only the code that invokes the deprecated ring/perf buffer APIs: single-line #pragma warning(suppress : 4996) for isolated call sites and push/disable/pop blocks for test cases or helpers with several deprecated calls.
92fadc8 to
6dfeaf2
Compare
Avoiding the deprecated APIs (especially map_write) is a much larger change that will functionally change the tests. I will create a follow-up issue to update tests to avoid the deprecated APIs except where they are being specifically tested. |
Resolve conflict in libs/api/libbpf_map.cpp perf_buffer__new: combine main's EBPF_LOG_ENTRY/EBPF_RETURN_POINTER instrumentation (#5438) with the PR's internal constructor call (ebpf_perf_buffer_new_internal). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 29d93f38-af6b-4ab7-a7dc-2ee9876fb933
Description
This change deprecates the Windows-specific async ring/perf consumer surface now that polling-mode APIs are available and preferred. It marks the targeted APIs for compiler deprecation warnings and updates docs to consistently steer users to polling-based consumption.
Public API deprecations
__declspec(deprecated(...))on:ebpf_perf_buffer__newebpf_ring_buffer__newebpf_perf_event_array_map_writeebpf_ring_buffer_map_write@deprecatedguidance with polling replacements.Flag deprecation guidance
EBPF_RINGBUF_FLAG_AUTO_CALLBACKandEBPF_PERFBUF_FLAG_AUTO_CALLBACKas deprecated in API/docs comments and usage guidance.Docs alignment
docs/RingBuffer.mdanddocs/PerfEventArray.mdto label async callback mode as deprecated and direct consumers to*_poll()/*_consume()flow.Internal/test callsite compatibility
ebpf_ring_buffer_new_internal,ebpf_perf_buffer_new_internal).ebpf_ring_buffer__new,ebpf_perf_buffer__new) as thin wrappers over the internal constructors.ring_buffer__new()andperf_buffer__new()to call the internal constructors directly.Testing
Existing tests already exercise these APIs; no new functional test paths were introduced.
If new tests were added:
Documentation
Yes. Updated RingBuffer and PerfEventArray documentation to reflect async-mode deprecation and polling-mode recommendation.
Installation
No installer impact.