From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 77CD737B025 for ; Thu, 2 Apr 2026 22:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775167919; cv=none; b=A/mKC+gqqJXDYXztI7LVsuoy3Mq3ms/0l3Yf8KSVb2mIxF3yR4PzeKxDitcjjyTdqegL7NRZeED0Ls/cFp7zbVhEwoisfgThy00098LML+EichkJmshUFOKNmnfvz2UoZmTIsv0HfMJbFky2zPDiOYcqX268z+JcHI7fOFKqFQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775167919; c=relaxed/simple; bh=I0g8r73yWzm7kcY8rMT3itCMS+wgU6DaBYgJ4OqQHoU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QmScVC6xKZJFL0S0TN9PoO7+L1QjtToiDZ3posGNJ8gomVjxo/rTo7ba3v0fGwqbdv61zrZAW8xURaWZKCTgCREetExhTSMpVy9OR3urC88CYKXLOkiWy5sABFOBuqAm/hdANEgoV3hcUrEQPBof2ps2zh9V8XMpaDL1bml9+58= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FdtzJgqM; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FdtzJgqM" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2b0c30b51bfso26891375ad.0 for ; Thu, 02 Apr 2026 15:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775167918; x=1775772718; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=P+o8/jyKkg2oUZiMM6SRiYkZTX9z0qkVTAVB6Qh167E=; b=FdtzJgqMw2qXwumg5kNWzdMKEZZQS0Asht+yvUXgpp0ou3FwegG68B5hGBtO1pT9m/ YJXoh3dJWR2oDVtHf2XF4pPQSL/NVW0yyVe2lqLhhu5saaM4cOTA8NAdJXk1bmTt1vDE 4lF00YyDX1eyaFoMemrlgXvQwOpmlA9cr+0eFeWEyx5Rgwro+Mmw0WN7JaXMi0PtQ4Hr V5nKIHA5DoQTJtHCphB2NELkStQx1+u3TpFdnu1hpblVopTmJTjoabdKVaTm1Lpa9T9h yPz7N2V2eCTUWaAbK0hhLcGbI0aY7EsGLrUp9/G0/pyCKa4lAVoAglAS3zHI+3g7W58v 3F2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775167918; x=1775772718; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P+o8/jyKkg2oUZiMM6SRiYkZTX9z0qkVTAVB6Qh167E=; b=BmiccrgZThhcBAZtoeg3YLfy54qO3nzJrhAMOicHQ8Y3LvatFNOuQRHcPgYJZUOKDN y3mY40+VAE+zv8x+dSpsf+lsvLReagTLggOfA4s7WqbE1AarTGitd+uVMc4+W610ubM3 eLO00HOx6ly88123wgixy6hSyjTI7C/uxpQNxbJ8sCjqJogouYkTxEe32/uACNhlA49U 4YdmahCq01xFgybPDaLrRl+rg77dmp+l6XrgtV/4y5n2oTqnasK/yAMsf5f0w83Y3G9n FLYuO6wh1jgxdcBwB7qk9qroVhMiNxNyaBSEowwaXp63H5MDp7jOpzeeAjq9iMjMoZQl 1/KA== X-Forwarded-Encrypted: i=1; AJvYcCVJO0zcvQCGXnid5sSYfITrC0ZaRnc8FWGKWKhfQrKxoBUuwymTEIgBiXMAZ6v2F0t7TtYqFx2BPs2lIDg=@vger.kernel.org X-Gm-Message-State: AOJu0YwFMorGSV+JcF5FPsqOge1Lx5AGDcgEeISGVBIU4O1cYps9Jwkc eVkcAJcQMGR3k4j6rLu6Fe0cs4jgFhgDqAwxdAvZ1Lo+Opbanafc4L/eaTJIvR812O+yUZb/D5z cm8tjlw== X-Received: from plpn3.prod.google.com ([2002:a17:902:9683:b0:2b2:458e:4d6a]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:32cd:b0:2b2:51e8:2c20 with SMTP id d9443c01a7336-2b281760833mr8706375ad.21.1775167917665; Thu, 02 Apr 2026 15:11:57 -0700 (PDT) Date: Thu, 2 Apr 2026 15:11:56 -0700 In-Reply-To: <33adf49d-4937-413e-a594-830c11b2bed0@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260319005605.8965-1-yan.y.zhao@intel.com> <20260319005703.8983-1-yan.y.zhao@intel.com> <33adf49d-4937-413e-a594-830c11b2bed0@intel.com> Message-ID: Subject: Re: [PATCH 1/2] x86/virt/tdx: Use PFN directly for mapping guest private memory From: Sean Christopherson To: Dave Hansen Cc: Yan Zhao , pbonzini@redhat.com, dave.hansen@linux.intel.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, kas@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, kai.huang@intel.com, rick.p.edgecombe@intel.com, yilun.xu@linux.intel.com, vannapurve@google.com, ackerleytng@google.com, sagis@google.com, binbin.wu@linux.intel.com, xiaoyao.li@intel.com, isaku.yamahata@intel.com Content-Type: text/plain; charset="us-ascii" On Thu, Apr 02, 2026, Dave Hansen wrote: > On 4/2/26 13:47, Sean Christopherson wrote: > > On Thu, Mar 19, 2026, Dave Hansen wrote: > >> On 3/18/26 17:57, Yan Zhao wrote: > >>> Remove the completely unnecessary assumption that memory mapped into a TDX > >>> guest is backed by refcounted struct page memory. From KVM's point of view, > >>> TDH_MEM_PAGE_ADD and TDH_MEM_PAGE_AUG are glorified writes to PTEs, so they > >>> have no business placing requirements on how KVM and guest_memfd manage > >>> memory. > >> > >> I think this goes a bit too far. > >> > >> It's one thing to say that it's more convenient for KVM to stick with > >> pfns because it's what KVM uses now. Or, that the goals of using 'struct > >> page' can be accomplished other ways. It's quite another to say what > >> other bits of the codebase have "business" doing. > >> > >> Sean, can we tone this down a _bit_ to help guide folks in the future? > > > > I strongly disagree on this one. > > I think I understand the motivation now. All I'm saying is that instead > of something like: > > Remove the completely unnecessary assumption that memory mapped > into a TDX guest is backed by refcounted struct page memory. > > I'd rather see something along the lines of > > KVM's MMUs work with PFNs. This is very much an intentional > design choice. It ensures that the KVM MMUs remains flexible > and are not too tied to the regular CPU MMUs and the kernel code > around them. > > Using 'struct page' for TDX memory is not a good fit anywhere > near the KVM MMU code. > > Would you disagree strongly with that kind of rewording? Not at all, works for me.