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.133.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 22BFD37D1B6 for ; Wed, 7 Jan 2026 16:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767803398; cv=none; b=H79Mb0t3Csf5lOg3i6LdvsSB1NIHFnc9c+jpwKPPRRYRKXgoep5xMQBvzLOBmsdefuigk7HZ97nw/rjbkC2+6UeFXLoq7By3gwmZL7BvPAh6T3aHzOMZBtMpUUT5/xrNeJdqrSea4MIXHnRyWlspoN9w8uYUUKW2+myWB/kywVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767803398; c=relaxed/simple; bh=0oAhWnNUCvoYJlR8h3KsHoUFJ6kTwCI1fBKauISCjvU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RBkXLKIZvEGkKk8MkN1vR09KR/CydJu95JhjwhHfRaVxSU72/9i8l3hU0oiDN70li6+dZeH+n4JdKCi1SpwWO29KcTKJIJbv8pz1kKIpzAaLfRzpcyC77k5af43XsBstlwR+MnzDCp/cuRjYXo5V1/VmV8BhD3mlqnMnvwebgyk= 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=UVAD+xdD; arc=none smtp.client-ip=170.10.133.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="UVAD+xdD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1767803392; 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=c8hcqhJufBn494ZuyCMGepJhpX1rw4g16WnIwLV2/F4=; b=UVAD+xdD3hgimZlCz8oTbP5jAqn5pUwrQwYSuHamAPK4A6XLDNesKWyhrBvPVfOPf9nx7d xjN6fdeNCu8l0MPe1PcB7JaIoWuo77B9Kkv1gnYnYt1ocTBfiureZ6ORbNsAyy0pxLUUL6 0JyVaqEM8A/TD3ZnJsNpUCYj1+9B2t0= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-36-p-o-fWEJMiC85iH2n2Af0Q-1; Wed, 07 Jan 2026 11:29:49 -0500 X-MC-Unique: p-o-fWEJMiC85iH2n2Af0Q-1 X-Mimecast-MFC-AGG-ID: p-o-fWEJMiC85iH2n2Af0Q_1767803386 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F17CC1954B21; Wed, 7 Jan 2026 16:29:44 +0000 (UTC) Received: from localhost (unknown [10.2.17.77]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4386B30002D1; Wed, 7 Jan 2026 16:29:41 +0000 (UTC) Date: Wed, 7 Jan 2026 11:29:39 -0500 From: Stefan Hajnoczi To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, Cong Wang , Jonathan Corbet , Olivia Mackall , Herbert Xu , Jason Wang , Paolo Bonzini , Eugenio =?iso-8859-1?Q?P=E9rez?= , "James E.J. Bottomley" , "Martin K. Petersen" , Gerd Hoffmann , Xuan Zhuo , Marek Szyprowski , Robin Murphy , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Petr Tesarik , Leon Romanovsky , Jason Gunthorpe , Bartosz Golaszewski , linux-doc@vger.kernel.org, linux-crypto@vger.kernel.org, virtualization@lists.linux.dev, linux-scsi@vger.kernel.org, iommu@lists.linux.dev, kvm@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v2 10/15] virtio_scsi: fix DMA cacheline issues for events Message-ID: <20260107162939.GA193868@fedora> References: <8801aeef7576a155299f19b6887682dd3a272aba.1767601130.git.mst@redhat.com> <20260105181939.GA59391@fedora> <20260106094824-mutt-send-email-mst@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qt5XKVxNjAL6wL8U" Content-Disposition: inline In-Reply-To: <20260106094824-mutt-send-email-mst@kernel.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 --qt5XKVxNjAL6wL8U Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 06, 2026 at 09:50:00AM -0500, Michael S. Tsirkin wrote: > On Mon, Jan 05, 2026 at 01:19:39PM -0500, Stefan Hajnoczi wrote: > > On Mon, Jan 05, 2026 at 03:23:29AM -0500, Michael S. Tsirkin wrote: > > > @@ -61,7 +62,7 @@ struct virtio_scsi_cmd { > > > =20 > > > struct virtio_scsi_event_node { > > > struct virtio_scsi *vscsi; > > > - struct virtio_scsi_event event; > > > + struct virtio_scsi_event *event; > > > struct work_struct work; > > > }; > > > =20 > > > @@ -89,6 +90,11 @@ struct virtio_scsi { > > > =20 > > > struct virtio_scsi_vq ctrl_vq; > > > struct virtio_scsi_vq event_vq; > > > + > > > + __dma_from_device_group_begin(); > > > + struct virtio_scsi_event events[VIRTIO_SCSI_EVENT_LEN]; > > > + __dma_from_device_group_end(); > >=20 > > If the device emits two events in rapid succession, could the CPU see > > stale data for the second event because it already holds the cache line > > for reading the first event? >=20 > No because virtio does unmap and syncs the cache line. >=20 > In other words, CPU reads cause no issues. >=20 > The issues are exclusively around CPU writes dirtying the > cache and writeback overwriting DMA data. I see. In that case I'm happy with the virtio-scsi change: Reviewed-by: Stefan Hajnoczi --qt5XKVxNjAL6wL8U Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmleifMACgkQnKSrs4Gr c8hcVAf/WNemA8s8X2IEi5T6b93Oq3H7yBSOTyvJIsAVGGG0HMv002nCDfd6Jx88 M5+0cLDN09kY62wqd/Awd8juPCIv0q5bmyWB0WYeHA93QHK4tEHgGv2+hPw4zdDT cfBFbv3nRkHZ/Vmb9qtclA1N93XULyvUn0gLkT2cUms2ZdK+vpqxvGgdZQ/R3pmK 8TgFK8lq1kcUx8mlizEQ4TDb85DBcSr5yB6jrfgMgttm+41mDmOVhJNkkRuLissy z4K/d8xZqWMXCv7p3/l3rrhwOm8kVasQtbKe9LO//3qd8R3Yy+8X7ZORuVW5aPbs HeDfkWgBMGt/hmqL9Fk+OLB7vJqqmQ== =FfpF -----END PGP SIGNATURE----- --qt5XKVxNjAL6wL8U--