Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4064836imm; Tue, 25 Sep 2018 10:42:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV63AEA6ht17Q1qCgSi8pMUrpzb9Q7JVySv6X3gfy3Vy2ZzzE5fuZvbPE7esUrQyA8b/jzP8u X-Received: by 2002:a63:f309:: with SMTP id l9-v6mr1960797pgh.369.1537897345068; Tue, 25 Sep 2018 10:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537897345; cv=none; d=google.com; s=arc-20160816; b=rtdruMFGFNfMR/ns+Hyx9mQHNH3/R9coh9diBWDqUZ6SqX/8kES5WDYTgZzxPdEScf nxdGV1trNfjU4dfNQhpe9wqyCBf72M/13jvBmS2Tj542J270b4aZcQxptkiHKgHjXpRn metb/RAMX38jIO3PFolz+6NC/UJ6anyXSCUK79H63TFqs+3rhNC+MDFld1yY6NF/iubi HtV5eaNfORS+8Yy20J6SoOBD8VP/w86iiR84ui40EHALa0aQ2Few2pFK1ntnwzZd3HcP 9FeqxtUKgz/iglj1e7T5J5G53Lh+mO9ENxBkmmRsSJYQPP9cXlWtB/4Io7QOCg1RPglh op7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to; bh=dasyFtDevj+IDX76cYKTZr1b8OcCmS26cnHeOfO4T2k=; b=Z1LBjUU+1eq1+nY+WtpLZzEoeqOBuINq1c/XEnX9btg1TAT5pjrFe2eP8MVqYFsZ1m K5Vb8Wgq6WYcBhhBtZTTStX0Auv9+1BGCH+TRH/V9fjUJJeUW+PzMQcTgIxVsCOI/QMW R2kHrnwF1LmrgNZADzUYKWEt14SyOwE2MY5CwsIH+w8l5cMM7Upb/u2mDtjfbhEx2px/ YSPGKzZSKoOimF4rUZ1aM7/0nwtIQycDjw8yO4qZSsAjDpAnYf9PZkCYZoD9CPWgJgGN P54LWQoSxHlmhQuJb/alaqSb6P2x2r6ujedh7gQnI8cTbT3MHdJrPYM0OM/fHSqrjE8F y9Vg== 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 e2-v6si2782047pfh.64.2018.09.25.10.42.09; Tue, 25 Sep 2018 10:42:25 -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 S1727037AbeIYXui (ORCPT + 99 others); Tue, 25 Sep 2018 19:50:38 -0400 Received: from ale.deltatee.com ([207.54.116.67]:43588 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbeIYXui (ORCPT ); Tue, 25 Sep 2018 19:50:38 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1g4rLI-0003cH-NV; Tue, 25 Sep 2018 11:41:50 -0600 To: Keith Busch Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, linux-block@vger.kernel.org, Stephen Bates , Christoph Hellwig , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Benjamin Herrenschmidt , Alex Williamson , =?UTF-8?Q?Christian_K=c3=b6nig?= , Jens Axboe References: <20180925162231.4354-1-logang@deltatee.com> <20180925162231.4354-11-logang@deltatee.com> <20180925171147.GB11822@localhost.localdomain> From: Logan Gunthorpe Message-ID: <3549a9bb-3604-1739-c008-4e1a95441333@deltatee.com> Date: Tue, 25 Sep 2018 11:41:44 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180925171147.GB11822@localhost.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: axboe@kernel.dk, christian.koenig@amd.com, alex.williamson@redhat.com, benh@kernel.crashing.org, jglisse@redhat.com, dan.j.williams@intel.com, maxg@mellanox.com, jgg@mellanox.com, bhelgaas@google.com, sagi@grimberg.me, hch@lst.de, sbates@raithlin.com, linux-block@vger.kernel.org, linux-nvdimm@lists.01.org, linux-rdma@vger.kernel.org, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, keith.busch@intel.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH v7 10/13] nvme-pci: Add support for P2P memory in requests X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey, On 2018-09-25 11:11 a.m., Keith Busch wrote: > Sorry if this was already discussed. Is there a reason the following > pattern is not pushed to the generic dma_map_sg_attrs? > > if (is_pci_p2pdma_page(sg_page(sg))) > pci_p2pdma_map_sg(dev, sg, nents, dma_dir); > > Beyond that, series looks good. Yes, this has been discussed. It comes down to a few reasons: 1) Intrusiveness on other systems: ie. not needing to pay the cost for every single dma_map_sg call 2) Consistency: we can add the check to dma_map_sg, but adding similar functionality to dma_map_page, etc is difficult seeing it's hard for the unmap operation to detect if a dma_addr_t was P2P memory to begin with. 3) Safety for developers trying to use P2P memory: Right now developers must be careful with P2P pages and ensure they aren't mapped using other means (ie dma_map_page). Having them check the drivers that are handling the pages to ensure the appropriate map function is always used is and that P2P pages aren't being mixed with regular pages is better than developers relying on magic in dma_map_sg() and getting things wrong. That being said, I think in the future everyone would like to move in that direction but it means we will have to solve some difficult problems with the existing infrastructure. Logan