Received: by 2002:a05:6500:1b8a:b0:1ef:a0f1:aef6 with SMTP id df10csp8492lqb; Sun, 10 Mar 2024 01:35:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVENJUNYkVZJ5O52OH509pVQjOjdZttXGVewHUwnuqdT2LJOPomJQiDthZOARJk2k3LPFzalN1DNpyk0/IHBjej+s65xQBBPd3Vr4nO3Q== X-Google-Smtp-Source: AGHT+IFZKkpeQltDq4WR24SBSYXXoAWTuNeHuM834JZyxT+BdUzNbOTzE+wVXEEhWbHudtJlTima X-Received: by 2002:a05:620a:2988:b0:788:6637:87b8 with SMTP id r8-20020a05620a298800b00788663787b8mr2549041qkp.30.1710063333110; Sun, 10 Mar 2024 01:35:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1710063333; cv=pass; d=google.com; s=arc-20160816; b=nblI3hKUOORz6d+KiyptPu1ku0tc/hVhR6Rkodk5G6p92xss04xh2nfbBlkVNkuLJW vRyx2WXEdvQm1nqT3+NJnEBEte0XX/Ol+ORBASblYaPe+uMo7loDeOxk3M0kl/LGIm6W OGoGsTcUKYoCTyrKR5G0E/giIV/3ei4HqVkdGmi5oYt0HRtETPTxvh1Q9acgJuCnsZTw JoKdvMbBeg66sfsKcOn/lhyTdLFDqQFgDICzXIwvbFS7ikaUilD/LMqt6ZRsfw2w/w6G rTOH1yq+pOOH4KeR+nO1hzyBtJc7QQj+vKzTAGOiDSQNDoNPtCPFBYf4rin9MNTTKTXK +KFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UVsTc5C9/FhivAdoyZVDRCC5uwGwzmvGccuOt9lmP44=; fh=mmnNvQFOHfrcFNkckn4nYsZKC3OV9HVJBN8A5eqeywY=; b=eOCtDlXVO13v6LkU9aUOYTC+qcq+IE//k4ZbUY0xytbyjs3nl9tuL2ewUZKQNB4V13 kSoUbXZDz3Qeo6PAtIyFU/Jbz6bXzEB/o5kXp1HREtvUgIW6Mu7ygRh5dT4+jvieaR6H wxk4yshmu05vyOCAbxO0H/mcLUv8+yxCBsE7UfHUDFJ3R7Uv398Rs1xyR9OElJjT/hs5 UR1+lsUTFQnO4IVZZTVksaqE0RLK54O4d0K2ChXmbJ6xwWBfIrWtgF5jAAhILK7pWTjR GcGHY2lwWNzGP8vz40V4S58KieV9ywUXTFQEK+UR7ZPlL7+P7FhBwWPE7kV00oKYFbMY tuyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U5txpaxj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j25-20020a05620a147900b0078852862ecdsi2984248qkl.408.2024.03.10.01.35.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 01:35:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U5txpaxj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98168-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D2EB41C209C9 for ; Sun, 10 Mar 2024 09:35:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0F6F1F95F; Sun, 10 Mar 2024 09:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U5txpaxj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF4071DDD6; Sun, 10 Mar 2024 09:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710063319; cv=none; b=sDWapVDF8/QUsPU2PXtIrpWFVbhkqTZ5fOCe6oQ3KQWgD0BZwFTRHlPTmIbBUaAXcXyrI3exTGH4xzagDeIUkVtznMDi3oUkLVtq7WuSKCUsqDwpIzPxPMy+Hl70vSETWR53uRpL2RE46aHNFLePYFRCvzbVPsQXArd52rGQTuE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710063319; c=relaxed/simple; bh=A56j1ShXDrhKO97iz6szIVzteEyqKgRDBPAwzXDzikI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ac80HIwoLIvu7vjqhEQWCnCFgliPyi+AzvJOs3WTTu4fp0DVzpFlG+gI1OamZQRLSSEI1YMXIbjkfHSFB/OoPU4zSu/DYvj2CDlt7P87+eHhq+QbZPXiN8SYFC4u0g9bYTIAEI4++BgN0ABl+XkE7lzenWdyN2lrroYS2FDnSYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U5txpaxj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0B84C433F1; Sun, 10 Mar 2024 09:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710063318; bh=A56j1ShXDrhKO97iz6szIVzteEyqKgRDBPAwzXDzikI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U5txpaxjWhNjC2+i4ewRBUTMbOl9INv+8VjxpWaxk1WEUrjJg3az83iYX2Mn4D5SW yc6zUeCxxSQMhZvCdnpcpuT+AYCkhv/mL7iK7m+UeKVcbupJn2l7VTPaYgCjgBMOA/ BVU6BAh38XlKsUBRkSdAb8irqFKw0ZmI0R/LcvETKy/DSscUI1S6TDxF2MskopGD0N xWRfW9nVMxCaiAkZIpVfqgVBd2dslnlH2l6ODPwVzq2OuPr97rODqlhU5Xm7KbNrxR R7fTvQEaz2EW6Wj0d9pT+Nk4jaz7CJCi9Qxf7jgVSWm1t3UiO2ayk7llGARr05mmDQ jSKO3qAwJxGPw== Date: Sun, 10 Mar 2024 11:35:13 +0200 From: Leon Romanovsky To: Christoph Hellwig Cc: Jason Gunthorpe , Robin Murphy , Marek Szyprowski , Joerg Roedel , Will Deacon , Chaitanya Kulkarni , Jonathan Corbet , Jens Axboe , Keith Busch , Sagi Grimberg , 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, kvm@vger.kernel.org, linux-mm@kvack.org, Bart Van Assche , Damien Le Moal , Amir Goldstein , "josef@toxicpanda.com" , "Martin K. Petersen" , "daniel@iogearbox.net" , Dan Williams , "jack@suse.com" , Zhu Yanjun Subject: Re: [RFC RESEND 00/16] Split IOMMU DMA mapping operation to two steps Message-ID: <20240310093513.GB12921@unreal> References: <20240306154328.GM9225@ziepe.ca> <20240306162022.GB28427@lst.de> <20240306174456.GO9225@ziepe.ca> <20240306221400.GA8663@lst.de> <20240307000036.GP9225@ziepe.ca> <20240307150505.GA28978@lst.de> <20240307210116.GQ9225@ziepe.ca> <20240308164920.GA17991@lst.de> <20240308202342.GZ9225@ziepe.ca> <20240309161418.GA27113@lst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240309161418.GA27113@lst.de> On Sat, Mar 09, 2024 at 05:14:18PM +0100, Christoph Hellwig wrote: > On Fri, Mar 08, 2024 at 04:23:42PM -0400, Jason Gunthorpe wrote: > > > The DMA API callers really need to know what is P2P or not for > > > various reasons. And they should generally have that information > > > available, either from pin_user_pages that needs to special case > > > it or from the in-kernel I/O submitter that build it from P2P and > > > normal memory. > > > > I think that is a BIO thing. RDMA just calls with FOLL_PCI_P2PDMA and > > shoves the resulting page list into in a scattertable. It never checks > > if any returned page is P2P - it has no reason to care. dma_map_sg() > > does all the work. > > Right now it does, but that's not really a good interface. If we have > a pin_user_pages variant that only pins until the next relevant P2P > boundary and tells you about we can significantly simplify the overall > interface. And you will need to have a way to instruct that pin_user_pages() variant to continue anyway, because you asked for FOLL_PCI_P2PDMA. Without that force, you will have !FOLL_PCI_P2PDMA behaviour. When you say "simplify the overall interface", which interface do you mean? Thanks