Skip to content

Deprecate async ring/perf buffer APIs and AUTO_CALLBACK usage#5354

Open
mikeagun with Copilot wants to merge 6 commits into
mainfrom
copilot/deprecate-async-io-ring-buffer-apis
Open

Deprecate async ring/perf buffer APIs and AUTO_CALLBACK usage#5354
mikeagun with Copilot wants to merge 6 commits into
mainfrom
copilot/deprecate-async-io-ring-buffer-apis

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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

    • Added __declspec(deprecated(...)) on:
      • ebpf_perf_buffer__new
      • ebpf_ring_buffer__new
      • ebpf_perf_event_array_map_write
      • ebpf_ring_buffer_map_write
    • Added matching Doxygen @deprecated guidance with polling replacements.
  • Flag deprecation guidance

    • Marked EBPF_RINGBUF_FLAG_AUTO_CALLBACK and EBPF_PERFBUF_FLAG_AUTO_CALLBACK as deprecated in API/docs comments and usage guidance.
    • Kept ABI unchanged (no enum value changes).
  • Docs alignment

    • Updated docs/RingBuffer.md and docs/PerfEventArray.md to label async callback mode as deprecated and direct consumers to *_poll() / *_consume() flow.
  • Internal/test callsite compatibility

    • Added local warning suppression where deprecated APIs are intentionally exercised to avoid noisy failures from expected legacy coverage.
    • Refactored ring/perf buffer construction so non-deprecated APIs no longer call deprecated APIs:
      • Introduced internal-only constructors (ebpf_ring_buffer_new_internal, ebpf_perf_buffer_new_internal).
      • Kept deprecated public symbols (ebpf_ring_buffer__new, ebpf_perf_buffer__new) as thin wrappers over the internal constructors.
      • Updated ring_buffer__new() and perf_buffer__new() to call the internal constructors directly.
_Must_inspect_result_ __declspec(deprecated("Use polling-based perf buffer APIs instead.")) ebpf_result_t
ebpf_perf_event_array_map_write(
    fd_t perf_event_array_map_fd,
    _In_reads_bytes_(data_length) const void* data,
    size_t data_length) EBPF_NO_EXCEPT;

Testing

Existing tests already exercise these APIs; no new functional test paths were introduced.

If new tests were added:

  • Unit tests are added.
  • Driver tests are added.
  • Fuzz tests are added.

Documentation

Yes. Updated RingBuffer and PerfEventArray documentation to reflect async-mode deprecation and polling-mode recommendation.

Installation

No installer impact.

Copilot AI linked an issue Jun 8, 2026 that may be closed by this pull request
4 tasks
Copilot AI changed the title [WIP] Deprecate all async IO based ring buffer APIs Deprecate async ring/perf buffer APIs and AUTO_CALLBACK usage Jun 8, 2026
Copilot AI requested a review from mikeagun June 8, 2026 16:33
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@mikeagun

mikeagun commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@copilot There are build failures from unsuppressed warnings - carefully address them.

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot There are build failures from unsuppressed warnings - carefully address them.

Addressed in commit 5bc5e18. I traced the CI failures to libs/api/libbpf_map.cpp(474) and added a targeted #pragma warning(suppress : 4996) for the intentional ebpf_ring_buffer__new() compatibility call in ring_buffer__new(), matching the existing suppression pattern used for ebpf_perf_buffer__new().

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@mikeagun
mikeagun force-pushed the copilot/deprecate-async-io-ring-buffer-apis branch from 5bc5e18 to 0c942a5 Compare June 9, 2026 18:18
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

Comment thread libs/api/libbpf_map.cpp Outdated
Comment thread libs/api/libbpf_map.cpp Outdated
@mikeagun

Copy link
Copy Markdown
Contributor

@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.

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@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 (ebpf_ring_buffer_new_internal / ebpf_perf_buffer_new_internal), made the deprecated public APIs (ebpf_ring_buffer__new / ebpf_perf_buffer__new) thin wrappers over those internals, and switched ring_buffer__new/perf_buffer__new to call the internal constructors directly so non-deprecated APIs no longer wrap deprecated ones.

@mikeagun
mikeagun requested a review from dthaler June 19, 2026 15:49
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

dthaler
dthaler previously approved these changes Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@Alan-Jowett
Alan-Jowett force-pushed the copilot/deprecate-async-io-ring-buffer-apis branch from bb39d2f to f678604 Compare July 7, 2026 16:28
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

Comment thread tests/api_test/api_test.cpp Outdated
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@saxena-anurag

saxena-anurag commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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:

  1. Use the deprecated APIs in those tests that are specifically testing the deprecated API (for functional / regression testing of these APIs).
  2. For all other instances, maybe we should update the test code to move to new APIs?

Rest of the changes look good.

Copilot AI and others added 5 commits July 15, 2026 10:39
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.
@Alan-Jowett
Alan-Jowett force-pushed the copilot/deprecate-async-io-ring-buffer-apis branch from 92fadc8 to 6dfeaf2 Compare July 15, 2026 17:39
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

Alan-Jowett
Alan-Jowett previously approved these changes Jul 15, 2026
@mikeagun

Copy link
Copy Markdown
Contributor

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:

  1. Use the deprecated APIs in those tests that are specifically testing the deprecated API (for functional / regression testing of these APIs).
  2. For all other instances, maybe we should update the test code to move to new APIs?

Rest of the changes look good.

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
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Deprecate all async IO based ring buffer APIs

6 participants