Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7162180ybi; Wed, 5 Jun 2019 12:18:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3YPPu3muLRlGfjh7bJYGx/fRebuqCYD5oRVFwdqG1uhHgOt8lYVFVHa1456UsR5a2TePs X-Received: by 2002:a17:90a:d58d:: with SMTP id v13mr12460736pju.1.1559762326776; Wed, 05 Jun 2019 12:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559762326; cv=none; d=google.com; s=arc-20160816; b=NeqT183Ur05jpBCAvwr8TZt67L8uMkJsP4BZ0Jimx1zYTZaanuZSn46iFKDvCzrTca KjvTk1i2gx3OT/FtNS9ASptPvKLOk+3nnMwc6QJ0CJ0oElfzdnj7NCM8b7/kZRJURyAt thryLBsb6p/T1v1z5VfF6xlP9TL5rl9D9UVBa+22d7wPrf0RaJ0T+OJp7I6As/vAhfHl VKWPucAxfywU9A2TGPvyF0q5krk+/2Ad5DQtcN6uPkPl1oF3Jvzp2oZ7QcYmqfKYExRZ UHI28/c4CL4vwYBm32oPTxvzpLyvtvWVjlfCB1Xz++9gXOKcoXwxbc8QIr09vT91vRRW lEXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=dhmtJ4+79vRolYDJuB/HeVo2S5DNUc8fMTsNT6fH0i0=; b=n9TCBlvhTMispFO9mnYkMNUb2c67/SLhTTa0uzHTdp39iWvnm/NkjtsFaKrE00bkwP az+vjpVCusGdrC5FvYIX2dEWwyi/U7fjkMLvZzqYPuCWpLm5ka7Jra6za1RN5JhYRKld ns4JIV6setyHZ6qHYQ5tJIbFpGigQco9nV5JNyvKNVzGphoQ8/Rao19zHbppqtdcVw+t EjWtSao3k41UXfMm1ckMgtgxM+jrUFiQB7d0NflVQ7LmNv2HAC3abLAY/fzBDag/+k1t 3Y4Jcqc9ZwUMJthd9pm7aihESFxTMKVsDx3EbVqTXLivJMFy4pRl6EsRH/tc++QW9Uv3 Yj6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=F8KuVE0d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 124si9323387pfx.105.2019.06.05.12.18.29; Wed, 05 Jun 2019 12:18:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=F8KuVE0d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbfFETRV (ORCPT + 99 others); Wed, 5 Jun 2019 15:17:21 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40758 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbfFETRV (ORCPT ); Wed, 5 Jun 2019 15:17:21 -0400 Received: by mail-pg1-f196.google.com with SMTP id d30so12924593pgm.7 for ; Wed, 05 Jun 2019 12:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dhmtJ4+79vRolYDJuB/HeVo2S5DNUc8fMTsNT6fH0i0=; b=F8KuVE0d725JnKlMiv02aZ4rRXlJ9I/vn2LLG24+latMd3LSnG12/jfOXWJD2X/jbk 8EdRhgr60Iuw8SjKl0AcQ13JsEHBrxj05xHTT75dj0l/Qu1fciOl/d+HNkuaCYIOEq13 lBNXbfnPXZLCgLmFsP+8hO/H4KiCwGHx4gIx38xJEczDJiLNWrsm4gesIV6ahHpEzfhp mdILtmy3Y7HsrggqjBb76Igji2tadfBj7NYuEudnwLCAtianakhgRweW/ElIbbDCWhxN yNwCXa7Nx2JSf+Fefqd4KOAtFk5ThZt/ABiV5ORlNiCi2oyx1dsh3Gm0xthYrz8l5mFt 6B3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dhmtJ4+79vRolYDJuB/HeVo2S5DNUc8fMTsNT6fH0i0=; b=VD6L8g7BNo2EUG7MGDb90MZL+ENTAPT+nmruPZz15KKvaZmrUhdo3kHknhoONrDnTr caGe4OoUtKTMqryfu7nxwdd9N61WKm39Ppj5FImVDEL/hTTzYH/Rrr/Nt94Q4R54uvRP gAnN7s2bviXWt75pIgfabfDZ9VaTU1Liob+pxA2uafygzhkT2BC09VJIS93wQcOtH4nP RNrM0s9xuSoe53ebh0sGCN62lUbhherB3wCz/SSuheY+uLCIyLBKcghV9LagMFrVyiZL Mwh1fd84UGO7CWwHpnl6ELDHLHu7/52JZS9weV2xmRRBaXaD1W+eiYUp5A8Mcr3Lqfn8 oI/w== X-Gm-Message-State: APjAAAXDpjSw/zHq2Et3wlqA3pbzUQRTkHOnEZhaRaqCfBILkEIDEAWX qiuSC1o9aW+9UJY/dZvU1mA6ei7XPj+wDg== X-Received: by 2002:a17:90a:480d:: with SMTP id a13mr45087965pjh.40.1559762240246; Wed, 05 Jun 2019 12:17:20 -0700 (PDT) Received: from [192.168.1.121] (66.29.164.166.static.utbb.net. [66.29.164.166]) by smtp.gmail.com with ESMTPSA id u7sm10218273pgl.64.2019.06.05.12.17.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 12:17:19 -0700 (PDT) Subject: Re: properly communicate queue limits to the DMA layer 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 References: <20190605190836.32354-1-hch@lst.de> From: Jens Axboe Message-ID: <591cfa1e-fecb-7d00-c855-3b9eb8eb8a2a@kernel.dk> Date: Wed, 5 Jun 2019 13:17:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190605190836.32354-1-hch@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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