microsoft / ebpf-for-windows

eBPF implementation that runs on top of Windows
MIT License
2.93k stars 234 forks source link

Interface impedance between NMR API and Windows EX_RUNDOWN_REF APIs #1854

Open Alan-Jowett opened 1 year ago

Alan-Jowett commented 1 year ago

The NMR APIs are designed to be completely asynchronous, with detach operations returning pending if the provider data is in use. The Windows EX_RUNDOWN_REF are synchronous, with rundown blocking until completion.

The NMR API contract requires some form of rundown protection to prevent use after detach, but the only Windows API are synchronous ones.

Proposal: Replace EX_RUNDOWN_REF with an asynchronous contract.

Alan-Jowett commented 1 year ago

Consider using the epoch logic and return pending from the nmr detach. Then at end of epoch, signal complete. This would remove the need for an interlocked operation on the hot path.