[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260107162939.GA193868@fedora>
Date: Wed, 7 Jan 2026 11:29:39 -0500
From: Stefan Hajnoczi <stefanha@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org, Cong Wang <xiyou.wangcong@...il.com>,
Jonathan Corbet <corbet@....net>,
Olivia Mackall <olivia@...enic.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Jason Wang <jasowang@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Eugenio Pérez <eperezma@...hat.com>,
"James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Gerd Hoffmann <kraxel@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Stefano Garzarella <sgarzare@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Petr Tesarik <ptesarik@...e.com>,
Leon Romanovsky <leon@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>,
Bartosz Golaszewski <brgl@...nel.org>, linux-doc@...r.kernel.org,
linux-crypto@...r.kernel.org, virtualization@...ts.linux.dev,
linux-scsi@...r.kernel.org, iommu@...ts.linux.dev,
kvm@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v2 10/15] virtio_scsi: fix DMA cacheline issues for events
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 {
> > >
> > > struct virtio_scsi_event_node {
> > > struct virtio_scsi *vscsi;
> > > - struct virtio_scsi_event event;
> > > + struct virtio_scsi_event *event;
> > > struct work_struct work;
> > > };
> > >
> > > @@ -89,6 +90,11 @@ struct virtio_scsi {
> > >
> > > 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();
> >
> > 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?
>
> No because virtio does unmap and syncs the cache line.
>
> In other words, CPU reads cause no issues.
>
> 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 <stefanha@...hat.com>
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists