vdpa_sim_blk: support shared backend
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 7 Apr 2023 13:36:58 +0000 (15:36 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 21 Apr 2023 07:02:35 +0000 (03:02 -0400)
commitabebb16254b362664452e14d9711ddb54855ddcf
treeff2a06e93418092f88c794417f7f5015834a4f20
parent112f23cd72a2975e11986d73575e2c3651ea4c7e
vdpa_sim_blk: support shared backend

The vdpa_sim_blk simulator uses a ramdisk as the backend. To test live
migration, we need two devices that share the backend to have the data
synchronized with each other.

Add a new module parameter to make the buffer shared between all devices.

The shared_buffer_mutex is used just to ensure that each operation is
atomic, but it is up to the user to use the devices knowing that the
underlying ramdisk is shared.

For example, when we do a migration, the VMM (e.g., QEMU) will guarantee
to write to the destination device, only after completing operations with
the source device.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20230407133658.66339-3-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c