On Mon, Apr 24, 2023 at 12:37:04PM +0200, Simon Horman wrote: > On Thu, Apr 20, 2023 at 09:39:28AM +0200, Eelco Chaudron wrote: > > When doing performance testing with OVS v3.1 we ran into a deadlock > > situation with the netdev_hmap_rwlock read/write lock. After some > > debugging, it was discovered that the netdev_hmap_rwlock read lock > > was taken recursively. And well in the folowing sequence of events: > > > > netdev_ports_flow_get() > > It takes the read lock, while it walks all the ports > > in the port_to_netdev hmap and calls: > > - netdev_flow_get() which will call: > > - netdev_tc_flow_get() which will call: > > - netdev_ifindex_to_odp_port() > > This function also takes the same read lock to > > walk the ifindex_to_port hmap. > > > > In OVS a read/write lock does not support recursive readers. For details > > see the comments in ovs-thread.h. If you do this, it will lock up, > > mainly due to OVS setting the PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP > > attribute to the lock. > > > > The solution with this patch is to use two separate read/write > > locks, with an order guarantee to avoid another potential deadlock. > > > > Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2182541 > > Fixes: 9fe21a4fc12a ("netdev-offload: replace netdev_hmap_mutex to > > netdev_hmap_rwlock") > > Signed-off-by: Eelco Chaudron <[email protected]> > > Reviewed-by: Simon Horman <[email protected]>
As a follow-up: I have a question about lock annotations. 1. I'm unsure how to exercise them. Some guidance would be appreciated. 2. Should we consider using them more/less? _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
