Messages in this thread | | | Subject | Re: [PATCH v3] Add BPF_SYNCHRONIZE_MAP_TO_MAP_REFERENCES bpf(2) command | From | Daniel Borkmann <> | Date | Tue, 31 Jul 2018 10:34:38 +0200 |
| |
On 07/31/2018 02:33 AM, Daniel Colascione wrote: > On Mon, Jul 30, 2018 at 5:26 PM, Jakub Kicinski > <jakub.kicinski@netronome.com> wrote: >> On Mon, 30 Jul 2018 03:25:43 -0700, Daniel Colascione wrote: >>> On Mon, Jul 30, 2018 at 3:04 AM, Daniel Borkmann <daniel@iogearbox.net> wrote: >>>> Hmm, I don't think such UAPI as above is future-proof. In case we would want >>>> a similar mechanism in future for other maps, we would need a whole new bpf >>>> command or reuse BPF_SYNCHRONIZE_MAP_TO_MAP_REFERENCES as a workaround though >>>> the underlying map may not even be a map-to-map. Additionally, we don't have >>>> any map object at hand in the above, so we couldn't make any finer grained >>>> decisions either. Something like below would be more suitable and leaves room >>>> for extending this further in future. >>> >>> YAGNI. Your proposed mechanism doesn't add anything under the current >>> implementation. >> >> FWIW in case of HW offload targeting a particular map may allow users >> to avoid a potentially slow sync with all the devices on the system. > > Sure. But such a thing doesn't exist right now (right?), and we can > add that more-efficient-in-that-one-case BPF interface when it lands. > I'd rather keep things simple for now.
I don't see a reason why that is even more complicated. An API command name such as BPF_SYNCHRONIZE_MAP_TO_MAP_REFERENCES is simply non-generic, and exposes specific map details (here: map-in-map) into the UAPI whereas it should reside within a specific implementation instead similar to other ops we have for maps. If in future other maps would be added that would have similar mechanisms of inner objects they return to the BPF program, we'll be adding yet another command just for this. Also, union bpf_attr is extensible, e.g. additional members could be added in future whenever needed for this subcommand instead of forcing it to NULL as done here. E.g. having a high-level one like bpf(BPF_MAP_WAIT, { .map_fd = fd }) could later on also cover the use-case from Jakub by adding an 'event' member into union bpf_attr where we could add other map specific wakeups for user space while the current default of 0 would be BPF_MAP_WAIT_PENDING_REFS (or the like). All I'm saying is to keep it generic so it can be extended later.
| |