Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2461562ybi; Mon, 17 Jun 2019 05:20:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMrat7WiyzduT9LUlVEadtLdD7+ybKQhD0CTYLzjQgZD5jirqdRMqpY1ZFsOgLikNURgxJ X-Received: by 2002:a17:902:b594:: with SMTP id a20mr28780234pls.259.1560774035283; Mon, 17 Jun 2019 05:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560774035; cv=none; d=google.com; s=arc-20160816; b=iuouPwqk7WW2gqqzMDR/njUgwiEE7QD/VsWTsluDQzwNOWM77yTAY70sOduoLI3KW7 xMaS3bspnqxKHNFdeu+3ywzm2hFb89c2fFqPEVtnxpayZlDZwTdSozKWXcPLcAt3+zgd y5BI031hRkqxMFZLA4WSbwM1vkf17VJJGSczbph5tx3VKhhyVHK0IL1p/4CaohaE2LPc qzO9vi//BVoDoK6hn2YNjhaJAxTQG7K2ST4iOYkLe/wBX0sZiRcG0PPKnQJWlOmLfynX IZTMYyCxXTXsvDjc6onInW2xb2ZSR7WikjPvX+jR0vw2JzsgC7WMn2NhndYg8s5Dt0it BkqA== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Q5UXmR+68j/d4kmwjkqm57NnYDn0QLnoBNJzOKhpq6Y=; b=CcyOmP4vBfodbTOF0+6jKdgmxDwh0GvHu6WbFEPgCYTlZmAsyiwnRbsxyv+C5kV484 IQlzgZWTdD00LaylZLJU032YCwCRniKs1hpamVQfsd5VEN/hEpMqmS3uMz0NTuG6/yOL w6G2W4r9VfvZuSVDLEHxe/yoUoRIPh6MijCHLjsbXjAJogW3XCYoJGwuysC63sWQRQsn Bol3kIGYNSPuuBjwLxAX3+zlb3o4fN7VGAebZqmelV3W2fL2YKuJMVcTXtbd/X4Xupef Ge7E9Wa/DLhIsJTy3m+by5JKgdbSCuoJ+ynOwA0cTAkoY5lYTNhcNPGQ5mJaGz7M3JE3 SYeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZCMzeUB9; 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 g9si10760905plm.207.2019.06.17.05.20.20; Mon, 17 Jun 2019 05:20:35 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZCMzeUB9; 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 S1727377AbfFQMUP (ORCPT + 99 others); Mon, 17 Jun 2019 08:20:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59180 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725983AbfFQMUO (ORCPT ); Mon, 17 Jun 2019 08:20:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q5UXmR+68j/d4kmwjkqm57NnYDn0QLnoBNJzOKhpq6Y=; b=ZCMzeUB9iCTNxyQRc2KJsJUxv KZMdK33r/L1JCOJ0WcAJ0Gwg4UhVodgV/zTyCErj6/1jXfPNXecsBB26ArJ9tImZGgHLIIZd3qKhT 0TXGfdx2yqDOBoXlCiMizmXNkHhARuwEuA/seQChXpZDVALQIMgkw4HX2/4F8mpuFwMV8uUkIz+SJ NzSnSvwV8oALS8Skqq3GyUo3TfOQnk9ZwdQoOdvXBRR8D6Xuse7IjzMFyKQdPgpM26TI0GpnsCPMS ucE/phcgLfZWajV9g/9OC1xdBHIc0m6l+VvuTplyxVKvjzBOh/r9sbuZKMvh1edPGFXGNo/sVJh7I jhQ9pXZZQ==; Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hcqcG-0003eR-GJ; Mon, 17 Jun 2019 12:20:04 +0000 From: Christoph Hellwig To: "Martin K . Petersen" Cc: Sagi Grimberg , Max Gurtovoy , Bart Van Assche , linux-rdma@vger.kernel.org, linux-scsi@vger.kernel.org, megaraidlinux.pdl@broadcom.com, MPT-FusionLinux.pdl@broadcom.com, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: properly communicate queue limits to the DMA layer v2 Date: Mon, 17 Jun 2019 14:19:52 +0200 Message-Id: <20190617122000.22181-1-hch@lst.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Martin, 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. 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. Changes since v1: - dropped block layer parts merged by Jens - dropped the usb-storage / uas changes, as the virt_boundary usage there will be dropped soon - reworked the mpt3sas / megaraid_sas changes to keep per-device settings