0d824102 | 31-Oct-2023 |
Stefano Garzarella <sgarzare@redhat.com> |
vdpa_sim_blk: allocate the buffer zeroed
Deleting and recreating a device can lead to having the same content as the old device, so let's always allocate buffers completely zeroed out.
Fixes: abebb
vdpa_sim_blk: allocate the buffer zeroed
Deleting and recreating a device can lead to having the same content as the old device, so let's always allocate buffers completely zeroed out.
Fixes: abebb16254b3 ("vdpa_sim_blk: support shared backend") Suggested-by: Qing Wang <qinwang@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20231031144339.121453-1-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com>
show more ...
|
abebb162 | 07-Apr-2023 |
Stefano Garzarella <sgarzare@redhat.com> |
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 e
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>
show more ...
|
112f23cd | 07-Apr-2023 |
Stefano Garzarella <sgarzare@redhat.com> |
vdpa_sim: move buffer allocation in the devices
Currently, the vdpa_sim core does not use the buffer, but only allocates it.
The buffer is used by devices differently, and some future devices may n
vdpa_sim: move buffer allocation in the devices
Currently, the vdpa_sim core does not use the buffer, but only allocates it.
The buffer is used by devices differently, and some future devices may not use it. So let's move all its management inside the devices.
Add a new `free` device callback called to clean up the resources allocated by the device.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20230407133658.66339-2-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|
4bb94d2d | 04-Apr-2023 |
Stefano Garzarella <sgarzare@redhat.com> |
vdpa_sim: add support for user VA
The new "use_va" module parameter (default: true) is used in vdpa_alloc_device() to inform the vDPA framework that the device supports VA.
vringh is initialized to
vdpa_sim: add support for user VA
The new "use_va" module parameter (default: true) is used in vdpa_alloc_device() to inform the vDPA framework that the device supports VA.
vringh is initialized to use VA only when "use_va" is true and the user's mm has been bound. So, only when the bus supports user VA (e.g. vhost-vdpa).
vdpasim_mm_work_fn work is used to serialize the binding to a new address space when the .bind_mm callback is invoked, and unbinding when the .unbind_mm callback is invoked.
Call mmget_not_zero()/kthread_use_mm() inside the worker function to pin the address space only as long as needed, following the documentation of mmget() in include/linux/sched/mm.h:
* Never use this function to pin this address space for an * unbounded/indefinite amount of time.
Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20230404131734.45943-1-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|
d7621c28 | 04-Apr-2023 |
Stefano Garzarella <sgarzare@redhat.com> |
vdpa_sim: replace the spinlock with a mutex to protect the state
The spinlock we use to protect the state of the simulator is sometimes held for a long time (for example, when devices handle request
vdpa_sim: replace the spinlock with a mutex to protect the state
The spinlock we use to protect the state of the simulator is sometimes held for a long time (for example, when devices handle requests).
This also prevents us from calling functions that might sleep (such as kthread_flush_work() in the next patch), and thus having to release and retake the lock.
For these reasons, let's replace the spinlock with a mutex that gives us more flexibility.
Suggested-by: Jason Wang <jasowang@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20230404131730.45920-1-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|
76acfa7b | 04-Apr-2023 |
Stefano Garzarella <sgarzare@redhat.com> |
vdpa_sim: use kthread worker
Let's use our own kthread to run device jobs. This allows us more flexibility, especially we can attach the kthread to the user address space when vDPA uses user's VA.
vdpa_sim: use kthread worker
Let's use our own kthread to run device jobs. This allows us more flexibility, especially we can attach the kthread to the user address space when vDPA uses user's VA.
Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20230404131725.45908-1-sgarzare@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|
6c3d329e | 23-Dec-2022 |
Jason Wang <jasowang@redhat.com> |
vdpa_sim: get rid of DMA ops
We used to (ab)use the DMA ops for setting up identical mappings in the IOTLB. This patch tries to get rid of the those unnecessary DMA ops by maintaining a simple ident
vdpa_sim: get rid of DMA ops
We used to (ab)use the DMA ops for setting up identical mappings in the IOTLB. This patch tries to get rid of the those unnecessary DMA ops by maintaining a simple identical/passthrough mappings by default. When bound to virtio_vdpa driver, DMA API will simply use PA as the IOVA and we will be all fine. When the vDPA bus tries to setup customized mapping (e.g when bound to vhost-vDPA), the identical/passthrough mapping will be removed.
Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221223060021.28011-1-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Christoph Hellwig <hch@lst.de>
show more ...
|
0899774c | 23-Dec-2022 |
Jason Wang <jasowang@redhat.com> |
vdpa_sim_net: vendor satistics
This patch adds support for basic vendor stats that include counters for tx, rx and cvq.
Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jaso
vdpa_sim_net: vendor satistics
This patch adds support for basic vendor stats that include counters for tx, rx and cvq.
Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221223055548.27810-5-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
show more ...
|
5dbb063a | 23-Dec-2022 |
Jason Wang <jasowang@redhat.com> |
vdpa_sim: support vendor statistics
This patch adds a new config ops callback to allow individual simulator to implement the vendor stats callback.
Acked-by: Eugenio Pérez <eperezma@redhat.com> Sig
vdpa_sim: support vendor statistics
This patch adds a new config ops callback to allow individual simulator to implement the vendor stats callback.
Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221223055548.27810-4-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
show more ...
|
bb105d51 | 23-Dec-2022 |
Jason Wang <jasowang@redhat.com> |
vdpasim: customize allocation size
Allow individual simulator to customize the allocation size.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> S
vdpasim: customize allocation size
Allow individual simulator to customize the allocation size.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221223055548.27810-3-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|
0497f23e | 23-Dec-2022 |
Jason Wang <jasowang@redhat.com> |
vdpa_sim: switch to use __vdpa_alloc_device()
This allows us to control the allocation size of the structure.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Eugenio Pérez <eperezma
vdpa_sim: switch to use __vdpa_alloc_device()
This allows us to control the allocation size of the structure.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221223055548.27810-2-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
show more ...
|
2f8200ef | 21-Dec-2022 |
Jason Wang <jasowang@redhat.com> |
vdpa_sim: use weak barriers
vDPA simulators are software emulated device, so let's switch to use weak barriers to avoid extra overhead in the driver.
Signed-off-by: Jason Wang <jasowang@redhat.com>
vdpa_sim: use weak barriers
vDPA simulators are software emulated device, so let's switch to use weak barriers to avoid extra overhead in the driver.
Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221221062146.15356-1-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Acked-by: Eugenio Pérez <eperezma@redhat.com>
show more ...
|
d8b3832a | 17-Nov-2022 |
Eugenio Pérez <eperezma@redhat.com> |
vdpa_sim_net: Offer VIRTIO_NET_F_STATUS
VIRTIO_NET_S_LINK_UP is already returned in config reads since vdpasim creation, but the feature bit was not offered to the driver.
Tested modifying VIRTIO_N
vdpa_sim_net: Offer VIRTIO_NET_F_STATUS
VIRTIO_NET_S_LINK_UP is already returned in config reads since vdpasim creation, but the feature bit was not offered to the driver.
Tested modifying VIRTIO_NET_S_LINK_UP and different values of "status" in qemu virtio-net options, using vhost_vdpa.
Not considering as a fix, because there should be no driver trusting in this config read before the feature flag.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Message-Id: <20221117155502.1394700-1-eperezma@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Tested-by: Lei Yang <leiyang@redhat.com>
show more ...
|