mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH vhost] vdpa/mlx5: Fix needs_teardown flag calculation
@ 2025-06-04 18:48 Dragos Tatulea
  2025-06-05  2:48 ` Jason Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Dragos Tatulea @ 2025-06-04 18:48 UTC (permalink / raw)
  To: Dragos Tatulea, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Eugenio Pérez, Cosmin Ratiu
  Cc: Shahar Shitrit, Si-Wei Liu, virtualization, linux-kernel

needs_teardown is a device flag that indicates when virtual queues need
to be recreated. This happens for certain configuration changes: queue
size and some specific features.

Currently, the needs_teardown state can be incorrectly reset by
subsequent .set_vq_num() calls. For example, for 1 rx VQ with size 512
and 1 tx VQ with size 256:

.set_vq_num(0, 512) -> sets needs_teardown to true (rx queue has a
                       non-default size)
.set_vq_num(1, 256) -> sets needs_teardown to false (tx queue has a
                       default size)

This change takes into account the previous value of the needs_teardown
flag when re-calculating it during VQ size configuration.

Fixes: 0fe963d6fc16 ("vdpa/mlx5: Re-create HW VQs under certain conditions")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Shahar Shitrit <shshitrit@nvidia.com>
Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Tested-by: Si-Wei Liu<si-wei.liu@oracle.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index cccc49a08a1a..efb5fa694f1e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -2491,7 +2491,7 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
         }
 
 	mvq = &ndev->vqs[idx];
-	ndev->needs_teardown = num != mvq->num_ent;
+	ndev->needs_teardown |= num != mvq->num_ent;
 	mvq->num_ent = num;
 }
 
-- 
2.43.0


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

* Re: [PATCH vhost] vdpa/mlx5: Fix needs_teardown flag calculation
  2025-06-04 18:48 [PATCH vhost] vdpa/mlx5: Fix needs_teardown flag calculation Dragos Tatulea
@ 2025-06-05  2:48 ` Jason Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Wang @ 2025-06-05  2:48 UTC (permalink / raw)
  To: Dragos Tatulea
  Cc: Michael S. Tsirkin, Xuan Zhuo, Eugenio Pérez, Cosmin Ratiu,
	Shahar Shitrit, Si-Wei Liu, virtualization, linux-kernel

On Thu, Jun 5, 2025 at 2:48 AM Dragos Tatulea <dtatulea@nvidia.com> wrote:
>
> needs_teardown is a device flag that indicates when virtual queues need
> to be recreated. This happens for certain configuration changes: queue
> size and some specific features.
>
> Currently, the needs_teardown state can be incorrectly reset by
> subsequent .set_vq_num() calls. For example, for 1 rx VQ with size 512
> and 1 tx VQ with size 256:
>
> .set_vq_num(0, 512) -> sets needs_teardown to true (rx queue has a
>                        non-default size)
> .set_vq_num(1, 256) -> sets needs_teardown to false (tx queue has a
>                        default size)
>
> This change takes into account the previous value of the needs_teardown
> flag when re-calculating it during VQ size configuration.
>
> Fixes: 0fe963d6fc16 ("vdpa/mlx5: Re-create HW VQs under certain conditions")
> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> Reviewed-by: Shahar Shitrit <shshitrit@nvidia.com>
> Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
> Tested-by: Si-Wei Liu<si-wei.liu@oracle.com>
> ---

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

Thanks


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

end of thread, other threads:[~2025-06-05  2:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-04 18:48 [PATCH vhost] vdpa/mlx5: Fix needs_teardown flag calculation Dragos Tatulea
2025-06-05  2:48 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®