On Fri, Feb 4, 2022 at 9:43 PM Gaetan Rivet <[email protected]> wrote:

> Port flush and offload uninit should be moved after the datapath
> has been reconfigured. That way, no other thread such as PMDs will
> find this port to poll and enqueue further offload requests.
>
> After a flush, almost no further offload request for this port should
> be found in the queue.
>
> There will still be some issued by revalidators, but they
> will be catched when the offload thread fails to take a netdev ref.
>

catched --> caught

>
> This change fixes the issue of datapath reference being improperly
> accessed by offload threads while it is being destroyed.
>
> Fixes: 5b0aa55776cb ("dpif-netdev: Execute flush from offload thread.")
> Fixes: 62d1c28e9ce0 ("dpif-netdev: Flush offload rules upon port
> deletion.")
> Signed-off-by: Ilya Maximets <[email protected]>
> Signed-off-by: Gaetan Rivet <[email protected]>
> ---
>  lib/dpif-netdev.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index e28e0b554..b5702e6a1 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2313,13 +2313,22 @@ static void
>  do_del_port(struct dp_netdev *dp, struct dp_netdev_port *port)
>      OVS_REQ_WRLOCK(dp->port_rwlock)
>  {
> -    dp_netdev_offload_flush(dp, port);
> -    netdev_uninit_flow_api(port->netdev);
>      hmap_remove(&dp->ports, &port->node);
>      seq_change(dp->port_seq);
>
>      reconfigure_datapath(dp);
>
> +    /* Flush and disable offloads only after 'port' has been made
> +     * inaccessible through datapath reconfiguration.
> +     * This prevents having PMDs enqueuing offload requests after
> +     * the flush.
> +     * When only this port is deleted instead of the whole datapath,
> +     * revalidator threads are still active and can still enqueue
> +     * offload modification or deletion. Managing those stray requests
> +     * is done in the offload threads. */
> +    dp_netdev_offload_flush(dp, port);
> +    netdev_uninit_flow_api(port->netdev);
> +
>      port_destroy(port);
>  }
>
> --
> 2.31.1
>

 Acked-by: Sriharsha Basavapatna <[email protected]>

Thanks,
-Harsha

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

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to