From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B0B4259C9C for ; Fri, 27 Feb 2026 01:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772154545; cv=none; b=osHsZfXqTP/oCbwimJGxPMGyUPNnWXe44F7145d++JxQEn3Ds4z3hBl7V+PlVyn01/wBALb/vhBNV2LrqSiI7byoFWenVpT5YE6bUPqCmmiveYnPmPDDuSRJKrwB/O3kRdLpIxF/rASou60yjsq3Esi5SpgJmFXYxuphlh1EqOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772154545; c=relaxed/simple; bh=Vsm+/jCgY2aB74QyLRYBdy8B+Rgt8iW3O8facH4/8UY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WOKwo0p7BN+wB8YDxkAgM78liJ0MaEeyzIJ/rdd53h642eoSlHKCpwI14d/a07TiEXb2qL4tL2f7odZkDSHlbNhg0l5WH/O19y1QlRtSfaxgmT1AQ9MEUe3wiC3F1gCVNfWWHUfaZEr7//cz7Q6EIWQdQZcDHT+BNEVgJ81OdaI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=bF8H/HS7; arc=none smtp.client-ip=209.85.160.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="bF8H/HS7" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-506a297c14bso14705051cf.2 for ; Thu, 26 Feb 2026 17:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1772154543; x=1772759343; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fIbZ6hyyMHAKB2BJD8/8kNRLCv959jzKvxcpPvl74ls=; b=bF8H/HS7dNMuW01IbwOS0eD6goFSo2jnRSC64cG8Xc6vd97ImQrnl3OhPPnNqRyJzN bjOniRYfzXjnNQUn9heim27wZDc8dNr39V766Ag7UxV6MlrurMUJDpQttvln8F+aZaW5 iEB0JYmXkzrEq+4ZXa264WqfBDeMJI3OCOda+Cyu7jF2a3esxdrq+OZ+PdbOdkTagF3w 4Xz9V91GdcincBFcEZE2aoq9GgM1r/pj85Pzy7FM8/zQmneiWucyNlciAmC+9Jp96AVy 3hF6R727E7kaWXzl1iJGJhivDLscC0ZrXqz1Rti+42nh/gFNNcZ23x2/CzgXtHiIeDYY ZRVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772154543; x=1772759343; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fIbZ6hyyMHAKB2BJD8/8kNRLCv959jzKvxcpPvl74ls=; b=WEeEQSGY5nAFH4+3oMqPVH34GWUauCJbVmci4l9F4cemURkSttsNp69BPKBhe9/pIb IkHQ/aCsDHGwmgzg7fiPuf+ma1kuHYTCEdFMfsugNcHVyD+KCDx7kaEqJ9cpFQSq4wyG dpn2//k+bvGErp0ULkcKgrUIoQOIpF9XIbMHDl5AGtLyq2N3l0cvJ2BYzOI5lp4aJ7AH Ob9xoUU+imtfpkr51Yi+SlnsC7xLNNHoF4tvihYTuDhoofJXYYKTPHV0hjCa/9SN79Ye UVRUX6HrVnogDXjGWOuUW5/3a6ZH1ogqv0VKy4Kx3J4JlMgQWIPnH5bJX6F3CWg3CCUY 3DEQ== X-Forwarded-Encrypted: i=1; AJvYcCV75C2egMjakYYYXkCrvTZ06JMIVxBOY/sYB1G1cGGLwjIGtE7u1FR7HE4KOff4XxT/oMctvF9dMJ/gC7A=@vger.kernel.org X-Gm-Message-State: AOJu0Yyty5a93wJ8VJX1yl6BIDR+SfcZe+d5cR3nfIooGwalu16yEVdg 8udN1OQamq/zV7x1ZAkTmCHDa5g6Nu8v2hQE8w52JMuabecHJASY4uS3KIVAZAMJtuM= X-Gm-Gg: ATEYQzwbs6mfXQYD4dsy5ONSCujoLvviLDADMbryyVo7sYWsFGIDH040XKRXWMWgfWq bVER+zgbsz2xhFQgWnt9/HTGzZpYa0JWi/FUYIu9LCkZaMNH45y59iHj/PtPDriaQI1u0wzoEZE IO4omdWlzxhoS6uZOzk4YJfG3rg2Oejfe8WXcsXpjYQJv1+icf6j12szt6hnKeZCnjM93ij7ePK BfNFUJ0+sWknsAs/6cVia4OpdEdnkvDKSQagnjZBTw0iC68c0MUJha60sXYdZBmGPeF6waKKfcv 0vED2c2//dp7xW1Ad8uuMEKXhrUJ3BoY4iCKJQ0J5/NyVhjMBGnnyccvS9TdSaD4NBI4w9QRGMH 5n4hitbWIUDAYR3wu3RRIe+HGlu2aUxdggqt1swlPDwk4O8cylO6Lyjl2wccHt8BlXB+tbsKDUu reqrFJ5kSIBuotrDO8Bg/A2IlnXoGSoZ+Aa3sPPMHmCmVvuJgPmJEiYvAfOklkfpTiRS4s0XEOi BeWJIalyrGFCTkei3M= X-Received: by 2002:a05:622a:1907:b0:506:bde3:1dea with SMTP id d75a77b69052e-5075299954emr12486431cf.36.1772154543378; Thu, 26 Feb 2026 17:09:03 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-112-119.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.112.119]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-899c716ccf5sm39101476d6.17.2026.02.26.17.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 17:09:02 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vvmLm-00000000sEc-0kRO; Thu, 26 Feb 2026 21:09:02 -0400 Date: Thu, 26 Feb 2026 21:09:02 -0400 From: Jason Gunthorpe To: Sean Christopherson Cc: Ackerley Tng , Alexey Kardashevskiy , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Kevin Tian , Joerg Roedel , Will Deacon , Robin Murphy , Paolo Bonzini , Steve Sistare , Nicolin Chen , iommu@lists.linux.dev, linux-coco@lists.linux.dev, Dan Williams , Santosh Shukla , "Pratik R . Sampat" , Fuad Tabba , Xu Yilun , "Aneesh Kumar K . V" , michael.roth@amd.com, vannapurve@google.com Subject: Re: [RFC PATCH kernel] iommufd: Allow mapping from KVM's guest_memfd Message-ID: <20260227010902.GE44359@ziepe.ca> References: <20260225075211.3353194-1-aik@amd.com> <20260226190757.GA44359@ziepe.ca> <20260227002105.GC44359@ziepe.ca> 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: On Thu, Feb 26, 2026 at 04:28:53PM -0800, Sean Christopherson wrote: > > I'm confused though - I thought in-place conversion ment that > > private<->shared re-used the existing memory allocation? Why does it > > "remove" memory? > > > > Or perhaps more broadly, where is the shared memory kept/accessed in > > these guest memfd systems? > > Oh, the physical memory doesn't change, but the IOMMU might care that memory is > being converted from private<=>shared. AMD IOMMU probably doesn't? But unless > Intel IOMMU reuses S-EPT from the VM itself, the IOMMU page tables will need to > be updated. Okay, so then it is probably OK for AMD and ARM to just let shared/private happen and whatever userspace does or doesn't do is not important. The IOPTE will point at guaranteed allocated memory and any faults caused by imporerly putting private in a shared slot will be contained. I have no idea what happens to Intel if the shared IOMMU points to a private page? The machine catches fire and daemons spawn from a fissure? Or maybe we are lucky and it generates a nice contained fault like the other two so we don't need to build something elaborate and special to make up for horrible hardware? Pretty please? Jason