Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4921345pxy; Tue, 27 Apr 2021 16:04:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl2Dl/+/eGaFUk1eNcfIBRY2EPgUTJqISTsAbsPnVEaS95jSmwuVaDiNYZ3Z4duOiipIia X-Received: by 2002:a05:6402:382:: with SMTP id o2mr7148787edv.370.1619564653793; Tue, 27 Apr 2021 16:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619564653; cv=none; d=google.com; s=arc-20160816; b=hGZk8y0wKdUwwIMKQkpgnaVPm3GDG6yj91zD7Ro9HHB8/1eiF8iG7DIUneXc4ZKwZm 2MfqtPUsByBe2WON56iSt5/K0I97fFkr5XcQMwYNFb42cvuIRRN/AzEeXcgJ1ZD6hedF saIBvkg9qN/1llIfM7G93CkKilDSYVvgByJookTqO1KMs7pSanSTs25vH+mlG3vAlY0Z dKOTwxJQvnAIZj0iKId8k9kGwvcKL7LoJfxr4RIxUoD8iDg5cZnsQctRAJzIWt0+IUsR Q1y+oN3CJV8L0VuQihPfX1q4q8m+ea2eTl99i30spREAXPIfoBs1+vRnIpcK7RzTxtm1 qzFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:dkim-signature; bh=RGdRC5FBlsTWfpWtOgCpYwh/6l+bY/lLU227Fr0Oa7w=; b=RQ/GHDSQuoyK1dPpsgJMdcNGP0khSWiKiG7ECdNMWjNGJOkiI7PgEbsH6XTSCHbd01 4KLv2HuPDtGSd10Kyu70iV3q2GdF+yvH1L6RkLK1mN3vbyo5CUvAz5HLq7J1iPkzc0Wq y/Dac3nUxo7Xi6wIrOn+AToSNvkcjk+frDGya0c2rywJNXQCCR8glBCFLOr7Klq5N9t/ Wz6eQpUwqjhjlbp9OHyYx7kkJhQg2b03iFWLGbGVIloPLxDMxeHtwdVj0f4KTnfLsdVA QixnGZHh3sL6WxCpGiK3LCIYnQyYgm7PoHgf+evuwSMSIx15a4Vija2t0w+hDgxBOaao infA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=e1cQkHUi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si1007047ejt.513.2021.04.27.16.03.50; Tue, 27 Apr 2021 16:04:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=e1cQkHUi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239317AbhD0XAw (ORCPT + 99 others); Tue, 27 Apr 2021 19:00:52 -0400 Received: from ale.deltatee.com ([204.191.154.188]:42848 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235382AbhD0XAv (ORCPT ); Tue, 27 Apr 2021 19:00:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:content-disposition; bh=RGdRC5FBlsTWfpWtOgCpYwh/6l+bY/lLU227Fr0Oa7w=; b=e1cQkHUii+OnXHxuzyVnv2FOWU yRhslccFTPCSUZBHv6r9i2BtLYMYFFuNX+vj1xNOq/lXobsZ3eYFuedGTORJxwDIMCEh7Qthqs1Q7 RVxgzfvWzK3UWw1HMRbfVYTe3vQzXRIV/ILbih4akY/evNrEaGCAlfgG+L3AXOME+jur1eJqyKhD1 TMGSqOXU7r9XcMpgA/2JBpdbNNP7X3lLSbdPwHl2H10OkRWO75ot4KGzAuXd2ZJB/tmfOyTGaMv6M ae+aEYfgGtkGVcUSMzK45Ps6AhzhkNnGarVg7/1Ky1Fn+SEciywNHOIOcE/kvvy4C616xFskQ500w hxifV8fg==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1lbWgQ-0002oO-8N; Tue, 27 Apr 2021 16:59:59 -0600 To: Jason Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Christoph Hellwig , Dan Williams , =?UTF-8?Q?Christian_K=c3=b6nig?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Jakowski Andrzej , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy References: <20210408170123.8788-1-logang@deltatee.com> <20210408170123.8788-15-logang@deltatee.com> <20210427194753.GU2047089@ziepe.ca> From: Logan Gunthorpe Message-ID: <6e78cdc8-8189-b778-20b4-7a108e28e557@deltatee.com> Date: Tue, 27 Apr 2021 16:59:57 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210427194753.GU2047089@ziepe.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: robin.murphy@arm.com, ira.weiny@intel.com, helgaas@kernel.org, jianxin.xiong@intel.com, dave.hansen@linux.intel.com, jason@jlekstrand.net, dave.b.minturn@intel.com, andrzej.jakowski@intel.com, daniel.vetter@ffwll.ch, willy@infradead.org, ddutile@redhat.com, jhubbard@nvidia.com, christian.koenig@amd.com, dan.j.williams@intel.com, hch@lst.de, sbates@raithlin.com, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, jgg@ziepe.ca X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_FREE,NICE_REPLY_A autolearn=no autolearn_force=no version=3.4.2 Subject: Re: [PATCH 14/16] nvme-rdma: Ensure dma support when using p2pdma X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-04-27 1:47 p.m., Jason Gunthorpe wrote: > On Thu, Apr 08, 2021 at 11:01:21AM -0600, Logan Gunthorpe wrote: >> Ensure the dma operations support p2pdma before using the RDMA >> device for P2PDMA. This allows switching the RDMA driver from >> pci_p2pdma_map_sg() to dma_map_sg_p2pdma(). >> >> Signed-off-by: Logan Gunthorpe >> drivers/nvme/target/rdma.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c >> index 6c1f3ab7649c..3ec7e77e5416 100644 >> +++ b/drivers/nvme/target/rdma.c >> @@ -414,7 +414,8 @@ static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev, >> if (ib_dma_mapping_error(ndev->device, r->send_sge.addr)) >> goto out_free_rsp; >> >> - if (!ib_uses_virt_dma(ndev->device)) >> + if (!ib_uses_virt_dma(ndev->device) && >> + dma_pci_p2pdma_supported(&ndev->device->dev)) > > ib_uses_virt_dma() should not be called by nvme and this is using the > wrong device pointer to query for DMA related properties. > > I suspect this wants a ib_dma_pci_p2p_dma_supported() wrapper like > everything else. Makes sense. Will add for v2. Logan