netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: suppress cpu stall when free_unused_bufs
@ 2023-04-27  4:34 Wenliang Wang
  2023-04-27  6:20 ` Xuan Zhuo
  0 siblings, 1 reply; 14+ messages in thread
From: Wenliang Wang @ 2023-04-27  4:34 UTC (permalink / raw)
  To: mst, jasowang, davem, edumazet, kuba, pabeni
  Cc: virtualization, netdev, linux-kernel, Wenliang Wang

For multi-queue and large rx-ring-size use case, the following error
occurred when free_unused_bufs:
rcu: INFO: rcu_sched self-detected stall on CPU.

Signed-off-by: Wenliang Wang <wangwenliang.1995@bytedance.com>
---
 drivers/net/virtio_net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ea1bd4bb326d..21d8382fd2c7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3565,6 +3565,7 @@ static void free_unused_bufs(struct virtnet_info *vi)
 		struct virtqueue *vq = vi->rq[i].vq;
 		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL)
 			virtnet_rq_free_unused_buf(vq, buf);
+		schedule();
 	}
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH v2] virtio_net: suppress cpu stall when free_unused_bufs
@ 2023-04-28  2:26 Wenliang Wang
  0 siblings, 0 replies; 14+ messages in thread
From: Wenliang Wang @ 2023-04-28  2:26 UTC (permalink / raw)
  To: mst, jasowang, davem, edumazet, kuba, pabeni
  Cc: virtualization, netdev, linux-kernel, Wenliang Wang

For multi-queue and large ring-size use case, the following error
occurred when free_unused_bufs:
rcu: INFO: rcu_sched self-detected stall on CPU.

Signed-off-by: Wenliang Wang <wangwenliang.1995@bytedance.com>
---
v2:
-add need_resched check.
-apply same logic to sq.
---
 drivers/net/virtio_net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ea1bd4bb326d..573558b69a60 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3559,12 +3559,16 @@ static void free_unused_bufs(struct virtnet_info *vi)
 		struct virtqueue *vq = vi->sq[i].vq;
 		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL)
 			virtnet_sq_free_unused_buf(vq, buf);
+		if (need_resched())
+			schedule();
 	}
 
 	for (i = 0; i < vi->max_queue_pairs; i++) {
 		struct virtqueue *vq = vi->rq[i].vq;
 		while ((buf = virtqueue_detach_unused_buf(vq)) != NULL)
 			virtnet_rq_free_unused_buf(vq, buf);
+		if (need_resched())
+			schedule();
 	}
 }
 
-- 
2.20.1


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

end of thread, other threads:[~2023-04-28 13:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-27  4:34 [PATCH] virtio_net: suppress cpu stall when free_unused_bufs Wenliang Wang
2023-04-27  6:20 ` Xuan Zhuo
2023-04-27  7:02   ` Wenliang Wang
2023-04-27  7:13     ` Xuan Zhuo
2023-04-27  8:12       ` Michael S. Tsirkin
2023-04-27  8:13         ` Xuan Zhuo
2023-04-27  8:23           ` Michael S. Tsirkin
2023-04-27  8:49             ` Wenliang Wang
2023-04-27  8:51               ` Xuan Zhuo
2023-04-27 10:46                 ` [PATCH v2] " Wenliang Wang
2023-04-28  1:09                   ` Michael S. Tsirkin
2023-04-27 10:45             ` [PATCH] " Qi Zheng
2023-04-28 13:56               ` Willem de Bruijn
  -- strict thread matches above, loose matches on Subject: below --
2023-04-28  2:26 [PATCH v2] " Wenliang Wang

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