Re: BPF Concurrency


Yonghong Song
 

On Fri, May 22, 2020 at 1:07 PM Kanthi P <Pavuluri.kanthi@...> wrote:

Hi,


I’ve been reading that hash map’s update element is atomic and also that we can use BPF_XADD to make the entire map update atomically.
BPF_XADD is to make one map element inside the kenel to update atomically.

Could you filx an issue with more details? This way, we will have a
better record.



But I think that doesn’t guarantee that these updates are thread safe, meaning one cpu core can overwrite other core’s update.
Not sure what do you mean here. yes, one cpu updated a map element and
the other can modify it.
What kind of primitive do you want? compare-and-exchange?



Is there a clean way of keeping them thread safe. Unfortunately I can’t use per-cpu maps as I need global counters.


And spin locks sounds a costly operation. Can you please throw some light?


Regards,

Kanthi

Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.