Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4913404pxy; Tue, 27 Apr 2021 15:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBfO+oeE+c3Ah3/AAm8Udtohx2iGLZE4uv9uPTcD7FIC4xRXMjTGcxcWoNZFBFlZItGGCr X-Received: by 2002:a63:5b0e:: with SMTP id p14mr24066757pgb.110.1619563929983; Tue, 27 Apr 2021 15:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619563929; cv=none; d=google.com; s=arc-20160816; b=hMhvpkB/KPNUiL3MKopkjfo8JDptERJCAtOgGp9no3hbhfiQbTQVGyYw20ltFdMAie M982loOvxpKguQ9IKXdFlb/8z6AsFf9tuE+BEtiuvimYI8Fb6E0r1P84N19ibwfQLxoR jZOCkWuZqcAkp+caD33+6sbid4y12I/JKcohiEB/P/JnfM5NuOgHyJ+mHTVCL4GoHZDM jRs8wqJHTyLTBX4hJ5W+hxHVx+8zmKzHaLs8SH94UEfH8618kXpQOAZs9PPCqGuTp1Fq VC+JTZUoAbqq6N+GFmBmogjp2kP4gQ2n8vaAyl18txJbD2VWCu34bCOnRNhAubdMm5bv YICA== 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=PBZp6uxAp8nlNU5Rm16hkR47Rwe8xrGWtpeD+dKWkk4=; b=BMAo1K3mesXUrbv8lOAFbQvqgcfsaJggwp85VmGoG0OhfNnVI8sQ9vLECzPioDW9v6 L64svGrRqGkxTQ8YlMljgCxC38RVGPR4ewhqdvQPnzCKjL2Fj7dJqdGBYt+6h+jPruur bZguQRrqJrZo/Il1Zhvz04FpMlzsNxt3rkMOmGHWvaCh26/s8fOdUwtwyP2FCGOao72h 80266Cr8H6XLyc5nAnNlB2LNfONxJCQZEPTz7JgrmJpl0D1JLvpwExQt6V4ci236sXUK S/lGPoZX8QacU6AJgkrDAGTm7YF2fz/oOu4jJJ8wQNydN+LtYawTqnJ12ffYclWj9sbL KPVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=c2SnI7NA; 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 t10si3247677pjm.118.2021.04.27.15.51.25; Tue, 27 Apr 2021 15:52:09 -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=c2SnI7NA; 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 S236936AbhD0WvP (ORCPT + 99 others); Tue, 27 Apr 2021 18:51:15 -0400 Received: from ale.deltatee.com ([204.191.154.188]:42486 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235382AbhD0WvN (ORCPT ); Tue, 27 Apr 2021 18:51:13 -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=PBZp6uxAp8nlNU5Rm16hkR47Rwe8xrGWtpeD+dKWkk4=; b=c2SnI7NAl3/gr4SFEOqWfEjO9J 1JGnC7Zf5KDX7iHl6Y4Xf/2xqN/Sf5EK4N3LedlbB9Fd00L3W9uy4hRpaf9AzRR6bhJRwlUH+3jQV JGHEoIAnzvnTbXFFloa9dmt/bebMlHu8p0eMd7ujtwQMFSXPtCaCZfLSEapIfvrwoLvjkcmHaak0S os4Ry++J+BA4Zjy4rlpJGfScH23wq+QuJ1EnvUrl/i2hoEb1GA+PElTtZrctT7avrcp051HeAQJHt MommdMIRXxQ8f7+NTw6YINNchc1V2k8mSpMibhQPjTbiWcdM3d674C2MzQOyDshqLUX3ERNg5eNxi Yzo0Jtug==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1lbWWo-0002hR-Kh; Tue, 27 Apr 2021 16:50:04 -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-6-logang@deltatee.com> <20210427192232.GO2047089@ziepe.ca> From: Logan Gunthorpe Message-ID: <74473159-b4d7-89c8-9dae-7e983b22ef2b@deltatee.com> Date: Tue, 27 Apr 2021 16:49:58 -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: <20210427192232.GO2047089@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 05/16] dma-mapping: Introduce dma_map_sg_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:22 p.m., Jason Gunthorpe wrote: > On Thu, Apr 08, 2021 at 11:01:12AM -0600, Logan Gunthorpe wrote: >> dma_map_sg() either returns a positive number indicating the number >> of entries mapped or zero indicating that resources were not available >> to create the mapping. When zero is returned, it is always safe to retry >> the mapping later once resources have been freed. >> >> Once P2PDMA pages are mixed into the SGL there may be pages that may >> never be successfully mapped with a given device because that device may >> not actually be able to access those pages. Thus, multiple error >> conditions will need to be distinguished to determine weather a retry >> is safe. >> >> Introduce dma_map_sg_p2pdma[_attrs]() with a different calling >> convention from dma_map_sg(). The function will return a positive >> integer on success or a negative errno on failure. >> >> ENOMEM will be used to indicate a resource failure and EREMOTEIO to >> indicate that a P2PDMA page is not mappable. >> >> The __DMA_ATTR_PCI_P2PDMA attribute is introduced to inform the lower >> level implementations that P2PDMA pages are allowed and to warn if a >> caller introduces them into the regular dma_map_sg() interface. > > So this new API is all about being able to return an error code > because auditing the old API is basically terrifying? > > OK, but why name everything new P2PDMA? It seems nicer to give this > some generic name and have some general program to gradually deprecate > normal non-error-capable dma_map_sg() ? > > I think that will raise less questions when subsystem people see the > changes, as I was wondering why RW was being moved to use what looked > like a p2pdma only API. > > dma_map_sg_or_err() would have been clearer > > The flag is also clearer as to the purpose if it is named > __DMA_ATTR_ERROR_ALLOWED I'm not opposed to these names. I can use them for v2 if there are no other opinions. Logan