Patch "vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     vdpa_sim-set-last_used_idx-as-last_avail_idx-in-vdpa.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c188aff218d15f8a3f9d24ab6f3b7dc7e08199a8
Author: Eugenio Pérez <eperezma@xxxxxxxxxx>
Date:   Thu Mar 2 19:18:57 2023 +0100

    vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready
    
    [ Upstream commit b4cca6d48eb3fa6f0d9caba4329b1a2b0ff67a77 ]
    
    Starting from an used_idx different than 0 is needed in use cases like
    virtual machine migration.  Not doing so and letting the caller set an
    avail idx different than 0 causes destination device to try to use old
    buffers that source driver already recover and are not available
    anymore.
    
    Since vdpa_sim does not support receive inflight descriptors as a
    destination of a migration, let's set both avail_idx and used_idx the
    same at vq start.  This is how vhost-user works in a
    VHOST_SET_VRING_BASE call.
    
    Although the simple fix is to set last_used_idx at vdpasim_set_vq_state,
    it would be reset at vdpasim_queue_ready.  The last_avail_idx case is
    fixed with commit 0e84f918fac8 ("vdpa_sim: not reset state in
    vdpasim_queue_ready").  Since the only option is to make it equal to
    last_avail_idx, adding the only change needed here.
    
    This was discovered and tested live migrating the vdpa_sim_net device.
    
    Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator")
    Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>
    Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx>
    Message-Id: <20230302181857.925374-1-eperezma@xxxxxxxxxx>
    Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index eeda45fbba258..3ccefa58e405c 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -75,6 +75,17 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
 			  (uintptr_t)vq->device_addr);
 
 	vq->vring.last_avail_idx = last_avail_idx;
+
+	/*
+	 * Since vdpa_sim does not support receive inflight descriptors as a
+	 * destination of a migration, let's set both avail_idx and used_idx
+	 * the same at vq start.  This is how vhost-user works in a
+	 * VHOST_SET_VRING_BASE call.
+	 *
+	 * Although the simple fix is to set last_used_idx at
+	 * vdpasim_set_vq_state, it would be reset at vdpasim_queue_ready.
+	 */
+	vq->vring.last_used_idx = last_avail_idx;
 	vq->vring.notify = vdpasim_vq_notify;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux