On Wed, Dec 4, 2019 at 10:06 PM William Tu <u9012...@gmail.com> wrote:
>
> The patch works around an error when reconfigure the netdev-afxdp
> device into different modes. Currently, when OVS destroy xsk, the
> xsk_destruct() in linux kernel calls xdp_put_umem() and defers
> calling xdp_umem_release_deferred().
>
> This creates an -EBUSY error when xsk_socket__create() calls
>   xsk_bind()
>     xdp_umem_assign_dev()
>       xdp_get_umem_from_qid()
>
> And this is because xdp_clear_umem_at_qid() is deferred so not
> clearing umem yet. The issue can be reproduced by just changing
> xdp-mode multiple times, ex:
>   ovs-vsctl -- set interface afxdp-p0 \
>     options:n_rxq=1 type="afxdp" options:xdp-mode=best-effort
>   ovs-vsctl -- set interface afxdp-p0 \
>     options:n_rxq=1 type="afxdp" options:xdp-mode=generic
>
> The patch fixes it by adding a delay, hopefully the umem has
> been properly cleanup.
>
> Signed-off-by: William Tu <u9012...@gmail.com>
> ---
>  lib/netdev-afxdp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c
> index ca2dfd005b9f..84897f1fd025 100644
> --- a/lib/netdev-afxdp.c
> +++ b/lib/netdev-afxdp.c
> @@ -661,6 +661,9 @@ netdev_afxdp_reconfigure(struct netdev *netdev)
>      struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
>      int err = 0;
>
> +    /* Time for umem to be released in kernel. */
> +    xnanosleep(500000);
> +
>      ovs_mutex_lock(&dev->mutex);
>
>      if (netdev->n_rxq == dev->requested_n_rxq
> --
> 2.7.4
>
Now I think it's a bad solution. Let me work on other way
to fix it.

Regards,
William
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to