[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260127083926.865555-4-johannes.thumshirn@wdc.com>
Date: Tue, 27 Jan 2026 09:39:26 +0100
From: Johannes Thumshirn <johannes.thumshirn@....com>
To: virtualization@...ts.linux.dev
Cc: Alexander Graf <graf@...zon.com>,
mst@...hat.com,
jasowang@...hat.com,
xuanzhuo@...ux.alibaba.com,
eperezma@...hat.com,
linux-kernel@...r.kernel.org,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH RFC 3/3] virtio: silence KCSAN warning in vring_interrupt
When booting a Qemu VM with virtio-blk and KCSAN enabled, KCSAN emits
the following warning about a data-race in vring_interrupt().
==================================================================
BUG: KCSAN: data-race in vring_interrupt+0x125/0x1f0
race at unknown origin, with read to 0xffff88810218d942 of 2 bytes by interrupt on cpu 7:
vring_interrupt+0x125/0x1f0
__handle_irq_event_percpu+0xaf/0x310
handle_irq_event+0x76/0xf0
handle_edge_irq+0x1fc/0x3e0
__common_interrupt+0x79/0x160
common_interrupt+0xa6/0xe0
asm_common_interrupt+0x26/0x40
pv_native_safe_halt+0x17/0x20
default_idle+0x9/0x10
default_idle_call+0x3c/0x110
do_idle+0x166/0x190
cpu_startup_entry+0x29/0x30
start_secondary+0x114/0x140
common_startup_64+0x129/0x138
value changed: 0x3a3a -> 0x3a3b
Reported by Kernel Concurrency Sanitizer on:
CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Not tainted 6.19.0-rc7+ #223 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 more_used() with data_race() to silence the
warning.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....com>
---
drivers/virtio/virtio_ring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index d1033768b6cd..7fa8f2ebe94e 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -2695,7 +2695,7 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
{
struct vring_virtqueue *vq = to_vvq(_vq);
- if (!more_used(vq)) {
+ if (data_race(!more_used(vq))) {
pr_debug("virtqueue interrupt with no work for %p\n", vq);
return IRQ_NONE;
}
--
2.52.0
Powered by blists - more mailing lists