-
Notifications
You must be signed in to change notification settings - Fork 242
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
Allow prefix match on program / object pin paths #4161
Labels
enhancement
New feature or request
optimization
Affects perf but not correctness or applicability
P3
triaged
Discussed in a triage meeting
Milestone
Comments
|
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Jan 28, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Jan 28, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Jan 28, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Jan 28, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Feb 3, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Feb 4, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
lmb
added a commit
to isovalent/ebpf-for-windows
that referenced
this issue
Feb 4, 2025
It's currently not possible to find pinned maps and links. Add a function ebpf_get_next_pinned_object_path which allows doing just that. The paths are returned in lexicographical order, which allows user space to performa a prefix match on the paths. Behind the scenes this is implemented using a linear scan of the hash table, which has quadratic running time. The same is already the case for finding the next object ID, so going with the more desirable semantics makes sense. The existing ebpf_get_next_pinned_program_path() is deprecated because it is less flexible than the new function. Updates microsoft#4161
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
optimization
Affects perf but not correctness or applicability
P3
triaged
Discussed in a triage meeting
Describe the feature you'd like supported
ebpf_get_next_pinned_program_path
currently returns the next path afterstart_path
:ebpf-for-windows/include/ebpf_api.h
Lines 520 to 522 in 95267a5
One interpretation of the documentation is that "next" refers to the lexicographically following / greater string:
In fact, "next" refers to the order of entries in the internal pinning map, which is unspecified / implementation detail. Passing an arbitrary path as "start_path" is therefore not well specified.
This is a problem when trying to clean up all pins that share a prefix, for example to clean up after a unit test (this is what I'm trying to achieve). The only way to achieve this right now is to iterate ALL pins, which can get slow.
Another problem is that defining "next" like this means that iteration is not well defined in the presence of concurrent deletions:
Here pinpath is deleted, and hence the kernel side code can't find the correct entry to resume from.
Proposed solution
Change the function so that "next" has the meaning of "following in lexicographical order". This might require making the pinning table an ordered datatype.
Additional context
No response
The text was updated successfully, but these errors were encountered: