linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] virtio-net: Fix two bugs on unloading the module
@ 2013-12-05 14:36 Andrey Vagin
  2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Andrey Vagin @ 2013-12-05 14:36 UTC (permalink / raw)
  To: virtualization
  Cc: linux-kernel, netdev, Andrey Vagin, Rusty Russell, Michael S. Tsirkin

They can be easy to reproduce, if you try to unload virtio-net

Andrey Vagin (2):
  virtio-net: determine type of bufs correctly
  virtio: delete napi objects from netdev before releasing memory

 drivers/net/virtio_net.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/2] virtio-net: determine type of bufs correctly
  2013-12-05 14:36 [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Andrey Vagin
@ 2013-12-05 14:36 ` Andrey Vagin
  2013-12-05 14:52   ` Michael S. Tsirkin
                     ` (2 more replies)
  2013-12-05 14:36 ` [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory Andrey Vagin
  2013-12-05 14:54 ` [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Michael S. Tsirkin
  2 siblings, 3 replies; 13+ messages in thread
From: Andrey Vagin @ 2013-12-05 14:36 UTC (permalink / raw)
  To: virtualization
  Cc: linux-kernel, netdev, Andrey Vagin, Michael Dalton,
	Rusty Russell, Michael S. Tsirkin

free_unused_bufs must check vi->mergeable_rx_bufs before
vi->big_packets, because we use this sequence in other places.
Otherwise we allocate buffer of one type, then free it as another
type.

general protection fault: 0000 [#1] SMP
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables pcspkr virtio_balloon virtio_net(-) i2c_pii
CPU: 0 PID: 400 Comm: rmmod Not tainted 3.13.0-rc2+ #170
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
task: ffff8800b6d2a210 ti: ffff8800aed32000 task.ti: ffff8800aed32000
RIP: 0010:[<ffffffffa00345f3>]  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
RSP: 0018:ffff8800aed33dd8  EFLAGS: 00010202
RAX: ffff8800b1fe2c00 RBX: ffff8800b66a7240 RCX: 6b6b6b6b6b6b6b6b
RDX: 6b6b6b6b6b6b6b6b RSI: ffff8800b8419a68 RDI: ffff8800b66a1148
RBP: ffff8800aed33e00 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
R13: ffff8800b66a1148 R14: 0000000000000000 R15: 000077ff80000000
FS:  00007fc4f9c4e740(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f63f432f000 CR3: 00000000b6538000 CR4: 00000000000006f0
Stack:
 ffff8800b66a7240 ffff8800b66a7380 ffff8800377bd3f0 0000000000000000
 00000000023302f0 ffff8800aed33e18 ffffffffa00346e2 ffff8800b66a7240
 ffff8800aed33e38 ffffffffa003474d ffff8800377bd388 ffff8800377bd390
Call Trace:
 [<ffffffffa00346e2>] remove_vq_common+0x22/0x40 [virtio_net]
 [<ffffffffa003474d>] virtnet_remove+0x4d/0x90 [virtio_net]
 [<ffffffff813ae303>] virtio_dev_remove+0x23/0x80
 [<ffffffff813f62cf>] __device_release_driver+0x7f/0xf0
 [<ffffffff813f6c80>] driver_detach+0xc0/0xd0
 [<ffffffff813f5f08>] bus_remove_driver+0x58/0xd0
 [<ffffffff813f72cc>] driver_unregister+0x2c/0x50
 [<ffffffff813ae63e>] unregister_virtio_driver+0xe/0x10
 [<ffffffffa0036852>] virtio_net_driver_exit+0x10/0x7be [virtio_net]
 [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
 [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
 [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
Code: c0 74 55 0f 1f 44 00 00 80 7b 30 00 74 7a 48 8b 50 30 4c 89 e6 48 03 73 20 48 85 d2 0f 84 bb 00 00 00 66 0f
RIP  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
 RSP <ffff8800aed33dd8>
---[ end trace edb570ea923cce9c ]---

Fixes: 2613af0ed18a (virtio_net: migrate mergeable rx buffers to page frag allocators)
Cc: Michael Dalton <mwdalton@google.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
 drivers/net/virtio_net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 916241d..930039a 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1396,10 +1396,10 @@ static void free_unused_bufs(struct virtnet_info *vi)
 		struct virtqueue *vq = vi->rq[i].vq;
 
 		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) {
-			if (vi->big_packets)
-				give_pages(&vi->rq[i], buf);
-			else if (vi->mergeable_rx_bufs)
+			if (vi->mergeable_rx_bufs)
 				put_page(virt_to_head_page(buf));
+			else if (vi->big_packets)
+				give_pages(&vi->rq[i], buf);
 			else
 				dev_kfree_skb(buf);
 			--vi->rq[i].num;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory
  2013-12-05 14:36 [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Andrey Vagin
  2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
@ 2013-12-05 14:36 ` Andrey Vagin
  2013-12-05 14:53   ` Michael S. Tsirkin
                     ` (2 more replies)
  2013-12-05 14:54 ` [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Michael S. Tsirkin
  2 siblings, 3 replies; 13+ messages in thread
From: Andrey Vagin @ 2013-12-05 14:36 UTC (permalink / raw)
  To: virtualization
  Cc: linux-kernel, netdev, Andrey Vagin, Rusty Russell, Michael S. Tsirkin

free_netdev calls netif_napi_del too, but it's too late, because napi
structures are placed on vi->rq. netif_napi_add() is called from
virtnet_alloc_queues.

general protection fault: 0000 [#1] SMP
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables virtio_balloon pcspkr virtio_net(-) i2c_pii
CPU: 1 PID: 347 Comm: rmmod Not tainted 3.13.0-rc2+ #171
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
task: ffff8800b779c420 ti: ffff8800379e0000 task.ti: ffff8800379e0000
RIP: 0010:[<ffffffff81322e19>]  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
RSP: 0018:ffff8800379e1dd0  EFLAGS: 00010a83
RAX: 6b6b6b6b6b6b6b6b RBX: ffff8800379c2fd0 RCX: dead000000200200
RDX: 6b6b6b6b6b6b6b6b RSI: 0000000000000001 RDI: ffff8800379c2fd0
RBP: ffff8800379e1dd0 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000001 R12: ffff8800379c2f90
R13: ffff880037839160 R14: 0000000000000000 R15: 00000000013352f0
FS:  00007f1400e34740(0000) GS:ffff8800bfb00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f464124c763 CR3: 00000000b68cf000 CR4: 00000000000006e0
Stack:
 ffff8800379e1df0 ffffffff8155beab 6b6b6b6b6b6b6b2b ffff8800378391c0
 ffff8800379e1e18 ffffffff8156499b ffff880037839be0 ffff880037839d20
 ffff88003779d3f0 ffff8800379e1e38 ffffffffa003477c ffff88003779d388
Call Trace:
 [<ffffffff8155beab>] netif_napi_del+0x1b/0x80
 [<ffffffff8156499b>] free_netdev+0x8b/0x110
 [<ffffffffa003477c>] virtnet_remove+0x7c/0x90 [virtio_net]
 [<ffffffff813ae323>] virtio_dev_remove+0x23/0x80
 [<ffffffff813f62ef>] __device_release_driver+0x7f/0xf0
 [<ffffffff813f6ca0>] driver_detach+0xc0/0xd0
 [<ffffffff813f5f28>] bus_remove_driver+0x58/0xd0
 [<ffffffff813f72ec>] driver_unregister+0x2c/0x50
 [<ffffffff813ae65e>] unregister_virtio_driver+0xe/0x10
 [<ffffffffa0036942>] virtio_net_driver_exit+0x10/0x6ce [virtio_net]
 [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
 [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
 [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
Code: 00 00 55 48 8b 17 48 b9 00 01 10 00 00 00 ad de 48 8b 47 08 48 89 e5 48 39 ca 74 29 48 b9 00 02 20 00 00 00
RIP  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
 RSP <ffff8800379e1dd0>
---[ end trace d5931cd3f87c9763 ]---

Fixes: 986a4f4d452d (virtio_net: multiqueue support)
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
 drivers/net/virtio_net.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 930039a..c293764 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1367,6 +1367,11 @@ static void virtnet_config_changed(struct virtio_device *vdev)
 
 static void virtnet_free_queues(struct virtnet_info *vi)
 {
+	int i;
+
+	for (i = 0; i < vi->max_queue_pairs; i++)
+		netif_napi_del(&vi->rq[i].napi);
+
 	kfree(vi->rq);
 	kfree(vi->sq);
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] virtio-net: determine type of bufs correctly
  2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
@ 2013-12-05 14:52   ` Michael S. Tsirkin
  2013-12-05 20:09     ` Michael Dalton
  2013-12-06  3:20   ` Jason Wang
  2013-12-06 20:30   ` David Miller
  2 siblings, 1 reply; 13+ messages in thread
From: Michael S. Tsirkin @ 2013-12-05 14:52 UTC (permalink / raw)
  To: Andrey Vagin
  Cc: virtualization, linux-kernel, netdev, Michael Dalton, Rusty Russell

On Thu, Dec 05, 2013 at 06:36:20PM +0400, Andrey Vagin wrote:
> free_unused_bufs must check vi->mergeable_rx_bufs before
> vi->big_packets, because we use this sequence in other places.
> Otherwise we allocate buffer of one type, then free it as another
> type.
> 
> general protection fault: 0000 [#1] SMP
> Dumping ftrace buffer:
>    (ftrace buffer empty)
> Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables pcspkr virtio_balloon virtio_net(-) i2c_pii
> CPU: 0 PID: 400 Comm: rmmod Not tainted 3.13.0-rc2+ #170
> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> task: ffff8800b6d2a210 ti: ffff8800aed32000 task.ti: ffff8800aed32000
> RIP: 0010:[<ffffffffa00345f3>]  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
> RSP: 0018:ffff8800aed33dd8  EFLAGS: 00010202
> RAX: ffff8800b1fe2c00 RBX: ffff8800b66a7240 RCX: 6b6b6b6b6b6b6b6b
> RDX: 6b6b6b6b6b6b6b6b RSI: ffff8800b8419a68 RDI: ffff8800b66a1148
> RBP: ffff8800aed33e00 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
> R13: ffff8800b66a1148 R14: 0000000000000000 R15: 000077ff80000000
> FS:  00007fc4f9c4e740(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 00007f63f432f000 CR3: 00000000b6538000 CR4: 00000000000006f0
> Stack:
>  ffff8800b66a7240 ffff8800b66a7380 ffff8800377bd3f0 0000000000000000
>  00000000023302f0 ffff8800aed33e18 ffffffffa00346e2 ffff8800b66a7240
>  ffff8800aed33e38 ffffffffa003474d ffff8800377bd388 ffff8800377bd390
> Call Trace:
>  [<ffffffffa00346e2>] remove_vq_common+0x22/0x40 [virtio_net]
>  [<ffffffffa003474d>] virtnet_remove+0x4d/0x90 [virtio_net]
>  [<ffffffff813ae303>] virtio_dev_remove+0x23/0x80
>  [<ffffffff813f62cf>] __device_release_driver+0x7f/0xf0
>  [<ffffffff813f6c80>] driver_detach+0xc0/0xd0
>  [<ffffffff813f5f08>] bus_remove_driver+0x58/0xd0
>  [<ffffffff813f72cc>] driver_unregister+0x2c/0x50
>  [<ffffffff813ae63e>] unregister_virtio_driver+0xe/0x10
>  [<ffffffffa0036852>] virtio_net_driver_exit+0x10/0x7be [virtio_net]
>  [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
>  [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
>  [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
>  [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
> Code: c0 74 55 0f 1f 44 00 00 80 7b 30 00 74 7a 48 8b 50 30 4c 89 e6 48 03 73 20 48 85 d2 0f 84 bb 00 00 00 66 0f
> RIP  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
>  RSP <ffff8800aed33dd8>
> ---[ end trace edb570ea923cce9c ]---
> 
> Fixes: 2613af0ed18a (virtio_net: migrate mergeable rx buffers to page frag allocators)
> Cc: Michael Dalton <mwdalton@google.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>

Yes, big_packets can be set with mergeable_rx_bufs,
so mergeable_rx_bufs must be tested first.

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/virtio_net.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 916241d..930039a 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1396,10 +1396,10 @@ static void free_unused_bufs(struct virtnet_info *vi)
>  		struct virtqueue *vq = vi->rq[i].vq;
>  
>  		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) {
> -			if (vi->big_packets)
> -				give_pages(&vi->rq[i], buf);
> -			else if (vi->mergeable_rx_bufs)
> +			if (vi->mergeable_rx_bufs)
>  				put_page(virt_to_head_page(buf));
> +			else if (vi->big_packets)
> +				give_pages(&vi->rq[i], buf);
>  			else
>  				dev_kfree_skb(buf);
>  			--vi->rq[i].num;
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory
  2013-12-05 14:36 ` [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory Andrey Vagin
@ 2013-12-05 14:53   ` Michael S. Tsirkin
  2013-12-06  3:21   ` Jason Wang
  2013-12-06 20:30   ` David Miller
  2 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2013-12-05 14:53 UTC (permalink / raw)
  To: Andrey Vagin
  Cc: virtualization, linux-kernel, netdev, Rusty Russell, Jason Wang

On Thu, Dec 05, 2013 at 06:36:21PM +0400, Andrey Vagin wrote:
> free_netdev calls netif_napi_del too, but it's too late, because napi
> structures are placed on vi->rq. netif_napi_add() is called from
> virtnet_alloc_queues.
> 
> general protection fault: 0000 [#1] SMP
> Dumping ftrace buffer:
>    (ftrace buffer empty)
> Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables virtio_balloon pcspkr virtio_net(-) i2c_pii
> CPU: 1 PID: 347 Comm: rmmod Not tainted 3.13.0-rc2+ #171
> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> task: ffff8800b779c420 ti: ffff8800379e0000 task.ti: ffff8800379e0000
> RIP: 0010:[<ffffffff81322e19>]  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
> RSP: 0018:ffff8800379e1dd0  EFLAGS: 00010a83
> RAX: 6b6b6b6b6b6b6b6b RBX: ffff8800379c2fd0 RCX: dead000000200200
> RDX: 6b6b6b6b6b6b6b6b RSI: 0000000000000001 RDI: ffff8800379c2fd0
> RBP: ffff8800379e1dd0 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000001 R12: ffff8800379c2f90
> R13: ffff880037839160 R14: 0000000000000000 R15: 00000000013352f0
> FS:  00007f1400e34740(0000) GS:ffff8800bfb00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 00007f464124c763 CR3: 00000000b68cf000 CR4: 00000000000006e0
> Stack:
>  ffff8800379e1df0 ffffffff8155beab 6b6b6b6b6b6b6b2b ffff8800378391c0
>  ffff8800379e1e18 ffffffff8156499b ffff880037839be0 ffff880037839d20
>  ffff88003779d3f0 ffff8800379e1e38 ffffffffa003477c ffff88003779d388
> Call Trace:
>  [<ffffffff8155beab>] netif_napi_del+0x1b/0x80
>  [<ffffffff8156499b>] free_netdev+0x8b/0x110
>  [<ffffffffa003477c>] virtnet_remove+0x7c/0x90 [virtio_net]
>  [<ffffffff813ae323>] virtio_dev_remove+0x23/0x80
>  [<ffffffff813f62ef>] __device_release_driver+0x7f/0xf0
>  [<ffffffff813f6ca0>] driver_detach+0xc0/0xd0
>  [<ffffffff813f5f28>] bus_remove_driver+0x58/0xd0
>  [<ffffffff813f72ec>] driver_unregister+0x2c/0x50
>  [<ffffffff813ae65e>] unregister_virtio_driver+0xe/0x10
>  [<ffffffffa0036942>] virtio_net_driver_exit+0x10/0x6ce [virtio_net]
>  [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
>  [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
>  [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
>  [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
> Code: 00 00 55 48 8b 17 48 b9 00 01 10 00 00 00 ad de 48 8b 47 08 48 89 e5 48 39 ca 74 29 48 b9 00 02 20 00 00 00
> RIP  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
>  RSP <ffff8800379e1dd0>
> ---[ end trace d5931cd3f87c9763 ]---
> 
> Fixes: 986a4f4d452d (virtio_net: multiqueue support)
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

This is needed for stable.

> ---
>  drivers/net/virtio_net.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 930039a..c293764 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1367,6 +1367,11 @@ static void virtnet_config_changed(struct virtio_device *vdev)
>  
>  static void virtnet_free_queues(struct virtnet_info *vi)
>  {
> +	int i;
> +
> +	for (i = 0; i < vi->max_queue_pairs; i++)
> +		netif_napi_del(&vi->rq[i].napi);
> +
>  	kfree(vi->rq);
>  	kfree(vi->sq);
>  }
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/2] virtio-net: Fix two bugs on unloading the module
  2013-12-05 14:36 [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Andrey Vagin
  2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
  2013-12-05 14:36 ` [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory Andrey Vagin
@ 2013-12-05 14:54 ` Michael S. Tsirkin
  2 siblings, 0 replies; 13+ messages in thread
From: Michael S. Tsirkin @ 2013-12-05 14:54 UTC (permalink / raw)
  To: Andrey Vagin; +Cc: virtualization, linux-kernel, netdev, Rusty Russell

On Thu, Dec 05, 2013 at 06:36:19PM +0400, Andrey Vagin wrote:
> They can be easy to reproduce, if you try to unload virtio-net
> 
> Andrey Vagin (2):
>   virtio-net: determine type of bufs correctly
>   virtio: delete napi objects from netdev before releasing memory

Thanks a lot for the patches!

>  drivers/net/virtio_net.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> -- 
> 1.8.3.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] virtio-net: determine type of bufs correctly
  2013-12-05 14:52   ` Michael S. Tsirkin
@ 2013-12-05 20:09     ` Michael Dalton
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Dalton @ 2013-12-05 20:09 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Andrey Vagin, lf-virt, linux-kernel, netdev, Rusty Russell

Thanks Andrey, great catch. I believe this issue occurs in one more
place, when packets are dropped if they are too short. I will send
out a patch momentarily to fix that additional case.

Best,

Mike

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] virtio-net: determine type of bufs correctly
  2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
  2013-12-05 14:52   ` Michael S. Tsirkin
@ 2013-12-06  3:20   ` Jason Wang
  2013-12-07  0:35     ` Rusty Russell
  2013-12-06 20:30   ` David Miller
  2 siblings, 1 reply; 13+ messages in thread
From: Jason Wang @ 2013-12-06  3:20 UTC (permalink / raw)
  To: Andrey Vagin, virtualization
  Cc: linux-kernel, netdev, Michael Dalton, Rusty Russell, Michael S. Tsirkin

On 12/05/2013 10:36 PM, Andrey Vagin wrote:
> free_unused_bufs must check vi->mergeable_rx_bufs before
> vi->big_packets, because we use this sequence in other places.
> Otherwise we allocate buffer of one type, then free it as another
> type.
>
> general protection fault: 0000 [#1] SMP
> Dumping ftrace buffer:
>    (ftrace buffer empty)
> Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables pcspkr virtio_balloon virtio_net(-) i2c_pii
> CPU: 0 PID: 400 Comm: rmmod Not tainted 3.13.0-rc2+ #170
> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> task: ffff8800b6d2a210 ti: ffff8800aed32000 task.ti: ffff8800aed32000
> RIP: 0010:[<ffffffffa00345f3>]  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
> RSP: 0018:ffff8800aed33dd8  EFLAGS: 00010202
> RAX: ffff8800b1fe2c00 RBX: ffff8800b66a7240 RCX: 6b6b6b6b6b6b6b6b
> RDX: 6b6b6b6b6b6b6b6b RSI: ffff8800b8419a68 RDI: ffff8800b66a1148
> RBP: ffff8800aed33e00 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
> R13: ffff8800b66a1148 R14: 0000000000000000 R15: 000077ff80000000
> FS:  00007fc4f9c4e740(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 00007f63f432f000 CR3: 00000000b6538000 CR4: 00000000000006f0
> Stack:
>  ffff8800b66a7240 ffff8800b66a7380 ffff8800377bd3f0 0000000000000000
>  00000000023302f0 ffff8800aed33e18 ffffffffa00346e2 ffff8800b66a7240
>  ffff8800aed33e38 ffffffffa003474d ffff8800377bd388 ffff8800377bd390
> Call Trace:
>  [<ffffffffa00346e2>] remove_vq_common+0x22/0x40 [virtio_net]
>  [<ffffffffa003474d>] virtnet_remove+0x4d/0x90 [virtio_net]
>  [<ffffffff813ae303>] virtio_dev_remove+0x23/0x80
>  [<ffffffff813f62cf>] __device_release_driver+0x7f/0xf0
>  [<ffffffff813f6c80>] driver_detach+0xc0/0xd0
>  [<ffffffff813f5f08>] bus_remove_driver+0x58/0xd0
>  [<ffffffff813f72cc>] driver_unregister+0x2c/0x50
>  [<ffffffff813ae63e>] unregister_virtio_driver+0xe/0x10
>  [<ffffffffa0036852>] virtio_net_driver_exit+0x10/0x7be [virtio_net]
>  [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
>  [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
>  [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
>  [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
> Code: c0 74 55 0f 1f 44 00 00 80 7b 30 00 74 7a 48 8b 50 30 4c 89 e6 48 03 73 20 48 85 d2 0f 84 bb 00 00 00 66 0f
> RIP  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
>  RSP <ffff8800aed33dd8>
> ---[ end trace edb570ea923cce9c ]---
>
> Fixes: 2613af0ed18a (virtio_net: migrate mergeable rx buffers to page frag allocators)
> Cc: Michael Dalton <mwdalton@google.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>
> ---
>  drivers/net/virtio_net.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 916241d..930039a 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1396,10 +1396,10 @@ static void free_unused_bufs(struct virtnet_info *vi)
>  		struct virtqueue *vq = vi->rq[i].vq;
>  
>  		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) {
> -			if (vi->big_packets)
> -				give_pages(&vi->rq[i], buf);
> -			else if (vi->mergeable_rx_bufs)
> +			if (vi->mergeable_rx_bufs)
>  				put_page(virt_to_head_page(buf));
> +			else if (vi->big_packets)
> +				give_pages(&vi->rq[i], buf);
>  			else
>  				dev_kfree_skb(buf);
>  			--vi->rq[i].num;

Acked-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory
  2013-12-05 14:36 ` [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory Andrey Vagin
  2013-12-05 14:53   ` Michael S. Tsirkin
@ 2013-12-06  3:21   ` Jason Wang
  2013-12-07  0:32     ` Rusty Russell
  2013-12-06 20:30   ` David Miller
  2 siblings, 1 reply; 13+ messages in thread
From: Jason Wang @ 2013-12-06  3:21 UTC (permalink / raw)
  To: Andrey Vagin, virtualization; +Cc: netdev, Michael S. Tsirkin, linux-kernel

On 12/05/2013 10:36 PM, Andrey Vagin wrote:
> free_netdev calls netif_napi_del too, but it's too late, because napi
> structures are placed on vi->rq. netif_napi_add() is called from
> virtnet_alloc_queues.
>
> general protection fault: 0000 [#1] SMP
> Dumping ftrace buffer:
>    (ftrace buffer empty)
> Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables virtio_balloon pcspkr virtio_net(-) i2c_pii
> CPU: 1 PID: 347 Comm: rmmod Not tainted 3.13.0-rc2+ #171
> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> task: ffff8800b779c420 ti: ffff8800379e0000 task.ti: ffff8800379e0000
> RIP: 0010:[<ffffffff81322e19>]  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
> RSP: 0018:ffff8800379e1dd0  EFLAGS: 00010a83
> RAX: 6b6b6b6b6b6b6b6b RBX: ffff8800379c2fd0 RCX: dead000000200200
> RDX: 6b6b6b6b6b6b6b6b RSI: 0000000000000001 RDI: ffff8800379c2fd0
> RBP: ffff8800379e1dd0 R08: 0000000000000001 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000001 R12: ffff8800379c2f90
> R13: ffff880037839160 R14: 0000000000000000 R15: 00000000013352f0
> FS:  00007f1400e34740(0000) GS:ffff8800bfb00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 00007f464124c763 CR3: 00000000b68cf000 CR4: 00000000000006e0
> Stack:
>  ffff8800379e1df0 ffffffff8155beab 6b6b6b6b6b6b6b2b ffff8800378391c0
>  ffff8800379e1e18 ffffffff8156499b ffff880037839be0 ffff880037839d20
>  ffff88003779d3f0 ffff8800379e1e38 ffffffffa003477c ffff88003779d388
> Call Trace:
>  [<ffffffff8155beab>] netif_napi_del+0x1b/0x80
>  [<ffffffff8156499b>] free_netdev+0x8b/0x110
>  [<ffffffffa003477c>] virtnet_remove+0x7c/0x90 [virtio_net]
>  [<ffffffff813ae323>] virtio_dev_remove+0x23/0x80
>  [<ffffffff813f62ef>] __device_release_driver+0x7f/0xf0
>  [<ffffffff813f6ca0>] driver_detach+0xc0/0xd0
>  [<ffffffff813f5f28>] bus_remove_driver+0x58/0xd0
>  [<ffffffff813f72ec>] driver_unregister+0x2c/0x50
>  [<ffffffff813ae65e>] unregister_virtio_driver+0xe/0x10
>  [<ffffffffa0036942>] virtio_net_driver_exit+0x10/0x6ce [virtio_net]
>  [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
>  [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
>  [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
>  [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
> Code: 00 00 55 48 8b 17 48 b9 00 01 10 00 00 00 ad de 48 8b 47 08 48 89 e5 48 39 ca 74 29 48 b9 00 02 20 00 00 00
> RIP  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
>  RSP <ffff8800379e1dd0>
> ---[ end trace d5931cd3f87c9763 ]---
>
> Fixes: 986a4f4d452d (virtio_net: multiqueue support)
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>
> ---
>  drivers/net/virtio_net.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 930039a..c293764 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1367,6 +1367,11 @@ static void virtnet_config_changed(struct virtio_device *vdev)
>  
>  static void virtnet_free_queues(struct virtnet_info *vi)
>  {
> +	int i;
> +
> +	for (i = 0; i < vi->max_queue_pairs; i++)
> +		netif_napi_del(&vi->rq[i].napi);
> +
>  	kfree(vi->rq);
>  	kfree(vi->sq);
>  }

Acked-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] virtio-net: determine type of bufs correctly
  2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
  2013-12-05 14:52   ` Michael S. Tsirkin
  2013-12-06  3:20   ` Jason Wang
@ 2013-12-06 20:30   ` David Miller
  2 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-12-06 20:30 UTC (permalink / raw)
  To: avagin; +Cc: virtualization, linux-kernel, netdev, mwdalton, rusty, mst

From: Andrey Vagin <avagin@openvz.org>
Date: Thu,  5 Dec 2013 18:36:20 +0400

> free_unused_bufs must check vi->mergeable_rx_bufs before
> vi->big_packets, because we use this sequence in other places.
> Otherwise we allocate buffer of one type, then free it as another
> type.
 ...
> Fixes: 2613af0ed18a (virtio_net: migrate mergeable rx buffers to page frag allocators)
> Cc: Michael Dalton <mwdalton@google.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>

Applied.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory
  2013-12-05 14:36 ` [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory Andrey Vagin
  2013-12-05 14:53   ` Michael S. Tsirkin
  2013-12-06  3:21   ` Jason Wang
@ 2013-12-06 20:30   ` David Miller
  2 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2013-12-06 20:30 UTC (permalink / raw)
  To: avagin; +Cc: virtualization, linux-kernel, netdev, rusty, mst

From: Andrey Vagin <avagin@openvz.org>
Date: Thu,  5 Dec 2013 18:36:21 +0400

> free_netdev calls netif_napi_del too, but it's too late, because napi
> structures are placed on vi->rq. netif_napi_add() is called from
> virtnet_alloc_queues.
 ...
> Fixes: 986a4f4d452d (virtio_net: multiqueue support)
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory
  2013-12-06  3:21   ` Jason Wang
@ 2013-12-07  0:32     ` Rusty Russell
  0 siblings, 0 replies; 13+ messages in thread
From: Rusty Russell @ 2013-12-07  0:32 UTC (permalink / raw)
  To: Jason Wang, Andrey Vagin, virtualization
  Cc: netdev, linux-kernel, Michael S. Tsirkin

Jason Wang <jasowang@redhat.com> writes:
> On 12/05/2013 10:36 PM, Andrey Vagin wrote:
>> free_netdev calls netif_napi_del too, but it's too late, because napi
>> structures are placed on vi->rq. netif_napi_add() is called from
>> virtnet_alloc_queues.
>>
>> general protection fault: 0000 [#1] SMP
>> Dumping ftrace buffer:
>>    (ftrace buffer empty)
>> Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables virtio_balloon pcspkr virtio_net(-) i2c_pii
>> CPU: 1 PID: 347 Comm: rmmod Not tainted 3.13.0-rc2+ #171
>> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
>> task: ffff8800b779c420 ti: ffff8800379e0000 task.ti: ffff8800379e0000
>> RIP: 0010:[<ffffffff81322e19>]  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
>> RSP: 0018:ffff8800379e1dd0  EFLAGS: 00010a83
>> RAX: 6b6b6b6b6b6b6b6b RBX: ffff8800379c2fd0 RCX: dead000000200200
>> RDX: 6b6b6b6b6b6b6b6b RSI: 0000000000000001 RDI: ffff8800379c2fd0
>> RBP: ffff8800379e1dd0 R08: 0000000000000001 R09: 0000000000000000
>> R10: 0000000000000000 R11: 0000000000000001 R12: ffff8800379c2f90
>> R13: ffff880037839160 R14: 0000000000000000 R15: 00000000013352f0
>> FS:  00007f1400e34740(0000) GS:ffff8800bfb00000(0000) knlGS:0000000000000000
>> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> CR2: 00007f464124c763 CR3: 00000000b68cf000 CR4: 00000000000006e0
>> Stack:
>>  ffff8800379e1df0 ffffffff8155beab 6b6b6b6b6b6b6b2b ffff8800378391c0
>>  ffff8800379e1e18 ffffffff8156499b ffff880037839be0 ffff880037839d20
>>  ffff88003779d3f0 ffff8800379e1e38 ffffffffa003477c ffff88003779d388
>> Call Trace:
>>  [<ffffffff8155beab>] netif_napi_del+0x1b/0x80
>>  [<ffffffff8156499b>] free_netdev+0x8b/0x110
>>  [<ffffffffa003477c>] virtnet_remove+0x7c/0x90 [virtio_net]
>>  [<ffffffff813ae323>] virtio_dev_remove+0x23/0x80
>>  [<ffffffff813f62ef>] __device_release_driver+0x7f/0xf0
>>  [<ffffffff813f6ca0>] driver_detach+0xc0/0xd0
>>  [<ffffffff813f5f28>] bus_remove_driver+0x58/0xd0
>>  [<ffffffff813f72ec>] driver_unregister+0x2c/0x50
>>  [<ffffffff813ae65e>] unregister_virtio_driver+0xe/0x10
>>  [<ffffffffa0036942>] virtio_net_driver_exit+0x10/0x6ce [virtio_net]
>>  [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
>>  [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
>>  [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
>>  [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
>> Code: 00 00 55 48 8b 17 48 b9 00 01 10 00 00 00 ad de 48 8b 47 08 48 89 e5 48 39 ca 74 29 48 b9 00 02 20 00 00 00
>> RIP  [<ffffffff81322e19>] __list_del_entry+0x29/0xd0
>>  RSP <ffff8800379e1dd0>
>> ---[ end trace d5931cd3f87c9763 ]---
>>
>> Fixes: 986a4f4d452d (virtio_net: multiqueue support)
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: "Michael S. Tsirkin" <mst@redhat.com>
>> Signed-off-by: Andrey Vagin <avagin@openvz.org>
>> ---
>>  drivers/net/virtio_net.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 930039a..c293764 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -1367,6 +1367,11 @@ static void virtnet_config_changed(struct virtio_device *vdev)
>>  
>>  static void virtnet_free_queues(struct virtnet_info *vi)
>>  {
>> +	int i;
>> +
>> +	for (i = 0; i < vi->max_queue_pairs; i++)
>> +		netif_napi_del(&vi->rq[i].napi);
>> +
>>  	kfree(vi->rq);
>>  	kfree(vi->sq);
>>  }
>
> Acked-by: Jason Wang <jasowang@redhat.com>

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Needed since v3.8.  Dave, please apply.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] virtio-net: determine type of bufs correctly
  2013-12-06  3:20   ` Jason Wang
@ 2013-12-07  0:35     ` Rusty Russell
  0 siblings, 0 replies; 13+ messages in thread
From: Rusty Russell @ 2013-12-07  0:35 UTC (permalink / raw)
  To: Jason Wang, Andrey Vagin, virtualization
  Cc: linux-kernel, netdev, Michael Dalton, Michael S. Tsirkin

Jason Wang <jasowang@redhat.com> writes:
> On 12/05/2013 10:36 PM, Andrey Vagin wrote:
>> free_unused_bufs must check vi->mergeable_rx_bufs before
>> vi->big_packets, because we use this sequence in other places.
>> Otherwise we allocate buffer of one type, then free it as another
>> type.
>>
>> general protection fault: 0000 [#1] SMP
>> Dumping ftrace buffer:
>>    (ftrace buffer empty)
>> Modules linked in: ip6table_filter ip6_tables iptable_filter ip_tables pcspkr virtio_balloon virtio_net(-) i2c_pii
>> CPU: 0 PID: 400 Comm: rmmod Not tainted 3.13.0-rc2+ #170
>> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
>> task: ffff8800b6d2a210 ti: ffff8800aed32000 task.ti: ffff8800aed32000
>> RIP: 0010:[<ffffffffa00345f3>]  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
>> RSP: 0018:ffff8800aed33dd8  EFLAGS: 00010202
>> RAX: ffff8800b1fe2c00 RBX: ffff8800b66a7240 RCX: 6b6b6b6b6b6b6b6b
>> RDX: 6b6b6b6b6b6b6b6b RSI: ffff8800b8419a68 RDI: ffff8800b66a1148
>> RBP: ffff8800aed33e00 R08: 0000000000000001 R09: 0000000000000000
>> R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
>> R13: ffff8800b66a1148 R14: 0000000000000000 R15: 000077ff80000000
>> FS:  00007fc4f9c4e740(0000) GS:ffff8800bfa00000(0000) knlGS:0000000000000000
>> CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
>> CR2: 00007f63f432f000 CR3: 00000000b6538000 CR4: 00000000000006f0
>> Stack:
>>  ffff8800b66a7240 ffff8800b66a7380 ffff8800377bd3f0 0000000000000000
>>  00000000023302f0 ffff8800aed33e18 ffffffffa00346e2 ffff8800b66a7240
>>  ffff8800aed33e38 ffffffffa003474d ffff8800377bd388 ffff8800377bd390
>> Call Trace:
>>  [<ffffffffa00346e2>] remove_vq_common+0x22/0x40 [virtio_net]
>>  [<ffffffffa003474d>] virtnet_remove+0x4d/0x90 [virtio_net]
>>  [<ffffffff813ae303>] virtio_dev_remove+0x23/0x80
>>  [<ffffffff813f62cf>] __device_release_driver+0x7f/0xf0
>>  [<ffffffff813f6c80>] driver_detach+0xc0/0xd0
>>  [<ffffffff813f5f08>] bus_remove_driver+0x58/0xd0
>>  [<ffffffff813f72cc>] driver_unregister+0x2c/0x50
>>  [<ffffffff813ae63e>] unregister_virtio_driver+0xe/0x10
>>  [<ffffffffa0036852>] virtio_net_driver_exit+0x10/0x7be [virtio_net]
>>  [<ffffffff810d7cf2>] SyS_delete_module+0x172/0x220
>>  [<ffffffff810a732d>] ? trace_hardirqs_on+0xd/0x10
>>  [<ffffffff810f5d4c>] ? __audit_syscall_entry+0x9c/0xf0
>>  [<ffffffff81677f69>] system_call_fastpath+0x16/0x1b
>> Code: c0 74 55 0f 1f 44 00 00 80 7b 30 00 74 7a 48 8b 50 30 4c 89 e6 48 03 73 20 48 85 d2 0f 84 bb 00 00 00 66 0f
>> RIP  [<ffffffffa00345f3>] free_unused_bufs+0xc3/0x190 [virtio_net]
>>  RSP <ffff8800aed33dd8>
>> ---[ end trace edb570ea923cce9c ]---
>>
>> Fixes: 2613af0ed18a (virtio_net: migrate mergeable rx buffers to page frag allocators)
>> Cc: Michael Dalton <mwdalton@google.com>
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: "Michael S. Tsirkin" <mst@redhat.com>
>> Signed-off-by: Andrey Vagin <avagin@openvz.org>
>> ---
>>  drivers/net/virtio_net.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index 916241d..930039a 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -1396,10 +1396,10 @@ static void free_unused_bufs(struct virtnet_info *vi)
>>  		struct virtqueue *vq = vi->rq[i].vq;
>>  
>>  		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) {
>> -			if (vi->big_packets)
>> -				give_pages(&vi->rq[i], buf);
>> -			else if (vi->mergeable_rx_bufs)
>> +			if (vi->mergeable_rx_bufs)
>>  				put_page(virt_to_head_page(buf));
>> +			else if (vi->big_packets)
>> +				give_pages(&vi->rq[i], buf);
>>  			else
>>  				dev_kfree_skb(buf);
>>  			--vi->rq[i].num;
>
> Acked-by: Jason Wang <jasowang@redhat.com>

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Dave, please apply.

Thanks,
Rusty.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-12-07  1:13 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-05 14:36 [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Andrey Vagin
2013-12-05 14:36 ` [PATCH 1/2] virtio-net: determine type of bufs correctly Andrey Vagin
2013-12-05 14:52   ` Michael S. Tsirkin
2013-12-05 20:09     ` Michael Dalton
2013-12-06  3:20   ` Jason Wang
2013-12-07  0:35     ` Rusty Russell
2013-12-06 20:30   ` David Miller
2013-12-05 14:36 ` [PATCH 2/2] virtio: delete napi structures from netdev before releasing memory Andrey Vagin
2013-12-05 14:53   ` Michael S. Tsirkin
2013-12-06  3:21   ` Jason Wang
2013-12-07  0:32     ` Rusty Russell
2013-12-06 20:30   ` David Miller
2013-12-05 14:54 ` [PATCH 0/2] virtio-net: Fix two bugs on unloading the module Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).