Skip to contentSkip to conversation

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

PATCH In review Rusty Russell 4 participants 5 messages Mar 30, 2010 – Mar 31, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

AFAICT only weird kvm setups and lguest traverse this code path now.

---
 drivers/net/virtio_net.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/net/virtio_net.c +3 -0
@@ -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);
maintainer
#1 lore raw

From: Rusty Russell <[email protected]>
Date: Tue, 30 Mar 2010 15:26:35 +1030

Quoted 3 lines

AFAICT only weird kvm setups and lguest traverse this code path now.

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

#2 lore raw
Quoted 11 lines · David Miller

From: Rusty Russell <[email protected]>
Date: Tue, 30 Mar 2010 15:26:35 +1030

Quoted 3 lines

AFAICT only weird kvm setups and lguest traverse this code path now.

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.

#3 lore raw
Quoted 1 line · Rusty Russell

Shirley, please cc me in future.

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

Shirley

#4 lore raw
In reply to Rusty Russell
Quoted 3 lines · Rusty Russell

AFAICT only weird kvm setups and lguest traverse this code path now.

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

Quoted 8 lines
---
 drivers/net/virtio_net.c |    3 +++
 1 file changed, 3 insertions(+)

drivers/net/virtio_net.c static int add_recvbuf_big(struct virtne · line 356

Quoted 6 lines
drivers/net/virtio_net.c +3 -0
@@ -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?

Quoted 3 lines
drivers/net/virtio_net.c +0 -0
 	/* 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);