[lkml]   [2019]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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?


/* 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);
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.

 \ /
  Last update: 2019-01-14 21:22    [W:0.144 / U:1.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site