Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp212612imm; Fri, 21 Sep 2018 13:00:59 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb9QlDScAadgNF7UTanijSngO1q3xD8zZucXuBo22oB6dUpnSLdhfiT0+H0sSoxIxRDaAT0 X-Received: by 2002:a63:1d47:: with SMTP id d7-v6mr42628301pgm.180.1537560059280; Fri, 21 Sep 2018 13:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537560059; cv=none; d=google.com; s=arc-20160816; b=IQpMSblotEsxZY78OY4SztvokvFJiKXsDrZJe82h2VgZepp0Ykcq8sVenz9rmpFm1L rkgsl05nhQMgs8oJTzuxbNK0DjxAW2CSzAA592G472ezBxzxjQr1CUWe86685kvJCbxd T/Qjziit9+Aax2UvnV8R7/g6/AwegqNETMDHIG2ds4W6kMUGFjhcIFKlZdOp5GkLfJEp 0BlbQLqXirIO6Avfm+onoJwo5Wr7/D6LYy3dl/CdtjGEKkL7/Msiv6HJ7EJbm/sPPs4x rVMsU32CRbD2qOZwY7W4j3Sl3GLb7MAFHgWYo/iLrWL84PUGHGLvda+PEN2/cNBvUGRI tzwg== 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=o+W1YERTUYZ0TqRvAbQj3Rbht4aGPxrR9OJ8DpyhtQ8=; b=Ny0CB8PZfh49u95eBrCiv5uJ9JHjWgcQ1svAXDroqJA9p5LOzzTvREC3L2jd+vkvK4 C0aThqMFklogUQJ/DhCr/yoNq0VJoyj8uouD7xkpVuldVb79xsbWigJ1nQycVlrtbCs9 PRgEQcC/TT42pjKYZhfrK52kWTTuIrqZUdkbMxzMOdgOL21/lEynMWf5oMDjjKXRIxa6 ENM3ye8Im1GBTuQnKbxreI2XRd4VO81sHbKghi57iFSj4fqsI5V6DEElYwOrWfTk5Yd6 sU2e9JgTsl3ycfDpkcKldKyOytPKH7yN/xA8OvHGGGB0GFFkHf8gBR0elRH/eSen/6sM mraw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zAZBThdK; 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 o5-v6si26997075plh.18.2018.09.21.13.00.43; Fri, 21 Sep 2018 13:00:59 -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=zAZBThdK; 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 S2391492AbeIVBur (ORCPT + 99 others); Fri, 21 Sep 2018 21:50:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391436AbeIVBur (ORCPT ); Fri, 21 Sep 2018 21:50:47 -0400 Received: from localhost (unknown [69.71.4.100]) (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 6469221567; Fri, 21 Sep 2018 20:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1537560022; bh=CrhlpLU1sMnx5ej8V4SsnscK1e+9Iyub/ZaXRbhq+4U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zAZBThdK6bXl3iktj8Idzvtn6mFdtkuX3Xj1aJM35wjwtBieDHLtK/yf3UivnyyUS nbeAe7Q0qrhkR2E/m7PN1rdCdp7f9bLUfmDqhSQ0W9XauloTcuuzCO+WnYuMmLj5c2 oUmKQF51bAAKafsCKEJQ/RHIcoSAqe4p8wr5JCZ8= Date: Fri, 21 Sep 2018 15:00:21 -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: <20180921200021.GN224714@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> <20180921164813.GJ224714@bhelgaas-glaptop.roam.corp.google.com> <506dd00c-35e9-e285-bc97-c689c766b4cf@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <506dd00c-35e9-e285-bc97-c689c766b4cf@deltatee.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 12:13:21PM -0600, Logan Gunthorpe wrote: > On 2018-09-21 10:48 AM, Bjorn Helgaas wrote: > >> I think the use of "map" in this context is slightly confusing because the > >> general expectation is that map/unmap must be balanced. > > Yeah, Jason said the same thing, but having an empty unmap function > seems wasteful and Christoph said to just remove it. My opinion is that > it's not that big an issue one way or another -- if we have to add an > unmap later it's not really that hard. > > >> If you keep "map", maybe add a sentence or two about why there's no > >> corresponding unmap? > > Will do. > > > 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. > > I wouldn't say that. Our map_sg function is doing the same thing > dma_map_sg is: it sets the DMA address and length in the scatter list. > So B is still A just with other fields set. If the caller wanted to map > this SG in a different way they can still do so and the new DMA > address/length would override the old values. (Normally, you'd want to > unmap before doing something like that, but seeing our unmap is an empty > operation, we wouldn't have to do that.) Ok. I was assuming s->dma_address would have been already set before the call and would be overwritten by pci_p2pmem_map_sg(). But I guess that's not the case -- sounds like s->dma_address is undefined before the call. Bjorn