* [PATCH v2] vdpasim: allow to enable a vq repeatedly
@ 2022-05-19 14:59 Eugenio Pérez
2022-05-19 16:04 ` Stefano Garzarella
0 siblings, 1 reply; 3+ messages in thread
From: Eugenio Pérez @ 2022-05-19 14:59 UTC (permalink / raw)
To: mst, jasowang
Cc: lvivier, netdev, lulu, eli, sgarzare, parav, virtualization, kvm,
lingshan.zhu, linux-kernel, gdawar
Code must be resilient to enable a queue many times.
At the moment the queue is resetting so it's definitely not the expected
behavior.
v2: set vq->ready = 0 at disable.
Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
Cc: stable@vger.kernel.org
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index ddbe142af09a..881f9864c437 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -353,11 +353,14 @@ static void vdpasim_set_vq_ready(struct vdpa_device *vdpa, u16 idx, bool ready)
{
struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
+ bool old_ready;
spin_lock(&vdpasim->lock);
+ old_ready = vq->ready;
vq->ready = ready;
- if (vq->ready)
+ if (vq->ready && !old_ready) {
vdpasim_queue_ready(vdpasim, idx);
+ }
spin_unlock(&vdpasim->lock);
}
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] vdpasim: allow to enable a vq repeatedly
2022-05-19 14:59 [PATCH v2] vdpasim: allow to enable a vq repeatedly Eugenio Pérez
@ 2022-05-19 16:04 ` Stefano Garzarella
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2022-05-19 16:04 UTC (permalink / raw)
To: Eugenio Pérez
Cc: mst, jasowang, lvivier, netdev, lulu, eli, parav, virtualization,
kvm, lingshan.zhu, linux-kernel, gdawar
On Thu, May 19, 2022 at 04:59:19PM +0200, Eugenio Pérez wrote:
>Code must be resilient to enable a queue many times.
>
>At the moment the queue is resetting so it's definitely not the expected
>behavior.
>
>v2: set vq->ready = 0 at disable.
>
>Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
>Cc: stable@vger.kernel.org
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>---
> drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] vdpasim: allow to enable a vq repeatedly
@ 2022-05-19 16:04 ` Stefano Garzarella
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2022-05-19 16:04 UTC (permalink / raw)
To: Eugenio Pérez
Cc: lvivier, kvm, lulu, mst, netdev, linux-kernel, gdawar,
virtualization, eli, lingshan.zhu
On Thu, May 19, 2022 at 04:59:19PM +0200, Eugenio Pérez wrote:
>Code must be resilient to enable a queue many times.
>
>At the moment the queue is resetting so it's definitely not the expected
>behavior.
>
>v2: set vq->ready = 0 at disable.
>
>Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
>Cc: stable@vger.kernel.org
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>---
> drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-19 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 14:59 [PATCH v2] vdpasim: allow to enable a vq repeatedly Eugenio Pérez
2022-05-19 16:04 ` Stefano Garzarella
2022-05-19 16:04 ` Stefano Garzarella
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.