Re: Instructions to enable spin locks?

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

 



>
> Greetings:
>
> I believe the way that this project is using EBPF hash maps in an EBPF program that processes received packets on the XDP receive hook, we need to acquire spin locks while updating map entries, or else we are subject to multiple packets being processed in parallel on multiple CPU cores, and causing incorrect updates to the map values.
>
> https://github.com/intel/host-int
>
> In particular, we should use spin locks at least for this map in the program intmd_xdp_ksink.c: https://github.com/intel/host-int/blob/main/src/xdp/intmd_xdp_ksink.c#L27-L31
If I may, I would suggest using percpu hash maps and aggregating the
stats from the same flow_key in your userspace daemon.
That way you can avoid spinlocks completely as it models one key to n
values, where n is the number of CPUs.
You can even leverage batching if your map has a considerable amount
of keys[1], which in my experience can handle large maps without
noticeable overhead.

Pedro

[1] https://elixir.bootlin.com/linux/latest/source/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c




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

  Powered by Linux