Re: Ebpf map question

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

 



Marco <ctxspi@xxxxxxxxx> writes:

> Hi
>
> Assuming to have this struct:
>
> struct hash_elem {
>     int cnt;
>     };
>
> and kernel space program want read cnt value:
>
> struct hash_elem *val = bpf_map_lookup_elem(&hash_map, &key);
>
>     if (val)
>    {
>
> # time fraction
>
>     bpf_printk("My value %d", val->cnt);
>     }
>
> What happens if the hash_map is a pinned map and in the same time
> space of 'time fraction" a user program deletes the element of the
> key?
> What happen at val pointer?

The val pointer is RCU-protected so it will stick around until the end
of your BPF program's execution. However, it's up to your own code to
protect against concurrent *updates* of the value...

-Toke




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

  Powered by Linux