[PATCH] vdpasim: allow to enable a vq repeatedly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
---
 drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index ddbe142af09a..b53cd00ad161 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -355,9 +355,10 @@ static void vdpasim_set_vq_ready(struct vdpa_device *vdpa, u16 idx, bool ready)
 	struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
 
 	spin_lock(&vdpasim->lock);
-	vq->ready = ready;
-	if (vq->ready)
+	if (!vq->ready) {
+		vq->ready = ready;
 		vdpasim_queue_ready(vdpasim, idx);
+	}
 	spin_unlock(&vdpasim->lock);
 }
 
-- 
2.27.0




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux