[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190114202223.GB10781@lst.de>
Date: Mon, 14 Jan 2019 21:22:23 +0100
From: Christoph Hellwig <hch@....de>
To: Robin Murphy <robin.murphy@....com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>, Jens Axboe <axboe@...nel.dk>,
brijesh.singh@....com,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
jon.grimm@....com, jfehlig@...e.com, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
linux-block@...r.kernel.org, iommu@...ts.linux-foundation.org,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 0/3] Fix virtio-blk issue with SWIOTLB
On Mon, Jan 14, 2019 at 07:12:08PM +0000, Robin Murphy wrote:
> Now, in theory, yes, the real issue at hand is not unique to virtio-blk nor
> SEV - any driver whose device has a sufficiently large DMA segment size and
> who manages to get sufficient physically-contiguous memory could
> technically generate a scatterlist segment longer than SWIOTLB can handle.
> However, in practice that basically never happens, not least because very
> few drivers ever override the default 64K DMA segment limit. AFAICS nothing
> in drivers/virtio is calling dma_set_max_seg_size() or otherwise assigning
> any dma_parms to replace the defaults either, so the really interesting
> question here is how are these apparently-out-of-spec 256K segments getting
> generated at all?
drivers/block/virtio_blk.c:virtblk_probe():
/* Host can optionally specify maximum segment size and number of
* segments. */
err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX,
struct virtio_blk_config, size_max, &v);
if (!err)
blk_queue_max_segment_size(q, v);
else
blk_queue_max_segment_size(q, -1U);
So it really is virtio_blk that is special here. The host could
set VIRTIO_BLK_F_SIZE_MAX to paper over the problem, but I really
think we need a dma_max_segment_size API that is wired up through
the dma_map_ops to sort this out for real.
Powered by blists - more mailing lists