[ovs-dev] About a race condition between handle_upcalls and revalidate

Paul Blakey paulb at mellanox.com
Sun Mar 19 14:28:08 UTC 2017

Hi all,

While using out patches for HW offload we've noticed we get a ovs 
assertion at transition ukey, which tries to
transition the ukey state from EVICTED back to OPERATIONAL.
With furthur investigation it seem that this can happen without our HW 
offload patches as there might be a race between handle_upcalls and 

The procedure is as such:

handle_upcalls receives a new upcall and creates a new ukey, its state 
is VISIBLE, it then it installs a flow (FLOW_PUT) to the datapat and
upon success wants to set the ukey state to OPERATIONAL (line 1408). 
for that the handler running handle_upcalls wants to reaquirce the ukey 
lock, but in the meantime revalidators dump (line 2261) the already 
inserted flow and want to delete this flow (line 2328, say because of 
openflow db changes, or aging). The revalidator deletes the flow and 
moves the ukey from
VISIBLE -> OPERATIONAL (line 2320) -> EVICTING (line 2220) -> EVICTED 
(line 2134)

finally handler succesfuly acquires the flow and now set the state to 
OPERERTIONAL which will cause the assert in transition_ukey.

Line numbers in question are from ofproto/ofproto-dpif-upcall.c

I can provide a test the could show this happening, basicly adding a 
sleep before (writing it now).

Paul Blakey.

More information about the dev mailing list