Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4918375pxy; Tue, 27 Apr 2021 16:00:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+yG0y1SqCPa1+CpsZCrkvYdMVvtCa09w+kYDdYTXuRQaXSm8+p6E+KkeEcogF2JzRBLe4 X-Received: by 2002:a17:906:1984:: with SMTP id g4mr25110073ejd.525.1619564432588; Tue, 27 Apr 2021 16:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619564432; cv=none; d=google.com; s=arc-20160816; b=WpgE8k8xEKUVABtOYOBXzzt6jnByt5N4/ijO8GaVDiUCBmOI4Oets2cb8YEeWTqIB3 +IMxCXhiWPQFO2Nkm+tn1zlQYKSafLZeKe4+eWa/YLyd62N6lZT+Qpj1kv8+nz9vRmxE Fo3UmEX+4ZKG1VU497I81its9Jg8GCvTyq4FxT72PyDWimH5+8JDVqofzp7PS+4mfgR3 6mYKPTVgkPSX/eASq5yt3GFAF8VSx2mVKBhaHxMIC5b7A0bKj0HYO4IWe7LCcnT4AhJZ jxFb+m2PNEU1y3K9jU7sqXGTs5R1ajIjIHKBvkJ0t7pPlL+xLAoyGvkwcHOYbkB7UujK SrUQ== 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=9cMqKeVqpV09cXzdKEdeF1wGWj3NSvz6cLLXzNXUCD8=; b=phm7TBzmNFX7rQeSGtBdPoZxGUQ9rVKiSzEq0FtaPaX7nJ6tzQkZ5gZjUhtCVPOt33 Rh6V2R5dsyXMtk/OAaE2GhJ7FBveJ3VTQTPG0tK02SNOlE57/LV8CbC8PdedjmUOuR7I qZ96ZSXCoTGhOV2JPGJeh4LpLEhg3SxZTp81yupd9FIBDa5mL97HQGF8zz4NRjlLURw1 fKPfm7jJwbSPlCjLV57C/ognUdi8mL6/eun+3HFk/TKqADXmvStz9YiTzGYEe+Rzgeon wMEkNGB4nCrkk09SV5d56ShABerMMv/fP2zltZjYtkEDGUq/g3+QJzuRAt1G6Mziwix7 p0lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deltatee.com header.s=20200525 header.b=bZ0qGVsk; 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 bh18si1052705ejb.405.2021.04.27.16.00.08; Tue, 27 Apr 2021 16:00:32 -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=bZ0qGVsk; 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 S236817AbhD0W45 (ORCPT + 99 others); Tue, 27 Apr 2021 18:56:57 -0400 Received: from ale.deltatee.com ([204.191.154.188]:42710 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235703AbhD0W4x (ORCPT ); Tue, 27 Apr 2021 18:56:53 -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=9cMqKeVqpV09cXzdKEdeF1wGWj3NSvz6cLLXzNXUCD8=; b=bZ0qGVskfkWJrx7xQzfuMkoJWn uXsbXCfWUy5H+XPJj218MIPSekFTaV56i4dZC9FFheUYyXLbwiAPhK3Bq+k3tBDvz0B7hbOVfR/Pw rU0TsIsdHTeMVZuRSJHe4unPK2tJx/470PpEKYmwqqNM5SMKswk4DlpwIILF3MrN0C47OMfdXi5S2 BmumlWMKxYppg3kVyzDdH2wUlAdUddF9ynHCOu6+qhXaeoKWzLwiJNa8Oc5YWsvB9LSQXNNpokW3c /UfXKIphBb3KBrtAfzVBu1rR4lQSws2cuqBfu3uWRWvY4NniZl2lxAPi8Nr5LTxNRFv7wpixJqrf/ 2mQpmzmw==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.92) (envelope-from ) id 1lbWcM-0002ln-Cs; Tue, 27 Apr 2021 16:55:47 -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> <20210427193157.GQ2047089@ziepe.ca> From: Logan Gunthorpe Message-ID: <3c9ba6df-750a-3847-f1fc-8e41f533d1a2@deltatee.com> Date: Tue, 27 Apr 2021 16:55:45 -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: <20210427193157.GQ2047089@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.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A autolearn=ham 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:31 p.m., Jason Gunthorpe wrote: > On Thu, Apr 08, 2021 at 11:01:12AM -0600, Logan Gunthorpe wrote: >> +/* >> + * dma_maps_sg_attrs returns 0 on error and > 0 on success. >> + * It should never return a value < 0. >> + */ > > Also it is weird a function that can't return 0 is returning an int type Yes, Christoph mentioned in the last series that this should probably change to an unsigned but I wasn't really sure if that change should be a part of the P2PDMA series. >> +int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents, >> + enum dma_data_direction dir, unsigned long attrs) >> +{ >> + int ents; >> + >> + ents = __dma_map_sg_attrs(dev, sg, nents, dir, attrs); >> BUG_ON(ents < 0); > > if (WARN_ON(ents < 0)) > return 0; > > instead of bug on? It was BUG_ON in the original code. So I felt I should leave it. > Also, I see only 8 users of this function. How about just fix them all > to support negative returns and use this as the p2p API instead of > adding new API? Well there might be 8 users of dma_map_sg_attrs() but there are a very large number of dma_map_sg(). Seems odd to me to single out the first as requiring these changes, but leave the latter. > Add the opposite logic flag, 'DMA_ATTRS_NO_ERROR' and pass it through > the other api entry callers that can't handle it? I'm not that opposed to this. But it will make this series a fair bit longer to change the 8 map_sg_attrs() usages. Logan