Patchwork virtio_net: avoid BUG_ON() with large packets when CONFIG_DEBUG_SG=y

login
register
mail settings
Submitter Rusty Russell
Date March 30, 2010, 4:56 a.m.
Message ID <201003301526.35720.rusty@rustcorp.com.au>
Download mbox | patch
Permalink /patch/48929/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Rusty Russell - March 30, 2010, 4:56 a.m.
AFAICT only weird kvm setups and lguest traverse this code path now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/net/virtio_net.c |    3 +++
 1 file changed, 3 insertions(+)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 30, 2010, 5:08 a.m.
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Tue, 30 Mar 2010 15:26:35 +1030

> AFAICT only weird kvm setups and lguest traverse this code path now.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Shirley Ma already posted a fix for this, and you missed the
add_recvbuf_small() case in your version.

I'll be applying Shirley's patch to net-next-2.6
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rusty Russell - March 31, 2010, 12:35 a.m.
On Tue, 30 Mar 2010 03:38:59 pm David Miller wrote:
> From: Rusty Russell <rusty@rustcorp.com.au>
> Date: Tue, 30 Mar 2010 15:26:35 +1030
> 
> > AFAICT only weird kvm setups and lguest traverse this code path now.
> > 
> > Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> 
> Shirley Ma already posted a fix for this, and you missed the
> add_recvbuf_small() case in your version.
> 
> I'll be applying Shirley's patch to net-next-2.6

Excellent, thanks.  Shirley, please cc me in future.

Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shirley Ma - March 31, 2010, 5:39 a.m.
On Wed, 2010-03-31 at 11:05 +1030, Rusty Russell wrote:
> Shirley, please cc me in future.

I will. I thought you might be on vacation. :)

Shirley

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael S. Tsirkin - March 31, 2010, 9:17 a.m.
On Tue, Mar 30, 2010 at 03:26:35PM +1030, Rusty Russell wrote:
> AFAICT only weird kvm setups and lguest traverse this code path now.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

vhost still lacks support mergeable buffers so it uses this path.

> ---
>  drivers/net/virtio_net.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -351,6 +351,9 @@ static int add_recvbuf_big(struct virtne
>  	char *p;
>  	int i, err, offset;
>  
> +	/* This is a waste of cycles, but satisfies CONFIG_DEBUG_SG. */
> +	sg_init_table(sg, ARRAY_SIZE(sg));
> +

How about moving sg into virtnet_info? This way we could call
this only once, right?

>  	/* page in sg[MAX_SKB_FRAGS + 1] is list tail */
>  	for (i = MAX_SKB_FRAGS + 1; i > 1; --i) {
>  		first = get_a_page(vi, gfp);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -351,6 +351,9 @@  static int add_recvbuf_big(struct virtne
 	char *p;
 	int i, err, offset;
 
+	/* This is a waste of cycles, but satisfies CONFIG_DEBUG_SG. */
+	sg_init_table(sg, ARRAY_SIZE(sg));
+
 	/* page in sg[MAX_SKB_FRAGS + 1] is list tail */
 	for (i = MAX_SKB_FRAGS + 1; i > 1; --i) {
 		first = get_a_page(vi, gfp);