When booting a Qemu VM with virtio-blk and KCSAN enabled, KCSAN emits the following warning about a data-race in virtqueue_kick_prepare().
================================================================== BUG: KCSAN: data-race in virtqueue_kick_prepare+0x14d/0x200 race at unknown origin, with read to 0xffff888101cd6d44 of 2 bytes by task 162 on cpu 0: virtqueue_kick_prepare+0x14d/0x200 virtio_fs_enqueue_req+0x664/0x7d0 virtio_fs_send_req+0xac/0x230 __fuse_simple_request+0x1e1/0x580 fuse_readlink_folio+0x1dc/0x2a0 fuse_get_link+0xd6/0x190 vfs_get_link+0x70/0x80 ovl_get_link+0x4d/0x90 pick_link+0x2c6/0x6a0 step_into_slowpath+0x2ea/0x590 path_openat+0x5bf/0x1b30 do_filp_open+0x177/0x260 do_sys_openat2+0x69/0xc0 __x64_sys_openat+0x7a/0xc0 x64_sys_call+0x10cf/0x1c30 do_syscall_64+0x5d/0x240 entry_SYSCALL_64_after_hwframe+0x76/0x7e value changed: 0x0e63 -> 0x0e65 Reported by Kernel Concurrency Sanitizer on: CPU: 0 UID: 0 PID: 162 Comm: systemctl Not tainted 6.19.0-rc7+ #220 PREEMPT(none) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.17.0-9.fc43 06/10/2025 ================================================================== This warning is likely a false positive as the change happens on the virtio vring. Annotate the return of vring_avail_event() with data_race() to silence the warning. Signed-off-by: Johannes Thumshirn <[email protected]> --- drivers/virtio/virtio_ring.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index ddab68959671..5f8c8254bb6c 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -736,9 +736,10 @@ static bool virtqueue_kick_prepare_split(struct virtqueue *_vq) LAST_ADD_TIME_INVALID(vq); if (vq->event) { - needs_kick = vring_need_event(virtio16_to_cpu(_vq->vdev, - vring_avail_event(&vq->split.vring)), - new, old); + needs_kick = vring_need_event( + virtio16_to_cpu(_vq->vdev, data_race(vring_avail_event( + &vq->split.vring))), + new, old); } else { needs_kick = !(vq->split.vring.used->flags & cpu_to_virtio16(_vq->vdev, -- 2.52.0

