Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4070575imm; Tue, 25 Sep 2018 10:48:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV60+Vp+V9QRZsdLOgqlX8jPH1y/plzcB1cWrhCsyGKEG8BEGruom+/Q13BEbGrgjdPT7YRQ5 X-Received: by 2002:a17:902:8605:: with SMTP id f5-v6mr2087603plo.271.1537897699321; Tue, 25 Sep 2018 10:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537897699; cv=none; d=google.com; s=arc-20160816; b=y8S3HI3PwFtr/AWL/db8LcvZUxTfKf1aMV4EN1mi8l6WElejR6tfyBtA5v+4QsWixK UOFHXJhEONYUKGF2zTWAM0NvyFx5wDbdmavBls/T5ZfX16HhVFj8o+y0qgM3SMI2gEmH jZGhHyIhhrOlUvEsw55nRcPdZtFGk8OdqoxHWQPQKXBq9erfwWoTkBXSRRSzYMe8ixEH ZRd7+pJx6hoWdukzeSmm72ssz551aC7CaN8gL3DM2zYTebwnmRklxWJHlnwNa1rinBk0 7ns/VydHyi5n1RPbn3JYjODfaPf67J6QQuDvlIISsAJk3lH9o3R/oZ0KXocCfDHkkp4e En9Q== 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=K5+JFGE9y32ky5nPnen/rLWCsEuXkbipqPQC4sZ7cHU=; b=MBrVSsEdIJrUW0OBuek5+PaDzdoi0RRrrRT2OROdrw/zX1EL3EL6qOuRteHYIi0f5o oLUhZ/K07pvHp491LE/sV8PnAA+Bydy5Bfjw8sU0UDnoiCayRtKxUPp8PUSiurXSbGPi 593NAt8W14JpEWVN9dKQ1ofQf/Rjgvhe+p4dsmUi/5+wbtBbYaIg9CyUs7dVstE8gr24 ljjj/w4wnHE6FhRwIIl7aMwjiX7JhUf8UoMgTMl1OhE/hNt3RiIIuxt9p8zCd22qzCq8 rHDpYm8LjIG6BdFkj/KbD6lHQFkRNuGcrIql2vjP/8ktx87RYLRXUrSApNxvx5RS6PGs z1dg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29-v6si3080013pgz.215.2018.09.25.10.48.03; Tue, 25 Sep 2018 10:48:19 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbeIYXz6 (ORCPT + 99 others); Tue, 25 Sep 2018 19:55:58 -0400 Received: from mga03.intel.com ([134.134.136.65]:2002 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725918AbeIYXz6 (ORCPT ); Tue, 25 Sep 2018 19:55:58 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2018 10:47:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,303,1534834800"; d="scan'208";a="86469192" Received: from unknown (HELO localhost.localdomain) ([10.232.112.44]) by orsmga003.jf.intel.com with ESMTP; 25 Sep 2018 10:46:29 -0700 Date: Tue, 25 Sep 2018 11:48:35 -0600 From: Keith Busch To: Logan Gunthorpe 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 , =?iso-8859-1?B?Suly9G1l?= Glisse , Benjamin Herrenschmidt , Alex Williamson , Christian =?iso-8859-1?Q?K=F6nig?= , Jens Axboe Subject: Re: [PATCH v7 10/13] nvme-pci: Add support for P2P memory in requests Message-ID: <20180925174835.GA12185@localhost.localdomain> References: <20180925162231.4354-1-logang@deltatee.com> <20180925162231.4354-11-logang@deltatee.com> <20180925171147.GB11822@localhost.localdomain> <3549a9bb-3604-1739-c008-4e1a95441333@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3549a9bb-3604-1739-c008-4e1a95441333@deltatee.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 11:41:44AM -0600, Logan Gunthorpe wrote: > 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. Gotchya, thanks for jogging my memory.