Skip to content

Commit 83c334e

Browse files
committed
virtio_ring: tag event_triggered as racy for KCSAN
Setting event_triggered from the interrupt handler is fundamentally racy. There are races of 2 types: 1. vq processing can read false value while interrupt triggered and set it to true. result will be a bit of extra work when disabling cbs, no big deal. 1. vq processing can set false value then interrupt immediately sets true value since interrupt then triggers a callback which will process buffers, this is also not an issue. However, looks like KCSAN can not figure all this out, and warns about the race between the write and the read. Tag the access data_racy for now. We should probably look at ways to make this more straight-forwardly correct. Message-ID: <6bdd771a4fb7625a9227971b3cf4745c34c31a32.1726153334.git.mst@redhat.com> Reported-by: [email protected] Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]> Acked-by: Marco Elver <[email protected]>
1 parent bc0dcbc commit 83c334e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/virtio/virtio_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
25882588

25892589
/* Just a hint for performance: so it's ok that this can be racy! */
25902590
if (vq->event)
2591-
vq->event_triggered = true;
2591+
data_race(vq->event_triggered = true);
25922592

25932593
pr_debug("virtqueue callback for %p (%p)\n", vq, vq->vq.callback);
25942594
if (vq->vq.callback)

0 commit comments

Comments
 (0)