Re: Atomicity of load and store instructions in eBPF


Yonghong Song
 

On Thu, Feb 7, 2019 at 8:15 AM Mauricio Vasquez
<mauricio.vasquez@...> wrote:

Hello folks,

We have an eBPF program that shares a 64-bits integer with userspace
using an array map. The eBPF program only reads the integer while the
user-space application only writes it.

We know this is possible that under some conditions, for example the
integer is not aligned to cache line size in x86_64, the reader can see
a partially updated value. We wonder if eBPF have some guarantees about
not just cache line, you mean not in its naturally aligned boundary?
One load/store is actually broken into multiple loads/stores by the compiler?

atomicity of the load operation in this case, or if this is totally
dependent on the target architecture.

Is there a way to implement this without using bpf_spin_lock?
So you mean both user space and bpf program are using bpf_spin_lock?


Thanks,

Mauricio.



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