linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
@ 2025-05-21  9:22 Laurent Vivier
  2025-05-21  9:22 ` [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize Laurent Vivier
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Laurent Vivier @ 2025-05-21  9:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael S. Tsirkin, netdev, Jason Wang, Xuan Zhuo

This patch series contains two fixes and a cleanup for the virtio subsystem.

The first patch fixes an error reporting bug in virtio_ring's
virtqueue_resize() function. Previously, errors from internal resize
helpers could be masked if the subsequent re-enabling of the virtqueue
succeeded. This patch restores the correct error propagation, ensuring that
callers of virtqueue_resize() are properly informed of underlying resize
failures.

The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'

The third patch addresses a reliability issue in virtio_net where the TX
ring size could be configured too small, potentially leading to
persistently stopped queues and degraded performance. It enforces a
minimum TX ring size to ensure there's always enough space for at least one
maximally-fragmented packet plus an additional slot.

v2: clenup '2+MAX_SKB_FRAGS'

Laurent Vivier (3):
  virtio_ring: Fix error reporting in virtqueue_resize
  virtio_net: Cleanup '2+MAX_SKB_FRAGS'
  virtio_net: Enforce minimum TX ring size for reliability

 drivers/net/virtio_net.c     | 14 ++++++++++----
 drivers/virtio/virtio_ring.c |  8 ++++++--
 2 files changed, 16 insertions(+), 6 deletions(-)

-- 
2.49.0



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

* [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize
  2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
@ 2025-05-21  9:22 ` Laurent Vivier
  2025-05-22  1:56   ` Jason Wang
  2025-05-21  9:22 ` [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS' Laurent Vivier
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 20+ messages in thread
From: Laurent Vivier @ 2025-05-21  9:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael S. Tsirkin, netdev, Jason Wang, Xuan Zhuo

The virtqueue_resize() function was not correctly propagating error codes
from its internal resize helper functions, specifically
virtqueue_resize_packet() and virtqueue_resize_split(). If these helpers
returned an error, but the subsequent call to virtqueue_enable_after_reset()
succeeded, the original error from the resize operation would be masked.
Consequently, virtqueue_resize() could incorrectly report success to its
caller despite an underlying resize failure.

This change restores the original code behavior:

       if (vdev->config->enable_vq_after_reset(_vq))
               return -EBUSY;

       return err;

Fix: commit ad48d53b5b3f ("virtio_ring: separate the logic of reset/enable from virtqueue_resize")
Cc: xuanzhuo@linux.alibaba.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 drivers/virtio/virtio_ring.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index b784aab66867..4397392bfef0 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -2797,7 +2797,7 @@ int virtqueue_resize(struct virtqueue *_vq, u32 num,
 		     void (*recycle_done)(struct virtqueue *vq))
 {
 	struct vring_virtqueue *vq = to_vvq(_vq);
-	int err;
+	int err, err_reset;
 
 	if (num > vq->vq.num_max)
 		return -E2BIG;
@@ -2819,7 +2819,11 @@ int virtqueue_resize(struct virtqueue *_vq, u32 num,
 	else
 		err = virtqueue_resize_split(_vq, num);
 
-	return virtqueue_enable_after_reset(_vq);
+	err_reset = virtqueue_enable_after_reset(_vq);
+	if (err_reset)
+		return err_reset;
+
+	return err;
 }
 EXPORT_SYMBOL_GPL(virtqueue_resize);
 
-- 
2.49.0


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

* [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS'
  2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
  2025-05-21  9:22 ` [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize Laurent Vivier
@ 2025-05-21  9:22 ` Laurent Vivier
  2025-05-21  9:33   ` Xuan Zhuo
  2025-05-22  1:56   ` Jason Wang
  2025-05-21  9:22 ` [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability Laurent Vivier
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 20+ messages in thread
From: Laurent Vivier @ 2025-05-21  9:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael S. Tsirkin, netdev, Jason Wang, Xuan Zhuo

Improve consistency by using everywhere it is needed
'MAX_SKB_FRAGS + 2' rather than '2+MAX_SKB_FRAGS' or
'2 + MAX_SKB_FRAGS'.

No functional change.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 drivers/net/virtio_net.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index e53ba600605a..ff4160243538 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1084,7 +1084,7 @@ static bool tx_may_stop(struct virtnet_info *vi,
 	 * Since most packets only take 1 or 2 ring slots, stopping the queue
 	 * early means 16 slots are typically wasted.
 	 */
-	if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
+	if (sq->vq->num_free < MAX_SKB_FRAGS + 2) {
 		struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
 
 		netif_tx_stop_queue(txq);
@@ -1116,7 +1116,7 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
 		} else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
 			/* More just got used, free them then recheck. */
 			free_old_xmit(sq, txq, false);
-			if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
+			if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
 				netif_start_subqueue(dev, qnum);
 				u64_stats_update_begin(&sq->stats.syncp);
 				u64_stats_inc(&sq->stats.wake);
@@ -2998,7 +2998,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq, int budget)
 			free_old_xmit(sq, txq, !!budget);
 		} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
 
-		if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
+		if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
 			if (netif_tx_queue_stopped(txq)) {
 				u64_stats_update_begin(&sq->stats.syncp);
 				u64_stats_inc(&sq->stats.wake);
@@ -3195,7 +3195,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
 	else
 		free_old_xmit(sq, txq, !!budget);
 
-	if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
+	if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
 		if (netif_tx_queue_stopped(txq)) {
 			u64_stats_update_begin(&sq->stats.syncp);
 			u64_stats_inc(&sq->stats.wake);
-- 
2.49.0


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

* [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability
  2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
  2025-05-21  9:22 ` [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize Laurent Vivier
  2025-05-21  9:22 ` [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS' Laurent Vivier
@ 2025-05-21  9:22 ` Laurent Vivier
  2025-05-21  9:34   ` Xuan Zhuo
  2025-05-22  1:56   ` Jason Wang
  2025-05-27  7:32 ` [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Lei Yang
  2025-05-28  6:24 ` Paolo Abeni
  4 siblings, 2 replies; 20+ messages in thread
From: Laurent Vivier @ 2025-05-21  9:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Michael S. Tsirkin, netdev, Jason Wang, Xuan Zhuo

The `tx_may_stop()` logic stops TX queues if free descriptors
(`sq->vq->num_free`) fall below the threshold of (`MAX_SKB_FRAGS` + 2).
If the total ring size (`ring_num`) is not strictly greater than this
value, queues can become persistently stopped or stop after minimal
use, severely degrading performance.

A single sk_buff transmission typically requires descriptors for:
- The virtio_net_hdr (1 descriptor)
- The sk_buff's linear data (head) (1 descriptor)
- Paged fragments (up to MAX_SKB_FRAGS descriptors)

This patch enforces that the TX ring size ('ring_num') must be strictly
greater than (MAX_SKB_FRAGS + 2). This ensures that the ring is
always large enough to hold at least one maximally-fragmented packet
plus at least one additional slot.

Reported-by: Lei Yang <leiyang@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 drivers/net/virtio_net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ff4160243538..50b851834ae2 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3481,6 +3481,12 @@ static int virtnet_tx_resize(struct virtnet_info *vi, struct send_queue *sq,
 {
 	int qindex, err;
 
+	if (ring_num <= MAX_SKB_FRAGS + 2) {
+		netdev_err(vi->dev, "tx size (%d) cannot be smaller than %d\n",
+			   ring_num, MAX_SKB_FRAGS + 2);
+		return -EINVAL;
+	}
+
 	qindex = sq - vi->sq;
 
 	virtnet_tx_pause(vi, sq);
-- 
2.49.0


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

* Re: [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS'
  2025-05-21  9:22 ` [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS' Laurent Vivier
@ 2025-05-21  9:33   ` Xuan Zhuo
  2025-05-22  1:56   ` Jason Wang
  1 sibling, 0 replies; 20+ messages in thread
From: Xuan Zhuo @ 2025-05-21  9:33 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Michael S. Tsirkin, netdev, Jason Wang, linux-kernel

On Wed, 21 May 2025 11:22:35 +0200, Laurent Vivier <lvivier@redhat.com> wrote:
> Improve consistency by using everywhere it is needed
> 'MAX_SKB_FRAGS + 2' rather than '2+MAX_SKB_FRAGS' or
> '2 + MAX_SKB_FRAGS'.
>
> No functional change.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>

> ---
>  drivers/net/virtio_net.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index e53ba600605a..ff4160243538 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1084,7 +1084,7 @@ static bool tx_may_stop(struct virtnet_info *vi,
>  	 * Since most packets only take 1 or 2 ring slots, stopping the queue
>  	 * early means 16 slots are typically wasted.
>  	 */
> -	if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
> +	if (sq->vq->num_free < MAX_SKB_FRAGS + 2) {
>  		struct netdev_queue *txq = netdev_get_tx_queue(dev, qnum);
>
>  		netif_tx_stop_queue(txq);
> @@ -1116,7 +1116,7 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
>  		} else if (unlikely(!virtqueue_enable_cb_delayed(sq->vq))) {
>  			/* More just got used, free them then recheck. */
>  			free_old_xmit(sq, txq, false);
> -			if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
> +			if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
>  				netif_start_subqueue(dev, qnum);
>  				u64_stats_update_begin(&sq->stats.syncp);
>  				u64_stats_inc(&sq->stats.wake);
> @@ -2998,7 +2998,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq, int budget)
>  			free_old_xmit(sq, txq, !!budget);
>  		} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
>
> -		if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
> +		if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
>  			if (netif_tx_queue_stopped(txq)) {
>  				u64_stats_update_begin(&sq->stats.syncp);
>  				u64_stats_inc(&sq->stats.wake);
> @@ -3195,7 +3195,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
>  	else
>  		free_old_xmit(sq, txq, !!budget);
>
> -	if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
> +	if (sq->vq->num_free >= MAX_SKB_FRAGS + 2) {
>  		if (netif_tx_queue_stopped(txq)) {
>  			u64_stats_update_begin(&sq->stats.syncp);
>  			u64_stats_inc(&sq->stats.wake);
> --
> 2.49.0
>

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

* Re: [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability
  2025-05-21  9:22 ` [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability Laurent Vivier
@ 2025-05-21  9:34   ` Xuan Zhuo
  2025-05-22  1:56   ` Jason Wang
  1 sibling, 0 replies; 20+ messages in thread
From: Xuan Zhuo @ 2025-05-21  9:34 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Michael S. Tsirkin, netdev, Jason Wang, linux-kernel

On Wed, 21 May 2025 11:22:36 +0200, Laurent Vivier <lvivier@redhat.com> wrote:
> The `tx_may_stop()` logic stops TX queues if free descriptors
> (`sq->vq->num_free`) fall below the threshold of (`MAX_SKB_FRAGS` + 2).
> If the total ring size (`ring_num`) is not strictly greater than this
> value, queues can become persistently stopped or stop after minimal
> use, severely degrading performance.
>
> A single sk_buff transmission typically requires descriptors for:
> - The virtio_net_hdr (1 descriptor)
> - The sk_buff's linear data (head) (1 descriptor)
> - Paged fragments (up to MAX_SKB_FRAGS descriptors)
>
> This patch enforces that the TX ring size ('ring_num') must be strictly
> greater than (MAX_SKB_FRAGS + 2). This ensures that the ring is
> always large enough to hold at least one maximally-fragmented packet
> plus at least one additional slot.
>
> Reported-by: Lei Yang <leiyang@redhat.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>

> ---
>  drivers/net/virtio_net.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index ff4160243538..50b851834ae2 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3481,6 +3481,12 @@ static int virtnet_tx_resize(struct virtnet_info *vi, struct send_queue *sq,
>  {
>  	int qindex, err;
>
> +	if (ring_num <= MAX_SKB_FRAGS + 2) {
> +		netdev_err(vi->dev, "tx size (%d) cannot be smaller than %d\n",
> +			   ring_num, MAX_SKB_FRAGS + 2);
> +		return -EINVAL;
> +	}
> +
>  	qindex = sq - vi->sq;
>
>  	virtnet_tx_pause(vi, sq);
> --
> 2.49.0
>

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

* Re: [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize
  2025-05-21  9:22 ` [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize Laurent Vivier
@ 2025-05-22  1:56   ` Jason Wang
  0 siblings, 0 replies; 20+ messages in thread
From: Jason Wang @ 2025-05-22  1:56 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: linux-kernel, Michael S. Tsirkin, netdev, Xuan Zhuo

On Wed, May 21, 2025 at 5:22 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> The virtqueue_resize() function was not correctly propagating error codes
> from its internal resize helper functions, specifically
> virtqueue_resize_packet() and virtqueue_resize_split(). If these helpers
> returned an error, but the subsequent call to virtqueue_enable_after_reset()
> succeeded, the original error from the resize operation would be masked.
> Consequently, virtqueue_resize() could incorrectly report success to its
> caller despite an underlying resize failure.
>
> This change restores the original code behavior:
>
>        if (vdev->config->enable_vq_after_reset(_vq))
>                return -EBUSY;
>
>        return err;
>
> Fix: commit ad48d53b5b3f ("virtio_ring: separate the logic of reset/enable from virtqueue_resize")
> Cc: xuanzhuo@linux.alibaba.com
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---

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

Thanks


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

* Re: [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS'
  2025-05-21  9:22 ` [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS' Laurent Vivier
  2025-05-21  9:33   ` Xuan Zhuo
@ 2025-05-22  1:56   ` Jason Wang
  1 sibling, 0 replies; 20+ messages in thread
From: Jason Wang @ 2025-05-22  1:56 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: linux-kernel, Michael S. Tsirkin, netdev, Xuan Zhuo

On Wed, May 21, 2025 at 5:22 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> Improve consistency by using everywhere it is needed
> 'MAX_SKB_FRAGS + 2' rather than '2+MAX_SKB_FRAGS' or
> '2 + MAX_SKB_FRAGS'.
>
> No functional change.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

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

Thanks


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

* Re: [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability
  2025-05-21  9:22 ` [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability Laurent Vivier
  2025-05-21  9:34   ` Xuan Zhuo
@ 2025-05-22  1:56   ` Jason Wang
  1 sibling, 0 replies; 20+ messages in thread
From: Jason Wang @ 2025-05-22  1:56 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: linux-kernel, Michael S. Tsirkin, netdev, Xuan Zhuo

On Wed, May 21, 2025 at 5:22 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> The `tx_may_stop()` logic stops TX queues if free descriptors
> (`sq->vq->num_free`) fall below the threshold of (`MAX_SKB_FRAGS` + 2).
> If the total ring size (`ring_num`) is not strictly greater than this
> value, queues can become persistently stopped or stop after minimal
> use, severely degrading performance.
>
> A single sk_buff transmission typically requires descriptors for:
> - The virtio_net_hdr (1 descriptor)
> - The sk_buff's linear data (head) (1 descriptor)
> - Paged fragments (up to MAX_SKB_FRAGS descriptors)
>
> This patch enforces that the TX ring size ('ring_num') must be strictly
> greater than (MAX_SKB_FRAGS + 2). This ensures that the ring is
> always large enough to hold at least one maximally-fragmented packet
> plus at least one additional slot.
>
> Reported-by: Lei Yang <leiyang@redhat.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  drivers/net/virtio_net.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index ff4160243538..50b851834ae2 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3481,6 +3481,12 @@ static int virtnet_tx_resize(struct virtnet_info *vi, struct send_queue *sq,
>  {
>         int qindex, err;
>
> +       if (ring_num <= MAX_SKB_FRAGS + 2) {
> +               netdev_err(vi->dev, "tx size (%d) cannot be smaller than %d\n",
> +                          ring_num, MAX_SKB_FRAGS + 2);
> +               return -EINVAL;
> +       }
> +
>         qindex = sq - vi->sq;
>
>         virtnet_tx_pause(vi, sq);
> --
> 2.49.0
>

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

Thanks


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
                   ` (2 preceding siblings ...)
  2025-05-21  9:22 ` [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability Laurent Vivier
@ 2025-05-27  7:32 ` Lei Yang
  2025-05-28  6:24 ` Paolo Abeni
  4 siblings, 0 replies; 20+ messages in thread
From: Lei Yang @ 2025-05-27  7:32 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: linux-kernel, Michael S. Tsirkin, netdev, Jason Wang, Xuan Zhuo

Tested pass this series of patches with virtio-net regression tests,
everything works fine.

Tested-by: Lei Yang <leiyang@redhat.com>

On Wed, May 21, 2025 at 5:23 PM Laurent Vivier <lvivier@redhat.com> wrote:
>
> This patch series contains two fixes and a cleanup for the virtio subsystem.
>
> The first patch fixes an error reporting bug in virtio_ring's
> virtqueue_resize() function. Previously, errors from internal resize
> helpers could be masked if the subsequent re-enabling of the virtqueue
> succeeded. This patch restores the correct error propagation, ensuring that
> callers of virtqueue_resize() are properly informed of underlying resize
> failures.
>
> The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
>
> The third patch addresses a reliability issue in virtio_net where the TX
> ring size could be configured too small, potentially leading to
> persistently stopped queues and degraded performance. It enforces a
> minimum TX ring size to ensure there's always enough space for at least one
> maximally-fragmented packet plus an additional slot.
>
> v2: clenup '2+MAX_SKB_FRAGS'
>
> Laurent Vivier (3):
>   virtio_ring: Fix error reporting in virtqueue_resize
>   virtio_net: Cleanup '2+MAX_SKB_FRAGS'
>   virtio_net: Enforce minimum TX ring size for reliability
>
>  drivers/net/virtio_net.c     | 14 ++++++++++----
>  drivers/virtio/virtio_ring.c |  8 ++++++--
>  2 files changed, 16 insertions(+), 6 deletions(-)
>
> --
> 2.49.0
>
>
>


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
                   ` (3 preceding siblings ...)
  2025-05-27  7:32 ` [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Lei Yang
@ 2025-05-28  6:24 ` Paolo Abeni
  2025-05-28  7:20   ` Michael S. Tsirkin
  2025-07-03  9:31   ` Michael S. Tsirkin
  4 siblings, 2 replies; 20+ messages in thread
From: Paolo Abeni @ 2025-05-28  6:24 UTC (permalink / raw)
  To: Laurent Vivier, Michael S. Tsirkin
  Cc: netdev, Jason Wang, Xuan Zhuo, linux-kernel

On 5/21/25 11:22 AM, Laurent Vivier wrote:
> This patch series contains two fixes and a cleanup for the virtio subsystem.
> 
> The first patch fixes an error reporting bug in virtio_ring's
> virtqueue_resize() function. Previously, errors from internal resize
> helpers could be masked if the subsequent re-enabling of the virtqueue
> succeeded. This patch restores the correct error propagation, ensuring that
> callers of virtqueue_resize() are properly informed of underlying resize
> failures.
> 
> The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
> 
> The third patch addresses a reliability issue in virtio_net where the TX
> ring size could be configured too small, potentially leading to
> persistently stopped queues and degraded performance. It enforces a
> minimum TX ring size to ensure there's always enough space for at least one
> maximally-fragmented packet plus an additional slot.

@Michael: it's not clear to me if you prefer take this series via your
tree or if it should go via net. Please LMK, thanks!

Paolo


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-05-28  6:24 ` Paolo Abeni
@ 2025-05-28  7:20   ` Michael S. Tsirkin
  2025-06-16 13:07     ` Laurent Vivier
  2025-07-03  7:43     ` Laurent Vivier
  2025-07-03  9:31   ` Michael S. Tsirkin
  1 sibling, 2 replies; 20+ messages in thread
From: Michael S. Tsirkin @ 2025-05-28  7:20 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Laurent Vivier, netdev, Jason Wang, Xuan Zhuo, linux-kernel

On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
> On 5/21/25 11:22 AM, Laurent Vivier wrote:
> > This patch series contains two fixes and a cleanup for the virtio subsystem.
> > 
> > The first patch fixes an error reporting bug in virtio_ring's
> > virtqueue_resize() function. Previously, errors from internal resize
> > helpers could be masked if the subsequent re-enabling of the virtqueue
> > succeeded. This patch restores the correct error propagation, ensuring that
> > callers of virtqueue_resize() are properly informed of underlying resize
> > failures.
> > 
> > The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
> > 
> > The third patch addresses a reliability issue in virtio_net where the TX
> > ring size could be configured too small, potentially leading to
> > persistently stopped queues and degraded performance. It enforces a
> > minimum TX ring size to ensure there's always enough space for at least one
> > maximally-fragmented packet plus an additional slot.
> 
> @Michael: it's not clear to me if you prefer take this series via your
> tree or if it should go via net. Please LMK, thanks!
> 
> Paolo

Given 1/3 is in virtio I was going to take it. Just after rc1,
though.


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-05-28  7:20   ` Michael S. Tsirkin
@ 2025-06-16 13:07     ` Laurent Vivier
  2025-06-23  8:23       ` Laurent Vivier
  2025-07-03  7:43     ` Laurent Vivier
  1 sibling, 1 reply; 20+ messages in thread
From: Laurent Vivier @ 2025-06-16 13:07 UTC (permalink / raw)
  To: Michael S. Tsirkin, Paolo Abeni
  Cc: netdev, Jason Wang, Xuan Zhuo, linux-kernel

On 28/05/2025 09:20, Michael S. Tsirkin wrote:
> On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
>> On 5/21/25 11:22 AM, Laurent Vivier wrote:
>>> This patch series contains two fixes and a cleanup for the virtio subsystem.
>>>
>>> The first patch fixes an error reporting bug in virtio_ring's
>>> virtqueue_resize() function. Previously, errors from internal resize
>>> helpers could be masked if the subsequent re-enabling of the virtqueue
>>> succeeded. This patch restores the correct error propagation, ensuring that
>>> callers of virtqueue_resize() are properly informed of underlying resize
>>> failures.
>>>
>>> The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
>>>
>>> The third patch addresses a reliability issue in virtio_net where the TX
>>> ring size could be configured too small, potentially leading to
>>> persistently stopped queues and degraded performance. It enforces a
>>> minimum TX ring size to ensure there's always enough space for at least one
>>> maximally-fragmented packet plus an additional slot.
>>
>> @Michael: it's not clear to me if you prefer take this series via your
>> tree or if it should go via net. Please LMK, thanks!
>>
>> Paolo
> 
> Given 1/3 is in virtio I was going to take it. Just after rc1,
> though.
> 

Hi Michael,

rc2 is out. Do you always plan to merge these fixes?

Thanks,
Laurent


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-06-16 13:07     ` Laurent Vivier
@ 2025-06-23  8:23       ` Laurent Vivier
  0 siblings, 0 replies; 20+ messages in thread
From: Laurent Vivier @ 2025-06-23  8:23 UTC (permalink / raw)
  To: Michael S. Tsirkin, Paolo Abeni
  Cc: netdev, Jason Wang, Xuan Zhuo, linux-kernel

On 16/06/2025 15:07, Laurent Vivier wrote:
> On 28/05/2025 09:20, Michael S. Tsirkin wrote:
>> On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
>>> On 5/21/25 11:22 AM, Laurent Vivier wrote:
>>>> This patch series contains two fixes and a cleanup for the virtio subsystem.
>>>>
>>>> The first patch fixes an error reporting bug in virtio_ring's
>>>> virtqueue_resize() function. Previously, errors from internal resize
>>>> helpers could be masked if the subsequent re-enabling of the virtqueue
>>>> succeeded. This patch restores the correct error propagation, ensuring that
>>>> callers of virtqueue_resize() are properly informed of underlying resize
>>>> failures.
>>>>
>>>> The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
>>>>
>>>> The third patch addresses a reliability issue in virtio_net where the TX
>>>> ring size could be configured too small, potentially leading to
>>>> persistently stopped queues and degraded performance. It enforces a
>>>> minimum TX ring size to ensure there's always enough space for at least one
>>>> maximally-fragmented packet plus an additional slot.
>>>
>>> @Michael: it's not clear to me if you prefer take this series via your
>>> tree or if it should go via net. Please LMK, thanks!
>>>
>>> Paolo
>>
>> Given 1/3 is in virtio I was going to take it. Just after rc1,
>> though.
>>
> 
> Hi Michael,
> 
> rc2 is out. Do you always plan to merge these fixes?
> 

Gently ping

Laurent


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-05-28  7:20   ` Michael S. Tsirkin
  2025-06-16 13:07     ` Laurent Vivier
@ 2025-07-03  7:43     ` Laurent Vivier
  2025-07-03  9:30       ` Michael S. Tsirkin
  1 sibling, 1 reply; 20+ messages in thread
From: Laurent Vivier @ 2025-07-03  7:43 UTC (permalink / raw)
  To: Michael S. Tsirkin, Paolo Abeni
  Cc: netdev, Jason Wang, Xuan Zhuo, linux-kernel

On 28/05/2025 09:20, Michael S. Tsirkin wrote:
> On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
>> On 5/21/25 11:22 AM, Laurent Vivier wrote:
>>> This patch series contains two fixes and a cleanup for the virtio subsystem.
>>>
>>> The first patch fixes an error reporting bug in virtio_ring's
>>> virtqueue_resize() function. Previously, errors from internal resize
>>> helpers could be masked if the subsequent re-enabling of the virtqueue
>>> succeeded. This patch restores the correct error propagation, ensuring that
>>> callers of virtqueue_resize() are properly informed of underlying resize
>>> failures.
>>>
>>> The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
>>>
>>> The third patch addresses a reliability issue in virtio_net where the TX
>>> ring size could be configured too small, potentially leading to
>>> persistently stopped queues and degraded performance. It enforces a
>>> minimum TX ring size to ensure there's always enough space for at least one
>>> maximally-fragmented packet plus an additional slot.
>>
>> @Michael: it's not clear to me if you prefer take this series via your
>> tree or if it should go via net. Please LMK, thanks!
>>
>> Paolo
> 
> Given 1/3 is in virtio I was going to take it. Just after rc1,
> though.
> 

Michael, if you don't have time to merge this series, perhaps Paolo can?

Thanks,
Laurent


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-07-03  7:43     ` Laurent Vivier
@ 2025-07-03  9:30       ` Michael S. Tsirkin
  0 siblings, 0 replies; 20+ messages in thread
From: Michael S. Tsirkin @ 2025-07-03  9:30 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Paolo Abeni, netdev, Jason Wang, Xuan Zhuo, linux-kernel

On Thu, Jul 03, 2025 at 09:43:46AM +0200, Laurent Vivier wrote:
> On 28/05/2025 09:20, Michael S. Tsirkin wrote:
> > On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
> > > On 5/21/25 11:22 AM, Laurent Vivier wrote:
> > > > This patch series contains two fixes and a cleanup for the virtio subsystem.
> > > > 
> > > > The first patch fixes an error reporting bug in virtio_ring's
> > > > virtqueue_resize() function. Previously, errors from internal resize
> > > > helpers could be masked if the subsequent re-enabling of the virtqueue
> > > > succeeded. This patch restores the correct error propagation, ensuring that
> > > > callers of virtqueue_resize() are properly informed of underlying resize
> > > > failures.
> > > > 
> > > > The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
> > > > 
> > > > The third patch addresses a reliability issue in virtio_net where the TX
> > > > ring size could be configured too small, potentially leading to
> > > > persistently stopped queues and degraded performance. It enforces a
> > > > minimum TX ring size to ensure there's always enough space for at least one
> > > > maximally-fragmented packet plus an additional slot.
> > > 
> > > @Michael: it's not clear to me if you prefer take this series via your
> > > tree or if it should go via net. Please LMK, thanks!
> > > 
> > > Paolo
> > 
> > Given 1/3 is in virtio I was going to take it. Just after rc1,
> > though.
> > 
> 
> Michael, if you don't have time to merge this series, perhaps Paolo can?
> 
> Thanks,
> Laurent


Sorry I forgot I asked that netdev guys don't handle it.

-- 
MST


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-05-28  6:24 ` Paolo Abeni
  2025-05-28  7:20   ` Michael S. Tsirkin
@ 2025-07-03  9:31   ` Michael S. Tsirkin
  2025-07-03  9:34     ` Paolo Abeni
  1 sibling, 1 reply; 20+ messages in thread
From: Michael S. Tsirkin @ 2025-07-03  9:31 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Laurent Vivier, netdev, Jason Wang, Xuan Zhuo, linux-kernel

On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
> On 5/21/25 11:22 AM, Laurent Vivier wrote:
> > This patch series contains two fixes and a cleanup for the virtio subsystem.
> > 
> > The first patch fixes an error reporting bug in virtio_ring's
> > virtqueue_resize() function. Previously, errors from internal resize
> > helpers could be masked if the subsequent re-enabling of the virtqueue
> > succeeded. This patch restores the correct error propagation, ensuring that
> > callers of virtqueue_resize() are properly informed of underlying resize
> > failures.
> > 
> > The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
> > 
> > The third patch addresses a reliability issue in virtio_net where the TX
> > ring size could be configured too small, potentially leading to
> > persistently stopped queues and degraded performance. It enforces a
> > minimum TX ring size to ensure there's always enough space for at least one
> > maximally-fragmented packet plus an additional slot.
> 
> @Michael: it's not clear to me if you prefer take this series via your
> tree or if it should go via net. Please LMK, thanks!
> 
> Paolo

I take it back: given I am still not fully operational, I'd like it
to be merged through net please. Does it have to be resubmitted for
this?

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

-- 
MST


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-07-03  9:31   ` Michael S. Tsirkin
@ 2025-07-03  9:34     ` Paolo Abeni
  2025-07-08  0:29       ` Jakub Kicinski
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Abeni @ 2025-07-03  9:34 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Laurent Vivier, netdev, Jason Wang, Xuan Zhuo, linux-kernel

On 7/3/25 11:31 AM, Michael S. Tsirkin wrote:
> On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:
>> On 5/21/25 11:22 AM, Laurent Vivier wrote:
>>> This patch series contains two fixes and a cleanup for the virtio subsystem.
>>>
>>> The first patch fixes an error reporting bug in virtio_ring's
>>> virtqueue_resize() function. Previously, errors from internal resize
>>> helpers could be masked if the subsequent re-enabling of the virtqueue
>>> succeeded. This patch restores the correct error propagation, ensuring that
>>> callers of virtqueue_resize() are properly informed of underlying resize
>>> failures.
>>>
>>> The second patch does a cleanup of the use of '2+MAX_SKB_FRAGS'
>>>
>>> The third patch addresses a reliability issue in virtio_net where the TX
>>> ring size could be configured too small, potentially leading to
>>> persistently stopped queues and degraded performance. It enforces a
>>> minimum TX ring size to ensure there's always enough space for at least one
>>> maximally-fragmented packet plus an additional slot.
>>
>> @Michael: it's not clear to me if you prefer take this series via your
>> tree or if it should go via net. Please LMK, thanks!
>>
>> Paolo
> 
> I take it back: given I am still not fully operational, I'd like it
> to be merged through net please. Does it have to be resubmitted for
> this?
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

I just resurrected the series in PW, so no need to repost it.

Thanks,

Paolo


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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-07-03  9:34     ` Paolo Abeni
@ 2025-07-08  0:29       ` Jakub Kicinski
  2025-07-08 16:03         ` Simon Horman
  0 siblings, 1 reply; 20+ messages in thread
From: Jakub Kicinski @ 2025-07-08  0:29 UTC (permalink / raw)
  To: Michael S. Tsirkin, Laurent Vivier
  Cc: Paolo Abeni, netdev, Jason Wang, Xuan Zhuo, linux-kernel

On Thu, 3 Jul 2025 11:34:55 +0200 Paolo Abeni wrote:
> On 7/3/25 11:31 AM, Michael S. Tsirkin wrote:
> > On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:  
> >> @Michael: it's not clear to me if you prefer take this series via your
> >> tree or if it should go via net. Please LMK, thanks!
> > 
> > I take it back: given I am still not fully operational, I'd like it
> > to be merged through net please. Does it have to be resubmitted for
> > this?
> > 
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>  
> 
> I just resurrected the series in PW, so no need to repost it.

This was merged by Paolo as b0727b0ccd907a in net/main.

No reply from pw-bot I presume because patchwork is aggressively
marking this series as Archived before the bot can get to it.

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

* Re: [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting
  2025-07-08  0:29       ` Jakub Kicinski
@ 2025-07-08 16:03         ` Simon Horman
  0 siblings, 0 replies; 20+ messages in thread
From: Simon Horman @ 2025-07-08 16:03 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Michael S. Tsirkin, Laurent Vivier, Paolo Abeni, netdev,
	Jason Wang, Xuan Zhuo, linux-kernel

On Mon, Jul 07, 2025 at 05:29:09PM -0700, Jakub Kicinski wrote:
> On Thu, 3 Jul 2025 11:34:55 +0200 Paolo Abeni wrote:
> > On 7/3/25 11:31 AM, Michael S. Tsirkin wrote:
> > > On Wed, May 28, 2025 at 08:24:32AM +0200, Paolo Abeni wrote:  
> > >> @Michael: it's not clear to me if you prefer take this series via your
> > >> tree or if it should go via net. Please LMK, thanks!
> > > 
> > > I take it back: given I am still not fully operational, I'd like it
> > > to be merged through net please. Does it have to be resubmitted for
> > > this?
> > > 
> > > Acked-by: Michael S. Tsirkin <mst@redhat.com>  
> > 
> > I just resurrected the series in PW, so no need to repost it.
> 
> This was merged by Paolo as b0727b0ccd907a in net/main.
> 
> No reply from pw-bot I presume because patchwork is aggressively
> marking this series as Archived before the bot can get to it.

The bots are fighting again :(

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

end of thread, other threads:[~2025-07-08 16:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21  9:22 [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Laurent Vivier
2025-05-21  9:22 ` [PATCH v2 1/3] virtio_ring: Fix error reporting in virtqueue_resize Laurent Vivier
2025-05-22  1:56   ` Jason Wang
2025-05-21  9:22 ` [PATCH v2 2/3] virtio_net: Cleanup '2+MAX_SKB_FRAGS' Laurent Vivier
2025-05-21  9:33   ` Xuan Zhuo
2025-05-22  1:56   ` Jason Wang
2025-05-21  9:22 ` [PATCH v2 3/3] virtio_net: Enforce minimum TX ring size for reliability Laurent Vivier
2025-05-21  9:34   ` Xuan Zhuo
2025-05-22  1:56   ` Jason Wang
2025-05-27  7:32 ` [PATCH v2 0/3] virtio: Fixes for TX ring sizing and resize error reporting Lei Yang
2025-05-28  6:24 ` Paolo Abeni
2025-05-28  7:20   ` Michael S. Tsirkin
2025-06-16 13:07     ` Laurent Vivier
2025-06-23  8:23       ` Laurent Vivier
2025-07-03  7:43     ` Laurent Vivier
2025-07-03  9:30       ` Michael S. Tsirkin
2025-07-03  9:31   ` Michael S. Tsirkin
2025-07-03  9:34     ` Paolo Abeni
2025-07-08  0:29       ` Jakub Kicinski
2025-07-08 16:03         ` Simon Horman

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