[PATCH 0/2] vdpa_sim_blk: support shared backend

Stefano Garzarella
Fri, 07 Apr 2023 13:36:56 -0000

This series is mainly for testing live migration between 2 vdpa_sim_blk
devices.

The first patch is preparation and moves the buffer allocation into devices,
the second patch adds the `shared_buffer_mutex` parameter to vdpa_sim_blk to
use the same ramdisk for all devices.

Tested with QEMU v8.0.0-rc2 in this way:

modprobe vhost_vdpa
modprobe vdpa_sim_blk shared_backend=true

vdpa dev add mgmtdev vdpasim_blk name blk0
vdpa dev add mgmtdev vdpasim_blk name blk1

qemu-system-x86_64 -m 512M -smp 2 -M q35,accel=kvm,memory-backend=mem \
 ?-object
memory-backend-file,share=on,id=mem,size="512M",mem-path="/dev/shm"
 ?...
 ?-blockdev
node-name=drive_src1,driver=virtio-blk-vhost-vdpa,path=/dev/vhost-vdpa-1,cache.direct=on
\
 ?-device virtio-blk-pci,id=src1,bootindex=2,drive=drive_src1 \
  -incoming tcp:0:3333

qemu-system-x86_64 -m 512M -smp 2 -M q35,accel=kvm,memory-backend=mem \
  -object
memory-backend-file,share=on,id=mem,size="512M",mem-path="/dev/shm"
  ...
  -blockdev
node-name=drive_src1,driver=virtio-blk-vhost-vdpa,path=/dev/vhost-vdpa-0,cache.direct=on
\
  -device virtio-blk-pci,id=src1,bootindex=2,drive=drive_src1

(qemu) migrate -d tcp:0:3333

Stefano Garzarella (2):
  vdpa_sim: move buffer allocation in the devices
  vdpa_sim_blk: support shared backend

 drivers/vdpa/vdpa_sim/vdpa_sim.h     |  3 +-
 drivers/vdpa/vdpa_sim/vdpa_sim.c     |  7 +--
 drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 83 +++++++++++++++++++++++++---
 drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 28 +++++++---
 4 files changed, 100 insertions(+), 21 deletions(-)

--
2.39.2