Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6793907ybi; Wed, 5 Jun 2019 06:32:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqziLW7d6WFvIpTyeph9XKu7p5eJ2Z6ZK/hb7zHadvfa/jX0EjG3MUmMPs0omqvGAq6AKnzd X-Received: by 2002:a17:902:7e0f:: with SMTP id b15mr35256951plm.237.1559741532849; Wed, 05 Jun 2019 06:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559741532; cv=none; d=google.com; s=arc-20160816; b=zINcklrKs8iaSZvsPB2YwfeHwzBd5WYpNluQnLTjBXwAduE9ImJe/QGObrzcC+QMcu Q8rHCSZhtzu+IvpwLSc6XQPXjky61zDrUYooW7aXMpNojVwaXXeK/i8emtKh3r2jW1yY eyGSdI/bClP10uhP1jWrShp1rUlnLbcpXmrf70q1F1OL8FP40Qo+TIZ6JbFmkhHUhJ79 KNengoS25RoE5DilbzM9v899RT/bQaGEQbUW7u1a1DbX5T4ZsOjsjERnwoSPxiVjaML+ sqGGKvrab3fgtJzu91Xza3jaSI+NrOVo5vOEzajqBJjOh7MkvVUCKntsrzo1h93y7XUA GKzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RsGvgRn2eZFwysntUL8QR1LbqV7twicwOpQF9Ie7BVQ=; b=A48w045dBcamPhmQTlRqPNYsGpPds5ySTt7Eo5DcaAdDIPb9j0mbjp0OjzAXDCivbF f8jOZI9CnKHER/ugxluCzr537j4Im5s69fV4XmvZpTd081rPHaVyifhYbJSKoQ8+ofzB jqMj+XCiWu/j18L7DHm8wmcGbM9kTf9wuSaumkH5SqgpuEJhiUYcH5DODK+eqfahoYIR z4LFfv1fwEr0irDkGG79hyYUTn5V3rE1MYU8nfv5rD34qcA13vHY7oEwZvBiAF5V2n7f /bLbmQHJey8A28PVL0O54uWqKNNHR0ohfzHWGoByrizFRh5j1Mwga6rgejPrK+WQBcoC fTqQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h68si26359704pgc.270.2019.06.05.06.31.53; Wed, 05 Jun 2019 06:32:12 -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; 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 S1728019AbfFENad (ORCPT + 99 others); Wed, 5 Jun 2019 09:30:33 -0400 Received: from verein.lst.de ([213.95.11.211]:43006 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727601AbfFENab (ORCPT ); Wed, 5 Jun 2019 09:30:31 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 43E3E227A81; Wed, 5 Jun 2019 15:30:03 +0200 (CEST) Date: Wed, 5 Jun 2019 15:30:02 +0200 From: Christoph Hellwig To: Sebastian Ott Cc: Christoph Hellwig , Ming Lei , Hannes Reinecke , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: too large sg segments with commit 09324d32d2a08 Message-ID: <20190605133002.GA13368@lst.de> References: <20190605100928.GA9828@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190605100928.GA9828@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Actually, it looks like something completely general isn't easily doable, not without some major dma API work. Here is what should fix nvme, but a few other drivers will need fixes as well: --- From 745541130409bc837a3416300f529b16eded8513 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 5 Jun 2019 14:55:26 +0200 Subject: nvme-pci: don't limit DMA segement size NVMe uses PRPs (or optionally unlimited SGLs) for data transfers and has no specific limit for a single DMA segement. Limiting the size will cause problems because the block layer assumes PRP-ish devices using a virt boundary mask don't have a segment limit. And while this is true, we also really need to tell the DMA mapping layer about it, otherwise dma-debug will trip over it. Signed-off-by: Christoph Hellwig Reported-by: Sebastian Ott --- drivers/nvme/host/pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index f562154551ce..524d6bd6d095 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2513,6 +2513,12 @@ static void nvme_reset_work(struct work_struct *work) */ dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; dev->ctrl.max_segments = NVME_MAX_SEGS; + + /* + * Don't limit the IOMMU merged segment size. + */ + dma_set_max_seg_size(dev->dev, 0xffffffff); + mutex_unlock(&dev->shutdown_lock); /* -- 2.20.1