diff mbox

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

Message ID 201003301526.35720.rusty@rustcorp.com.au
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Rusty Russell March 30, 2010, 4:56 a.m. UTC
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

Comments

David Miller March 30, 2010, 5:08 a.m. UTC | #1
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. UTC | #2
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. UTC | #3
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. UTC | #4
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
diff mbox

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);