Re: [PATCH] block: fix splitting segments

Ming Lei
2019-12-30T01:25:57Z

On Sun, Dec 29, 2019 at 05:15:49PM -0800, Bart Van Assche wrote:
> On 2019-12-29 08:14, Jens Axboe wrote:
> > On 12/28/19 7:32 PM, Ming Lei wrote:
> >> There are two issues in get_max_segment_size():
> >>
> >> 1) the default segment boudary mask is bypassed, and some devices still
> >> require segment to not cross the default 4G boundary
> >>
> >> 2) the segment start address isn't taken into account when checking
> >> segment boundary limit
> >>
> >> Fixes the two issues.
> >
> > Given the potential severity of the bug, I think it deserves a somewhat
> > richer explanation than just that. It should also go into stable. This
> > is what I queued up:
> >
> > https://git.kernel.dk/cgit/linux-block/commit/?h=block-5.5&id=add1fc07334260253dfa880d9c964edc8381deac
>
> Although this patch looks fine to me, seeing Jens' patch description
> makes me wonder whether the DMA segment boundary for the mpt3sas adapter
> should be made explicit, e.g. by setting the SCSI host .dma_boundary
> parameter in the mpt3sas driver? From the SCSI core:
>
> blk_queue_segment_boundary(q, shost->dma_boundary);

See scsi_host_alloc():
...
/*
* assume a 4GB boundary, if not set
*/
if (sht->dma_boundary)
shost->dma_boundary = sht->dma_boundary;
else
shost->dma_boundary = 0xffffffff;

Thanks,
Ming