[0/2] Fix expected set_vq_state behavior on vdpa_sim

Message ID 20230118164359.1523760-1-eperezma@redhat.com
Headers
Series Fix expected set_vq_state behavior on vdpa_sim |

Message

Eugenio Perez Martin Jan. 18, 2023, 4:43 p.m. UTC
  The use of set_vq_state is to indicate vdpa device the state of a virtqueue.
In the case of split, it means the avail_idx.  This is mandatory for use
cases like live migration.

However, vdpa_sim reset the vq state at vdpasim_queue_ready since it calls
vringh_init_iotlb.

Also, to 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.

This series fixes both problems allowing to migrate to a vdpa_sim_net device.

Eugenio Pérez (2):
  vdpa_sim: not reset state in vdpasim_queue_ready
  vringh: fetch used_idx from vring at vringh_init_iotlb

 drivers/vdpa/vdpa_sim/vdpa_sim.c |  2 ++
 drivers/vhost/vringh.c           | 25 +++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

-- 
2.31.1
  

Comments

Michael S. Tsirkin Jan. 27, 2023, 10:53 a.m. UTC | #1
On Wed, Jan 18, 2023 at 05:43:57PM +0100, Eugenio Pérez wrote:
> The use of set_vq_state is to indicate vdpa device the state of a virtqueue.
> In the case of split, it means the avail_idx.  This is mandatory for use
> cases like live migration.
> 
> However, vdpa_sim reset the vq state at vdpasim_queue_ready since it calls
> vringh_init_iotlb.
> 
> Also, to 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.
> 
> This series fixes both problems allowing to migrate to a vdpa_sim_net device.

Jason problems you pointed out are all consmetic do you ack
the patchset? Or expect another revision?

> Eugenio Pérez (2):
>   vdpa_sim: not reset state in vdpasim_queue_ready
>   vringh: fetch used_idx from vring at vringh_init_iotlb
> 
>  drivers/vdpa/vdpa_sim/vdpa_sim.c |  2 ++
>  drivers/vhost/vringh.c           | 25 +++++++++++++++++++++++--
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> -- 
> 2.31.1
>