From: Alexander Graf <graf@amazon.com>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
<virtualization@lists.linux.dev>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] virtio: silence KCSAN warning in virtqueue_get_buf_ctx_split
Date: Tue, 27 Jan 2026 17:30:17 +0100 [thread overview]
Message-ID: <184ced70-f3ec-49c0-9b18-96f0ad044a78@amazon.com> (raw)
In-Reply-To: <20260127152524.200465-2-johannes.thumshirn@wdc.com>
On 27.01.26 16:25, Johannes Thumshirn wrote:
> When booting a Qemu VM with virtio-blk and KCSAN enabled, KCSAN emits
> the following warning about a data-race in virtqueue_get_buf_ctx_split().
>
> ==================================================================
> BUG: KCSAN: data-race in virtqueue_get_buf_ctx_split+0x6e/0x260
>
> race at unknown origin, with read to 0xffff8881020f1942 of 2 bytes by task 1 on cpu 7:
> virtqueue_get_buf_ctx_split+0x6e/0x260
> virtqueue_get_buf+0x4b/0x60
> __send_to_port+0x156/0x170
> put_chars+0xcb/0x110
> hvc_console_print+0x1d6/0x2a0
> console_flush_one_record+0x3dd/0x510
> console_unlock+0x8c/0x160
> vprintk_emit+0x2fe/0x380
> vprintk_default+0x1d/0x30
> vprintk+0xe/0x20
> _printk+0x4c/0x60
> btrfs_test_raid_stripe_tree+0x25/0x90
> btrfs_run_sanity_tests.cold+0xf1/0x13b
> init_btrfs_fs+0x73/0x110
> do_one_initcall+0x5b/0x2d0
> kernel_init_freeable+0x2a2/0x340
> kernel_init+0x1e/0x1b0
> ret_from_fork+0x137/0x1b0
> ret_from_fork_asm+0x1a/0x30
>
> value changed: 0x0160 -> 0x0161
>
> Reported by Kernel Concurrency Sanitizer on:
> CPU: 7 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.19.0-rc7+ #219 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_split() with data_race() to silence
> the warning.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
> drivers/virtio/virtio_ring.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index ddab68959671..1db27ee2d89f 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -808,8 +808,8 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
>
> static bool more_used_split(const struct vring_virtqueue *vq)
This patches the split vring format, but does not touch the packed one.
What happens if you run the same test with the packed format? You can do
so by passing "packed=on" as argument to your -device parameter.
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
next prev parent reply other threads:[~2026-01-27 16:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 15:25 [PATCH v2 0/2] virtio: silence KCSAN warnings Johannes Thumshirn
2026-01-27 15:25 ` [PATCH v2 1/2] virtio: silence KCSAN warning in virtqueue_get_buf_ctx_split Johannes Thumshirn
2026-01-27 16:30 ` Alexander Graf [this message]
2026-01-28 8:47 ` Johannes Thumshirn
2026-01-28 9:03 ` Alexander Graf
2026-01-28 9:13 ` Johannes Thumshirn
2026-01-28 10:30 ` Alexander Graf
2026-01-28 10:34 ` Michael S. Tsirkin
2026-01-28 10:38 ` Alexander Graf
2026-01-28 10:48 ` Michael S. Tsirkin
2026-01-27 15:25 ` [PATCH v2 2/2] virtio: silence KCSAN warning in virtqueue_kick_prepare Johannes Thumshirn
2026-01-28 12:28 ` kernel test robot
2026-01-28 22:23 ` kernel test robot
2026-01-27 15:44 ` [PATCH v2 0/2] virtio: silence KCSAN warnings Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=184ced70-f3ec-49c0-9b18-96f0ad044a78@amazon.com \
--to=graf@amazon.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=johannes.thumshirn@wdc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®