-
Notifications
You must be signed in to change notification settings - Fork 286
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
Fixup the load time bpf Maps API #837
Comments
This is not true. It's only required if the BPF-side wants to indicate to the loader that it SHOULD be pinned.
Broken how? The interactions you describe between the root pin path + the LIBBPF_PIN_BY_NAME flag are, as I recall, exactly the same as you get from libbpf so I'm 👎 on changing anything there.
This doesn't make sense to me. How can you always re-create the map if there is always something at the pinned location?
What do you do when you have a conflict on pin path? E.g one or more maps already exist?
I mean sure, but I think this gets weird pretty quickly.
I'm ok with this as a use-case, but I don't think this should be the "default" behaviour. ... Pinning workflows are pretty advanced BPF stuff, and I don't think we should touch the existing user experience too much. For example, look at what you can do with libbpf:
(Some investigation required to know whether it appends name to the Having equivalent APIs in Aya to expose the same features would be great. TL:DR I think that where you need to focus on this here.
With ☝️ done, manipulating stuff before loading can now fail early - i.e we know that global variable "bar" doesn't exist... or that map "foo" isn't there... etc... |
Oh just a note, all of the weird and wonderful pinning use-cases you mentioned can be expressed as one-or-more calls to |
The Problem
Originally (since I've been a contributor) we we're only given a single overloaded API by aya regarding bpf maps at load time, i.e
.map_pin_path()
.On the eBPF side itself users were also provided the
LIBBPF_PIN_BY_NAME
flag.Originally (before some recent patch sets)
.map_pin_path()
+ LIBBPF_PIN_BY_NAME actually resulted in 2 functions:LIBBPF_MAP_PIN_BY_NAME
flag.Current Behavior
Today the API(s) has been cleaned up and works like the following but IMO is still broken:
.map_pin_path(PATH)
IS NOT provided and LIBBPF_PIN_BY_NAME IS NOT set, the map is created and not pinned anywhere..map_pin_path(PATH)
IS provided but LIBBPF_PIN_BY_NAME IS NOT set, the map is created and not pinned anywhere..map_pin_path(PATH)
IS NOT provided and LIBBPF_PIN_BY_NAME IS set, the map is created and pinned by name at/sys/fs/bpf
, pins are re-used if they exist.map_pin_path(PATH)
IS provided and LIBBPF_PIN_BY_NAME IS set, the map is created and pinned by name at PATH, pins are re-used if they existMoving forward (our supported/documented use cases)
I propose adding/fixing the APIs to behave in a more predictable manner while also at a high level allowing users to:
LIBBPF_PIN_BY_NAME
to work if:LIBBPF_PIN_BY_NAME
is set.I would like to align on these use cases BEFORE moving forward with the API design.
The text was updated successfully, but these errors were encountered: