Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp32164imm; Fri, 21 Sep 2018 09:50:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZhxBe+Cr6VavAAAN3LSH3Vv0Zoe/FmKiPk9zs5O6umo3zQ5stFrsN/M4vQ2dDGMUZuylo8 X-Received: by 2002:a17:902:76c5:: with SMTP id j5-v6mr45276126plt.140.1537548610976; Fri, 21 Sep 2018 09:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537548610; cv=none; d=google.com; s=arc-20160816; b=UNyNDLL+sr6KFtSrOUSZgtF372We52BzFlQr3/Q5+e070lXbSEjhTLYisfSnb0Zn67 cf76GlLN6/pAPAZbxbMWnukafWZEiUNoy3+d9A2ri4827sltibikJ+gXqYcLklw+XlM5 e3CJg90EAEWm7bdg/iAIusvyKcXYGNGZI5j/Zqf/edZEwKmJ7E3sz4yY/Bw2PXgAi2bY R+yajNhc6+yACdBOELpO8socRS/foK3u5DF8jYe3DIuBdRonrbthX7d9tuhr6/0Qh3c1 oT7k+uzDeuLdfxmgYSmSFRO2mEjjPjcIM73HXiqzLeGiadNJHvSssTouCXAzfh0UB5Dh QOZg== 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:dkim-signature; bh=/DWVRay6muMi/fFrU6SzkA2fopvy1bpn9DLbqdec5Mo=; b=ybHD23uXU8gU/aoD5K7IuVFVCfxErkhJf9FdJ+SQ4UAu6t/5Guuf4sY9uPYOvDrFwz yqaACo/VHcBCqcehFyMFkEqGZa9uG3o5LGxGLLfavwqpgGFcqw1mnFQU6jRqv+qsLzDZ uuYgSOl7ac2OkX1Czyg+L1+Qf1ahSqbk2+mBTUUID4Vrh/L0EndCbGyH+a3VvV/i9BBJ KjN5l39QohGZwjVYyC0ArMOmYsdjqDy7JB55ZphsZt+xV/JhcbnxcxUOkOU9EQZO0Otm wql0YIjns3ilKU/VP7sMPHDsWE8E/kuvl7vnngEYZaP1YkHbQiQ7NCSuuvTQV5NW0QeT 5v+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Hwu9wvW1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20-v6si22397363pgk.207.2018.09.21.09.49.55; Fri, 21 Sep 2018 09:50:10 -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=pass header.i=@kernel.org header.s=default header.b=Hwu9wvW1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390781AbeIUWh6 (ORCPT + 99 others); Fri, 21 Sep 2018 18:37:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:42624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390415AbeIUWh5 (ORCPT ); Fri, 21 Sep 2018 18:37:57 -0400 Received: from localhost (unknown [150.199.191.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E145921565; Fri, 21 Sep 2018 16:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1537548494; bh=NB80ZvOh4YQqHfMJmQ4hYag9UWb+rjpX8+eT5pv2gr0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hwu9wvW13Go+uvuZ+ANfMpGXpRGRGW1bKFGLbU5hYmwS5QBfC2z9FjLV6q2gsHLkO Pxg/ubwh87LW8ZIlx2X8JUg62O5FFLT/dnXpV/jQllnEdUI9HUAowiwZC5YNBqZBsS YbZh6p58w5kf3zBSyvBwwOSlJxIfzCRRwFnQULHo= Date: Fri, 21 Sep 2018 11:48:13 -0500 From: Bjorn Helgaas To: Logan Gunthorpe Cc: Jens Axboe , Keith Busch , Alex Williamson , Sagi Grimberg , linux-nvdimm@lists.01.org, linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, Stephen Bates , linux-block@vger.kernel.org, =?iso-8859-1?B?Suly9G1l?= Glisse , Jason Gunthorpe , Christian =?iso-8859-1?Q?K=F6nig?= , Benjamin Herrenschmidt , Bjorn Helgaas , Max Gurtovoy , Dan Williams , Christoph Hellwig Subject: Re: [PATCH v6 03/13] PCI/P2PDMA: Add PCI p2pmem DMA mappings to adjust the bus offset Message-ID: <20180921164813.GJ224714@bhelgaas-glaptop.roam.corp.google.com> References: <20180913001156.4115-1-logang@deltatee.com> <20180913001156.4115-4-logang@deltatee.com> <20180921131550.GG224714@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180921131550.GG224714@bhelgaas-glaptop.roam.corp.google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 21, 2018 at 08:15:50AM -0500, Bjorn Helgaas wrote: > On Wed, Sep 12, 2018 at 06:11:46PM -0600, Logan Gunthorpe wrote: > > The DMA address used when mapping PCI P2P memory must be the PCI bus > > address. Thus, introduce pci_p2pmem_map_sg() to map the correct > > addresses when using P2P memory. Memory mapped in this way does not > > need to be unmapped. > > I think the use of "map" in this context is slightly confusing because the > general expectation is that map/unmap must be balanced. > > I assume it's because the "mapping" consumes no resources, e.g., requires > no page table entries. Possibly there's a better verb than "map", e.g., > "convert", "convert_to_p2pdma", etc? > > If you keep "map", maybe add a sentence or two about why there's no > corresponding unmap? Another wrinkle is that "map" usually takes an A and gives you back a B. Now the caller has both A and B and both are still valid. Here we pass in an SGL and the SGL is transformed, so the caller only has B and A has been destroyed, i.e., the SGL can no longer be used as it was before, and there's no way to get A back. Maybe this is pointless bikeshedding, so if your color is the best, don't change anything. Bjorn