I want to update an eBPF map in the code region where a spin lock on a different map is held.The user space code continuously polls for this map, so I don't want a map whose values are partially updated to be copied to the user space.
If there were no locks, I could have used the 'bpf_map_update_elem' helper function which has builtin RCU (Read Copy Update) logic. Also using another bpf_spin_lock is not possible as only one spin lock can be held at a time in eBPF.
The verifier source code confirms that cannot hold two spin locks at the same time in a BPF program. Depending on your use case, an alternative could be to use a per-CPU map.