When booting a Qemu VM whith KCSAN to debug filesystem races I
encountered a bunch of KCSAN splats in virtio.

All of them are false positives, as the racy unknown origin is the
hypervisor.

Alex suggested to annotate the vring structure as racy for KCSAN, but
the __data_racy annotation turns into "volatile" and as such it cannot
be used to annotate the whole structure. Annotating every structure
embedding a pointer to the vring turned out to be way more invasive than
annotating only the few sites consumers.

Changes to v1:
- Annotate the return of more_used_split() as racy so both call sites
  are covered
- Annotate vring_avail_event() as racy so we can condense two patches
  into one.

Link to v1:
https://lore.kernel.org/virtualization/[email protected]/

Johannes Thumshirn (2):
  virtio: silence KCSAN warning in virtqueue_get_buf_ctx_split
  virtio: silence KCSAN warning in virtqueue_kick_prepare

 drivers/virtio/virtio_ring.c     | 4 ++--
 include/uapi/linux/virtio_ring.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.52.0


Reply via email to