Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Nov 2016 14:04:56 +0100
From:      "roger.pau@citrix.com" <roger.pau@citrix.com>
To:        Liuyingdong <liuyingdong@huawei.com>
Cc:        "freebsd-xen@freebsd.org" <freebsd-xen@freebsd.org>, "Zhaojun (Euler)" <zhao.zhaojun@huawei.com>, Suoben <suoben@huawei.com>
Subject:   Re: [PATCH]netfront: need release all resources after adding and removing NICs time and again
Message-ID:  <20161108130456.ejiuhjjxjt5c6yeq@mac>
In-Reply-To: <3655E9A8B903724782E1F75DCFD74E6BF966FF5A@szxema506-mbs.china.huawei.com>
References:  <3655E9A8B903724782E1F75DCFD74E6BF966FF5A@szxema506-mbs.china.huawei.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 04, 2016 at 07:43:41AM +0000, Liuyingdong wrote:
> On xen,freebsd 10.2 virtual machines hang after adding and removing NICs time and again(more than 30 times).
> I found error log is as follows:
> "netfront can't alloc tx grant refs"

Hello,

Thanks for the patch, although I'm not able to import it, git complain with:

patch: **** malformed patch at line 7: }

Could you please resend it using git send-email?

I also have a couple of comments below regarding style.

> 
> Signed-off-by: Liudong Liu<Liuyingdong@huawei.com>
> 
> diff --git a/dev/xen/netfront/netfront.c b/dev/xen/netfront/netfront.c
> index 5497139..e96bbba 100644
> --- a/dev/xen/netfront/netfront.c
> +++ b/dev/xen/netfront/netfront.c
> @@ -790,6 +790,44 @@ netif_release_tx_bufs(struct netfront_info *np)
>        }
> }

Missing new line.

> +static void
netif_release_rx_bufs_copy(struct netfront_info *np)

This needs to be on a new line.

> +{
> +       struct mbuf *m;
> +       int i, ref;
> +       int busy = 0, inuse = 0;
> +
> +       XN_RX_LOCK(np);
> +
> +       for (i = 0; i < NET_RX_RING_SIZE; i++) {
> +                ref = np->grant_rx_ref[i];
> +
> +                if (ref == GRANT_REF_INVALID)
> +                          continue;
> +
> +                inuse++;
> +
> +                m = np->rx_mbufs[i];
> +
> +                if (!gnttab_end_foreign_access_ref(ref))
> +                {
> +                          busy++;
> +                          continue;
> +                }
> +
> +                gnttab_release_grant_reference(&np->gref_rx_head, ref);
> +                np->grant_rx_ref[i] = GRANT_REF_INVALID;
> +                add_id_to_freelist(np->rx_mbufs, i);
> +
> +                m_freem(m);
> +       }
> +
> +       if (busy)
> +                DPRINTK("%s: Unable to release %d of %d inuse grant references out of %ld total.\n",
> +                          __FUNCTION__, busy, inuse, NET_RX_RING_SIZE);

Please use device_printf for this instead of the function name. Also, could 
you align the string so it doesn't extend past 80 characters?

Roger.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20161108130456.ejiuhjjxjt5c6yeq>