-
Notifications
You must be signed in to change notification settings - Fork 254
ringbuffer: direct mmap consumers #4493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The code I've pushed works insofar as I can run the ringbuf reader implementation of ebpf-go against it and it seems to mostly work. I've been bashing my head against how to correctly map the ring buffer to user space, and need some help. To recap:
Creating the double mapping is a bit awkward. Combining it with different page protections make it really difficult. My current approach is to create an MDL for the kernel space, which just covers all of the buffer. That is mapped as usual, and not a big problem (besides playing fast and loose with page locking). I first tried to use MmUnmapLockedPages, but that requires access to the original MDL used to create the mapping. How would I use that when there are potentially multiple mappings of the same MDL? Can I simply pass different addresses? It also has the slightly unfortunate side effect that freeing the mappings requires access to the ringbuffer handle. What I mean by this is that on Linux the flow is roughly this:
So I tried to figure out another way to free this and looked into memory sections as suggested by @Alan-Jowett. I can't figure out how to make these work either:
Am I just missing a trick? Why is this so hard on Windows? cc @mikeagun |
As per the discussion in the office hours I just went for the simplest thing and added an API which allows unmapping given an fd. |
This PR will address the ring buffer portion of #4163
Based on #4265 by @mikeagun
Updates: #4163