diff options
author | Eelco Chaudron <echaudro@redhat.com> | 2023-05-09 16:29:58 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2023-05-10 21:57:05 +0200 |
commit | cd608cf96eb93ebc4aa44d1393b9cb00bfde46e5 (patch) | |
tree | 510526762b8b0cb3b4fc6eb0e667f9cae83e29c8 /tests | |
parent | 14773af4b28fd3c30832cd1cb05711fd9b345fbf (diff) | |
download | openvswitch-cd608cf96eb93ebc4aa44d1393b9cb00bfde46e5.tar.gz |
netdev-offload: Fix deadlock/recursive use of the netdev_hmap_rwlock rwlock.
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 following 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.
Fixes: 9fe21a4fc12a ("netdev-offload: replace netdev_hmap_mutex to netdev_hmap_rwlock")
Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=2182541
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions