From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 400572FF679 for ; Tue, 27 Jan 2026 15:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769528699; cv=none; b=TpPxqj6giQghINnnBpGKw8qlAj3BvDyJewwHnFs7FoJl9ZQ1237J0d0ytFjiIAU0eWwnmR5PQ+cWj1km1P1O9hBZ7FyKwlcPeH8SFzAi5bFeiJJ7djwZQo7fs1E8+VfZoIU/i+0E0ZowL3gHDRGUjY9ZZMAMUCSyg1uq6usML90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769528699; c=relaxed/simple; bh=sLmzmH4e/VfXRHODrx8No2fcI0r5Vx/h67NeYOL4N9E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QcHwcBIck0mVXEATui+HQYLkrtV6AI88UiRW0pW0CB0HtIc43w2DfJ+K/4X+nK4JVh0SnPVP6RQ39tOqD/hbxDPKiz8tzt+/+zMs9NfwKykyQf2ne2YV2x/1of0znmPnL8/lk1n+4Hz3ijOrbguZ6W/JYZaQnGJbPkyN5ZAlZsc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=a3axA+sy; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=R2bDq/uZ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="a3axA+sy"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="R2bDq/uZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769528697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uSgfBKSWshfFn7p2hhbUKCj8+h/hZZzyQsPoCFT+MfQ=; b=a3axA+sy90m+8HC3y6xZaF5LpaHOWJ8kSSUH63dxt0fyUA4uVbkS2c3aoGGyserndwuk// zOqx9cJUX5UXc9kT8uoX8z/YA8BLE4Rt5k3lEeqc5J8ARFYKul01wdz510ofWRKsCnxUDH SgJQThBHLsuNLX2Ar2jIzV3y2vEyD2s= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-625-hgtNJ-UXNtSE2y-HoYc_Ig-1; Tue, 27 Jan 2026 10:44:56 -0500 X-MC-Unique: hgtNJ-UXNtSE2y-HoYc_Ig-1 X-Mimecast-MFC-AGG-ID: hgtNJ-UXNtSE2y-HoYc_Ig_1769528695 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4359d70faa2so3803120f8f.1 for ; Tue, 27 Jan 2026 07:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1769528694; x=1770133494; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uSgfBKSWshfFn7p2hhbUKCj8+h/hZZzyQsPoCFT+MfQ=; b=R2bDq/uZbw93T951ZWTq3Y8opGyWOWcNtStoFlFdnrX0DlQSwQA2073KKSgsYA+t4k GevjDz0nno1yQi4LgIXlDC7scKRFAbU6ETN0SDY2o5zAF19O57w9/zKn5sVenQP/ZuBj BFvzdVNY3HaIh/vfeCNPz2I1o/Ucu6eYEXFli6GwLCasVDBLIQhte8ac/daksSbzXWH/ pOZEGsbZHD4OZNtUxb+trAxJmohKn8tXRJr0J5R9oKb+xSll+hCPeFKQJ1wPb6HEpix1 +cD8w8ghzUGoA0NhxX7xBjPFBz8eZZZvyTZSvSSKYkJBKZb5z87A/2X7uCt1R8PqglRZ uHVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769528694; x=1770133494; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uSgfBKSWshfFn7p2hhbUKCj8+h/hZZzyQsPoCFT+MfQ=; b=uKdH6XkfqkVR9cPeOMxzEVlq8Cg+PHv22aJe1+H2qM7wWvlF5ndiETfx6d2+3TPqFF xp8xhKPsa7Ouwrk8BTcVTnRFTGsu+g2qLbZjgkRLDiDmDYoTLOfPhC0Oqh3OL2DZoZus 8HbhgWkGH5hMJ9czgdke389s2ZA0DMihcR5rKRQ3XAH0ggTkTOMhh9JxiBMeIL6zlRBt NFI1pcKXLD+L1WJl+c+k2f6PDUHQ0vn4s5eOv07Jso6Fj+LNaF4pwWPUwfddcUnDjztm 51Z3ynbekJJnzn6AHiQ3OAAyXwe3vJeLJC5OgG+3vlzMlcTGflVSb7S+JJdOGlX+Y9Y0 4KWA== X-Forwarded-Encrypted: i=1; AJvYcCVDQpLzZ4+p3Spma2NvXXJybYlJl2uC6HODBmQsH8Q6tQmPxVVYAp1KeKpfYKXyg85kdLgpr/CD91aV8Q8=@vger.kernel.org X-Gm-Message-State: AOJu0YyyvyyPhISLZ7JDqvcxNRdGWSFOnZwlrKVYASe+Zr1Cr0WBe2Bp wwWMrmWIiJ6zsumM0lOqkgbXClLngzAOsefABGJ/VC5PDF+1PULsqGau4IRoCD/7d3UfmFCxoUS DEMwSnTCo0B7y7DfAlSYo4XLy2HVYHO7ihaGu4dHfQMED2HhNquVTSulz8KV2E2SSRGzikA/zHC rD X-Gm-Gg: AZuq6aI0YRnu0IK6eFwSQOcIka3Kzzrh1wYr3IN42eeVNlnigPbVy7N6uRprYYz2NNA Z1ByPrMj9eDjVgsBDu/WBi8KHiO6dsKU6qp2ez9vVy/ik2+n7duM8PySrEr+kPNs7/7OFNvQhTf NOuXXrSUTGtd1x/pvXME14Ht0IgP8v81YwYy8fqriK5Dr5NhBaZuEqL2Lx+ikJ/qiJWMWMWPfXx Ft9pgC9HtlnjpaCiAxNPSRQCyeUyCcqv3YTZ6ZyhZijng9EwqZtPDPj4P//SBCTVzMy7IGJ6qYN nZx50Fi9498XrSMRFYoBI5aRsecsSgdNb0SWBGcpBRddWgXw0rOgP7VfC/ef1Nj4Bd4zJlgfh/Z SVsfLJpzDZUJp1vnozvVXVR6Bn8qtnEi79g== X-Received: by 2002:a05:6000:1ac6:b0:435:99d5:9d8f with SMTP id ffacd0b85a97d-435dd06f1aemr2964837f8f.19.1769528694455; Tue, 27 Jan 2026 07:44:54 -0800 (PST) X-Received: by 2002:a05:6000:1ac6:b0:435:99d5:9d8f with SMTP id ffacd0b85a97d-435dd06f1aemr2964801f8f.19.1769528694023; Tue, 27 Jan 2026 07:44:54 -0800 (PST) Received: from redhat.com (IGLD-80-230-34-155.inter.net.il. [80.230.34.155]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1f7474csm39912950f8f.37.2026.01.27.07.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jan 2026 07:44:53 -0800 (PST) Date: Tue, 27 Jan 2026 10:44:50 -0500 From: "Michael S. Tsirkin" To: Johannes Thumshirn Cc: virtualization@lists.linux.dev, Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Alexander Graf , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/2] virtio: silence KCSAN warnings Message-ID: <20260127103716-mutt-send-email-mst@kernel.org> References: <20260127152524.200465-1-johannes.thumshirn@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 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