| 0d195797 | 01-Sep-2026 |
Linfeng Sun <linfeng.sun.dev@gmail.com> |
vdpa_sim_net: check TX pull result before RX copy
vringh_iov_pull_iotlb() returns a signed byte count. A failed TX pull is currently added to the unsigned byte counter and then passed as a size_t l
vdpa_sim_net: check TX pull result before RX copy
vringh_iov_pull_iotlb() returns a signed byte count. A failed TX pull is currently added to the unsigned byte counter and then passed as a size_t length to receive_filter() and vringh_iov_push_iotlb(). A negative error can therefore become a large length in the RX path.
Handle non-positive pull results before every length use. Count the TX error and complete the consumed TX descriptor with zero bytes.
I found this bug myself, though the patch was written with AI assistance.
Fixes: cfe226892913 ("vdpa_sim: filter destination mac address") Assisted-by: OpenAI-Codex:GPT-5 Signed-off-by: Linfeng Sun <linfeng.sun.dev@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260901094842.25875-1-linfeng.sun.dev@gmail.com>
show more ...
|
| 7b411448 | 26-Jun-2026 |
Xiong Weimin <xiongweimin@kylinos.cn> |
vdpa_sim: hold iommu_lock across dma_unmap passthrough transition
vdpasim_dma_map() updates the IOTLB and the passthrough (iommu_pt) state under iommu_lock. vdpasim_dma_unmap() clears iommu_pt and
vdpa_sim: hold iommu_lock across dma_unmap passthrough transition
vdpasim_dma_map() updates the IOTLB and the passthrough (iommu_pt) state under iommu_lock. vdpasim_dma_unmap() clears iommu_pt and resets the IOTLB before taking iommu_lock, then deletes the mapping while holding the lock.
A concurrent dma_map(), dma_unmap(), or reset path that also touches the same address space can therefore observe or modify the IOTLB and iommu_pt state without consistent locking.
Perform the passthrough transition and range deletion under the same iommu_lock scope, matching dma_map().
Tested-on: openEuler VM (6.16.8, /usr/src/linux-6.16.8) Tested-by: Xiong Weimin <xiongweimin@kylinos.cn>
Signed-off-by: Xiong Weimin <xiongweimin@kylinos.cn> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260626020545.607600-3-15927021679@163.com>
show more ...
|
| 135f0abe | 26-Jun-2026 |
Xiong Weimin <xiongweimin@kylinos.cn> |
vdpa_sim: clear pending_kick on device reset
vdpasim_kick_vq() sets pending_kick when a virtqueue is kicked while the device is suspended (!running but DRIVER_OK). vdpasim_resume() later replays ki
vdpa_sim: clear pending_kick on device reset
vdpasim_kick_vq() sets pending_kick when a virtqueue is kicked while the device is suspended (!running but DRIVER_OK). vdpasim_resume() later replays kicks for all virtqueues when pending_kick is set.
vdpasim_do_reset() clears running and status but leaves pending_kick unchanged. If a kick is deferred during suspend and the device is reset before resume, a later resume can spuriously kick every virtqueue even though no new work was queued after reset.
Clear pending_kick in vdpasim_do_reset() together with the other device state that must not survive a reset.
Tested-on: openEuler VM (6.16.8, /usr/src/linux-6.16.8) Tested-by: Xiong Weimin <xiongweimin@kylinos.cn>
Signed-off-by: Xiong Weimin <xiongweimin@kylinos.cn> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260626020545.607600-2-15927021679@163.com>
show more ...
|
| e13fc46b | 24-Apr-2026 |
Johan Hovold <johan@kernel.org> |
vdpa_sim_net: switch to dynamic root device
Driver core expects devices to be dynamically allocated and will, for example, complain loudly when no release function has been provided.
Use root_devic
vdpa_sim_net: switch to dynamic root device
Driver core expects devices to be dynamically allocated and will, for example, complain loudly when no release function has been provided.
Use root_device_register() to allocate and register the root device instead of open coding using a static device.
Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20260424104703.2619093-3-johan@kernel.org>
show more ...
|
| 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 ...
|