]> git.ipfire.org Git - thirdparty/linux.git/commit
virtio_scsi: fix DMA cacheline issues for events
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 29 Dec 2025 23:25:16 +0000 (18:25 -0500)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 8 Jan 2026 14:54:27 +0000 (09:54 -0500)
commit2678369e8efe0c5ac71adb49fbc2c240a222e44d
tree9cbfa7d5d59848490320300b08f6ec792fd20541
parent95c7b0ad6c69d1c0608ff0bbd358a546856beaf3
virtio_scsi: fix DMA cacheline issues for events

Current struct virtio_scsi_event_node layout has two problems:

The event (DMA_FROM_DEVICE) and work (CPU-written via
INIT_WORK/queue_work) fields share a cacheline.
On non-cache-coherent platforms, CPU writes to work can
corrupt device-written event data.

If ARCH_DMA_MINALIGN is large enough, the 8 events in event_list share
cachelines, triggering CONFIG_DMA_API_DEBUG warnings.

Fix the corruption by moving event buffers to a separate array and
aligning using __dma_from_device_group_begin()/end().

Suppress the (now spurious) DMA debug warnings using
virtqueue_add_inbuf_cache_clean().

Message-ID: <8801aeef7576a155299f19b6887682dd3a272aba.1767601130.git.mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/scsi/virtio_scsi.c