public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: virtualization@lists.linux.dev,
	"Jason Wang" <jasowang@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Alexander Graf" <graf@amazon.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] virtio: silence KCSAN warnings
Date: Tue, 27 Jan 2026 10:44:50 -0500	[thread overview]
Message-ID: <20260127103716-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20260127152524.200465-1-johannes.thumshirn@wdc.com>

On Tue, Jan 27, 2026 at 04:25:21PM +0100, Johannes Thumshirn wrote:
> When booting a Qemu VM whith KCSAN to debug filesystem races I
> encountered a bunch of KCSAN splats in virtio.
> 
> All of them are false positives, as the racy unknown origin is the
> hypervisor.
> 
> Alex suggested to annotate the vring structure as racy for KCSAN, but
> the __data_racy annotation turns into "volatile" and as such it cannot
> be used to annotate the whole structure. Annotating every structure
> embedding a pointer to the vring turned out to be way more invasive than
> annotating only the few sites consumers.

Oh wow and I learned Linux has

# define auto __auto_type

which then allows auto in G11:

#define data_race(expr)                                                 \
({                                                                      \
        __kcsan_disable_current();                                      \
        auto __v = (expr);                                              \
        __kcsan_enable_current();                                       \
        __v;                                                            \
})




> Changes to v1:
> - Annotate the return of more_used_split() as racy so both call sites
>   are covered
> - Annotate vring_avail_event() as racy so we can condense two patches
>   into one.

Acked-by: Michael S. Tsirkin <mst@redhat.com>

I will pick this up.

> Link to v1:
> https://lore.kernel.org/virtualization/20260127083926.865555-1-johannes.thumshirn@wdc.com/
> 
> Johannes Thumshirn (2):
>   virtio: silence KCSAN warning in virtqueue_get_buf_ctx_split
>   virtio: silence KCSAN warning in virtqueue_kick_prepare
> 
>  drivers/virtio/virtio_ring.c     | 4 ++--
>  include/uapi/linux/virtio_ring.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> -- 
> 2.52.0


      parent reply	other threads:[~2026-01-27 15:44 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
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 ` Michael S. Tsirkin [this message]

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=20260127103716-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=graf@amazon.com \
    --cc=jasowang@redhat.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --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