diff options
| author | Alexander Graf <graf@amazon.com> | 2026-01-31 13:28:09 +0300 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-06-10 09:16:59 +0300 |
| commit | 32fe1de5c12471b8c2d613003bd93d111586a10d (patch) | |
| tree | 403463eeb36aafdf27a909a4da5b8bca7d5cc748 /include/linux/start_kernel.h | |
| parent | 455a2a1af92651764e9eb42cec0d95ac142afc28 (diff) | |
| download | linux-32fe1de5c12471b8c2d613003bd93d111586a10d.tar.xz | |
virtio_ring: Add READ_ONCE annotations for device-writable fields
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
This patch was partially written using the help of Kiro, an
AI coding assistant, to automate the mechanical work of generating the
inline function definition.
Signed-off-by: Alexander Graf <graf@amazon.com>
[jth: Add READ_ONCE in virtqueue_kick_prepare_split ]
Co-developed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260131102810.1254845-1-johannes.thumshirn@wdc.com>
Diffstat (limited to 'include/linux/start_kernel.h')
0 files changed, 0 insertions, 0 deletions
