[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3df69121-b4ac-48ce-a26c-5dd3035a3b78@amazon.com>
Date: Thu, 29 Jan 2026 17:39:17 +0100
From: Alexander Graf <graf@...zon.com>
To: Johannes Thumshirn <johannes.thumshirn@....com>
CC: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
<eperezma@...hat.com>, "open list:VIRTIO CORE"
<virtualization@...ts.linux.dev>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] virtio_ring: Add READ_ONCE annotations for
device-writable fields
On 29.01.26 13:15, Johannes Thumshirn wrote:
> From: Alexander Graf <graf@...zon.com>
>
> KCSAN reports data races when accessing virtio ring fields that are
> concurrently written by the device (host). These are legitimate
> concurrent accesses where the CPU reads fields that the device updates
> via DMA-like mechanisms.
>
> Add accessor functions that use READ_ONCE() to properly annotate these
> device-writable fields and prevent compiler optimizations that could in
> theory break the code. This also serves as documentation showing which
> fields are shared with the device.
>
> The affected fields are:
> - Split ring: used->idx, used->ring[].id, used->ring[].len
> - Packed ring: desc[].flags, desc[].id, desc[].len
Please add "This patch was partially written using the help of Kiro, an
AI coding assistent, to automate the mechanical work of generating the
inline function definition."
Otherwise LGTM!
Reviewed-by: Alexander Graf <graf@...zon.com>
Alex
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
Powered by blists - more mailing lists