linux/drivers/vdpa
Eugenio Pérez b4cca6d48e vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready
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 0e84f918fa ("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: 2c53d0f64c ("vdpasim: vDPA device simulator")
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230302181857.925374-1-eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2023-03-13 02:29:12 -04:00
..
alibaba vdpa: multiple address spaces support 2022-05-31 12:44:27 -04:00
ifcvf vDPA/ifcvf: implement features provisioning 2023-02-20 19:26:55 -05:00
mlx5 vdpa/mlx5: should not activate virtq object when suspended 2023-03-10 04:02:31 -05:00
solidrun virtio: vdpa: new SolidNET DPU driver. 2023-02-20 19:26:56 -05:00
vdpa_sim vdpa_sim: set last_used_idx as last_avail_idx in vdpasim_queue_ready 2023-03-13 02:29:12 -04:00
vdpa_user - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
virtio_pci vp_vdpa: fix the crash in hot unplug with vp_vdpa 2023-03-10 03:48:27 -05:00
Kconfig virtio: vdpa: new SolidNET DPU driver. 2023-02-20 19:26:56 -05:00
Makefile virtio: vdpa: new SolidNET DPU driver. 2023-02-20 19:26:56 -05:00
vdpa.c vdpa: validate device feature provisioning against supported class 2023-02-20 19:27:00 -05:00