From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05936C369D5 for ; Thu, 24 Apr 2025 06:55:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4B5B6B0006; Thu, 24 Apr 2025 02:55:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF9BD6B0007; Thu, 24 Apr 2025 02:55:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC0D86B0008; Thu, 24 Apr 2025 02:55:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8C3B86B0006 for ; Thu, 24 Apr 2025 02:55:19 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 33C9480551 for ; Thu, 24 Apr 2025 06:55:20 +0000 (UTC) X-FDA: 83368026000.06.D9E109E Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf21.hostedemail.com (Postfix) with ESMTP id 8D9921C000B for ; Thu, 24 Apr 2025 06:55:18 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=JBMG74Uf; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of leon@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=leon@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745477718; a=rsa-sha256; cv=none; b=2OZoj9yT3Kg4Wnbz4MJ0jLt6berNpgAx6+0RkqoS0g6XSQzK0d8gu/x9x7f8FWh02JXUia a6ydM3OXhBO7t1XfbmDERVDUc0zwx8MYvzq5m57nxbnizxeh9D6I3jkO+KP/LH+TsGTm+m g9wEOxG11Q8vufjOJHWI45fxGJ/4+Ag= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=JBMG74Uf; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf21.hostedemail.com: domain of leon@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=leon@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745477718; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZiauGp3t3Y5wyzlZDuhCItT1kNHTvnQlRo4eHOpOvFo=; b=qjT9OoM4ngW5VPPkIuhsRUGWrM2ZqrTr2+qquRdZkPuYlevboI3C6ZNrU7iM8bOBEFGbjD w9b/Iwhhn4Yc+hlMAIII2T0Jl0lK3PgV1CtCKNvaDhB30mBIz5I3JfYZcAPL9tvF+vav4q aGYnlGbjYdJI+TMQ6h5YzlwyvOzXFtk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id A4C85A41AA1; Thu, 24 Apr 2025 06:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63A31C4CEE3; Thu, 24 Apr 2025 06:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745477717; bh=O2NhhAxby4h2wdAG9lotXu0r8Mq+CnbUeKJ51V9RGiM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JBMG74Uf2ayBsAyXOsGDu/Pky6ixNS1c4BDJHd4lwbNECLO5LrTPDLt1r0eNUPLy0 ynut6BgnWakwJKSAx+8FK+EGFCkITnvLnelLONPxIjuG0tdC90cdj3pniHXtHm9Fxa wl45/ZTtb8BKv0iNv76Ij9tfHUWh6rTMYx7CAUO3rppkqiaLH7xleBCQXesauRPbp2 FUUzSE+hvgKs3WwAsv1qWr/zBPK1T2EbndRkbynGnImy0ZnvZycZXxoAzu4XEX+teR a2VWk0rzolhjEPmNfygA5hJqIMt43/HcuEsUyDD2XFjdC06yV7sioUDVdESF6SAvcW F+H5S2kqGr5vg== Date: Thu, 24 Apr 2025 09:55:11 +0300 From: Leon Romanovsky To: Jason Gunthorpe Cc: Marek Szyprowski , Jens Axboe , Christoph Hellwig , Keith Busch , Jake Edge , Jonathan Corbet , Zhu Yanjun , Robin Murphy , Joerg Roedel , Will Deacon , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrew Morton , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-rdma@vger.kernel.org, iommu@lists.linux.dev, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, Niklas Schnelle , Chuck Lever , Luis Chamberlain , Matthew Wilcox , Dan Williams , Kanchan Joshi , Chaitanya Kulkarni Subject: Re: [PATCH v9 03/24] iommu: generalize the batched sync after map interface Message-ID: <20250424065511.GL48485@unreal> References: <2ce6a74ddf5e13a7fdb731984aa781a15f17749d.1745394536.git.leon@kernel.org> <20250423171537.GJ1213339@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250423171537.GJ1213339@ziepe.ca> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8D9921C000B X-Stat-Signature: 9jyc47356qtngb18keapb5uc1g9dnwgi X-Rspam-User: X-HE-Tag: 1745477718-752669 X-HE-Meta: U2FsdGVkX18kj580mclLpuvPu02qfx8wIXzrKJND2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xobEwfrtdngZrGrA6In6kGwo2Sf0plFfbtQiAcewGYek6AXso3RbQZXQLLaQF9qA7IFl1cDFbKF6iLogCphd4jWTw5hlCowIHwHBFXM5WuynydaLLndoFPS5W3z8M4S5pOh3jg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Apr 23, 2025 at 02:15:37PM -0300, Jason Gunthorpe wrote: > On Wed, Apr 23, 2025 at 11:12:54AM +0300, Leon Romanovsky wrote: > > From: Christoph Hellwig > > > > For the upcoming IOVA-based DMA API we want to use the interface batch the > > sync after mapping multiple entries from dma-iommu without having a > > scatterlist. > > Grammer: > > For the upcoming IOVA-based DMA API we want to batch the > ops->iotlb_sync_map() call after mapping multiple IOVAs from > dma-iommu without having a scatterlist. Improve the API. > > Add a wrapper for the map_sync as iommu_sync_map() so that callers don't > need to poke into the methods directly. > > Formalize __iommu_map() into iommu_map_nosync() which requires the > caller to call iommu_sync_map() after all maps are completed. > > Refactor the existing sanity checks from all the different layers > into iommu_map_nosync(). > > > drivers/iommu/iommu.c | 65 +++++++++++++++++++------------------------ > > include/linux/iommu.h | 4 +++ > > 2 files changed, 33 insertions(+), 36 deletions(-) > > Reviewed-by: Jason Gunthorpe > > > + /* Discourage passing strange GFP flags */ > > + if (WARN_ON_ONCE(gfp & (__GFP_COMP | __GFP_DMA | __GFP_DMA32 | > > + __GFP_HIGHMEM))) > > + return -EINVAL; > > There is some kind of overlap with the new iommu_alloc_pages_node() > here that does a similar check, nothing that can be addressed in this > series but maybe a TBD for later.. This series is based on pure -rc1 to allow creation of shared branch, while you removed iommu_alloc_pages_node() in IOMMU tree. So we must merge it first and tidy the code after that. Thanks > > Jason >