From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 A5D731AAD7; Sat, 13 Jul 2024 05:24:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720848257; cv=none; b=pFMUY/kRYzBzVJ8FCL0V7RbnSwclhjFynZqC5qb+Pa61kWFUfX8pb0bD57MsnLfYlJvGFktQCbYMf8QnEYIA5CylQx47zHIKVghsikyo0pRxb5kVTsji4NnHks4252mfLSihLpt/MFqGS8RZqQBU/lCIUkhuOpDNFly3q3X6bIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720848257; c=relaxed/simple; bh=i1tyWKO6ViZfMuMG8iDhebaM0e4ILH5wb7R8M5/Ml28=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ma8RtNY73NNod/H9ZchNqjDM85QnYsjkN/PRKtI4Mu6QoF3dg21KKDFVM/en4m8sZ5FmeffhdbKPd35rfqid5oOqPxDqlTz3OcC4VMukC0brtuOeaxsYs2i98kBMDDbhxpuDkKf0LutKPHRBrsTh7i/ThY6G/bjgBGcZEZWIIGY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 5CE8768B05; Sat, 13 Jul 2024 07:24:09 +0200 (CEST) Date: Sat, 13 Jul 2024 07:24:08 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Leon Romanovsky , Jens Axboe , Robin Murphy , Joerg Roedel , Will Deacon , Keith Busch , "Zeng, Oak" , Chaitanya Kulkarni , Sagi Grimberg , Bjorn Helgaas , Logan Gunthorpe , Yishai Hadas , Shameer Kolothum , Kevin Tian , Alex Williamson , Marek Szyprowski , =?iso-8859-1?B?Suly9G1l?= Glisse , Andrew Morton , linux-block@vger.kernel.org, linux-kernel@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 Subject: Re: [RFC PATCH v1 00/18] Provide a new two step DMA API mapping API Message-ID: <20240713052408.GA25890@lst.de> References: <20240705063910.GA12337@lst.de> <20240708235721.GF14050@ziepe.ca> <20240709062015.GB16180@lst.de> <20240709190320.GN14050@ziepe.ca> <20240710062212.GA25895@lst.de> <20240711232917.GR14050@ziepe.ca> <20240712045422.GA4774@lst.de> <20240712124237.GX14050@ziepe.ca> Precedence: bulk X-Mailing-List: linux-pci@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: <20240712124237.GX14050@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, Jul 12, 2024 at 09:42:37AM -0300, Jason Gunthorpe wrote: > On Fri, Jul 12, 2024 at 06:54:22AM +0200, Christoph Hellwig wrote: > > > This is all purely hypothetical, and I'm happy to just check for it > > and reject it for it now. > > I do know a patch set is cooking to allow mixing ZONE_DEVICE P2P and > anon memory in the same VMA ala HMM with transparent migration of > ZONE_DEVICE to anon. > > In this situation userspace will be generating IO with no idea about > any P2P/!P2P boundaries. Yes. And as said from the beginning of these discussion I think the right way is to change the gup code so that for a single call to get/pin_user_pages it always returns either only P2P pages or non-P2P pages only, with the FOLL_PCI_P2PDMA just allowing P2P pages at all. Similarly they could easily just return one kind of P2P pages per call only.