Re: Accessing userspace created persistent eBPF maps from kernel bpf restricted C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 7, 2017 at 11:34 PM, Zvi Effron <zeffron@xxxxxxxxxxxxx> wrote:
...
>
> I'm not sure entirely how, since I have only just started playing with
> this map type, but I suspect a workaround is possible with
> BPF_TYPE_ARRAY_OF_MAPS. My suspicion is that you could store the map
> you want to replace at index 0 in a pinned array of maps. The XDP
> program would load the map out of the array to use it.
>
> To change the map, have a userspace program load the new map, then set
> it as index 0 in the pinned array of maps. The next time the XDP
> program runs, it will pull the new map from index 0.
>

Well, I have to switch between maps based on an "entity switch" in the
producing the event.
The map type and format is fixed and pinned.  Say it could be one per
pid, if pid is the entity
switch.  /sys/bpf/pidno could be the pinned location.  Based on the
pid at the time of event,
I want to consult the map of that pid so I can
filter/aggregate/histogram events sent to user space.
The "entity switch" could be  major:minor:inode, or other such as well
(not easy to get from bpf now, but
you get the idea).  I can't have one or just a few maps because the
key value pairs will be
different for different entity switches.  I might not filter if
/sys/pid/pidno map is not present.

I guess this is not easy right now because of the way maps are
implemented right now,
with the verifier doing the magic fixup at the load time.  But as BPF
usage increases, these
kind of use cases will start popping up :)

Thanks for your suggestion (Zvi and Daniel).  I will explore
BPF_TYPE_ARRAY_OF_MAPS  if it
can fit this case.

Thanks,
Kiran



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux