On 4/12/21 5:20 PM, Gaetan Rivet wrote:
> The port mutex protects the netdev mapping, that can be changed by port
> addition or port deletion. HW offloads operations can be considered read
> operations on the port mapping itself. Use a rwlock to differentiate
> between read and write operations, allowing concurrent queries and
> offload insertions.
> 
> Because offload queries, deletion, and reconfigure_datapath() calls are
> all rdlock, the deadlock fixed by [1] is still avoided, as the rdlock
> side is recursive as prescribed by the POSIX standard. Executing
> 'reconfigure_datapath()' only requires a rdlock taken, but it is sometimes
> executed in contexts where wrlock is taken ('do_add_port()' and
> 'do_del_port()').
> 
> This means that the deadlock described in [2] is still valid and should
> be mitigated. The rdlock is taken using 'tryrdlock()' during offload query,
> keeping the current behavior.
> 
> [1]: 81e89d5c2645 ("dpif-netdev: Make datapath port mutex recursive.")
> 
> [2]: 12d0edd75eba ("dpif-netdev: Avoid deadlock with offloading during PMD
>      thread deletion.").
> 
> Signed-off-by: Gaetan Rivet <[email protected]>
> Reviewed-by: Eli Britstein <[email protected]>
> ---
>  lib/dpif-netdev.c         | 139 +++++++++++++++++++-------------------
>  lib/netdev-offload-dpdk.c |   4 +-
>  2 files changed, 72 insertions(+), 71 deletions(-)
> 

Reviewed-by: Maxime Coquelin <[email protected]>

Thanks,
Maxime

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to