From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: properly communicate queue limits to the DMA layer Date: Wed, 5 Jun 2019 13:17:15 -0600 Message-ID: <591cfa1e-fecb-7d00-c855-3b9eb8eb8a2a@kernel.dk> References: <20190605190836.32354-1-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190605190836.32354-1-hch@lst.de> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Christoph Hellwig Cc: Sebastian Ott , Sagi Grimberg , Max Gurtovoy , Bart Van Assche , Ulf Hansson , Alan Stern , Oliver Neukum , linux-block@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mmc@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, linux-hyperv@vger.kernel.org, linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org List-Id: linux-rdma@vger.kernel.org On 6/5/19 1:08 PM, Christoph Hellwig wrote: > Hi Jens, > > we've always had a bit of a problem communicating the block layer > queue limits to the DMA layer, which needs to respect them when > an IOMMU that could merge segments is used. Unfortunately most > drivers don't get this right. Oddly enough we've been mostly > getting away with it, although lately dma-debug has been catching > a few of those issues. > > The segment merging fix for devices with PRP-like structures seems > to have escalated this a bit. The first patch fixes the actual > report from Sebastian, while the rest fix every drivers that appears > to have the problem based on a code audit looking for drivers using > blk_queue_max_segment_size, blk_queue_segment_boundary or > blk_queue_virt_boundary and calling dma_map_sg eventually. Note > that for SCSI drivers I've taken the blk_queue_virt_boundary setting > to the SCSI core, similar to how we did it for the other two settings > a while ago. This also deals with the fact that the DMA layer > settings are on a per-device granularity, so the per-device settings > in a few SCSI drivers can't actually work in an IOMMU environment. > > It would be nice to eventually pass these limits as arguments to > dma_map_sg, but that is a far too big series for the 5.2 merge > window. Since I'm heading out shortly and since I think this should make the next -rc, I'll tentatively queue this up. -- Jens Axboe