From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 2E5033002BA for ; Tue, 3 Feb 2026 20:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770149858; cv=none; b=apMZ0lx51rIxS2mVzu+LvRMddQ5xz1w3PwVqJqBybablwDXf7jLRGPDfZcp/m7j2Slq63xTfXvYRJtqojbugpofM1BdBd9ON0S12T3I/PfroAWh7EtsgDde8uGisVw+3EKh57j8iIkVz5Noigep0La5DNowM6Siy5fAuXuWs9z4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770149858; c=relaxed/simple; bh=FkCJM6ueNs7FqOzKfJS3PcbT/ZLZ/g8y/UzMew7y1Rw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JsXN87xCn/lePz/oJEUAutKwJXKRlWWnuljvg15+I8OW+jCZxykdNth4Uy6GVrUt4E8DRlDD2k18F2pNZ1TTkLo9oHZF6vwKmC5KxiwxehIO8iFBcb61lnjkNJrPl+/SUWq7wHcTRJWHRpnXryX1aiDJcIHh+u86OVv5pMp8k3A= 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=AhiDbNLl; arc=none smtp.client-ip=209.85.216.73 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="AhiDbNLl" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-35301003062so14491263a91.2 for ; Tue, 03 Feb 2026 12:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770149856; x=1770754656; 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=o4mt8h2gjWj7DXhBKRKL7wFsuvXhNdmeJu1raWnSkac=; b=AhiDbNLlFBlOxpgJR7N7hFLM0DyLG6mL13+8KlLR2AenJ/JyWLoAtIm/o6IEIIVR9z JJbHOnjezlP06qXlmaOsG+HsyEbnqKN+n3DwIFSV2XpO0K8v1gRo0+zwxFfFT3Ui2uTj 0dfPyOYQ0Y6AeTgh+IC739kycY87NY917cgE8dUK7Yv7+mBaTLbdAaeo8R5CT8z60D4Q Vjvrev/D6XkAJHSbuVtRvphQ6EEXPZeaj4sJrA7cpqseNK417lEWPGuEVPp4zIoO8AYR wwydZ4rWWjwdRBBTLEWuh4d/hKOPdQ/pSSvPnq+h2vIqSXoJ3vymQ0Q4rIT3Ozup9Mht gbgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770149856; x=1770754656; 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=o4mt8h2gjWj7DXhBKRKL7wFsuvXhNdmeJu1raWnSkac=; b=RKwQXxBPo/uo+MIX0XK4o8uMpDjdCsTxOpjpOV5sJkCpf3pcvmKVKb7V4paUvBdmeJ QAved0+EvnLOnFH5LolOIcMh/uaMn3dM7YBVOklo5ZZTv2cIvxJqY0rKhSCOTIIRw2oL ym9KLZ36hvSsBTGjGd60i3zKyTydkQ3e5GfRuZQDNRA4XPelA5AFn2ioK135h6Wp/DL1 INsjL98k/Tfd1pNTnNadxV07ZG7Bfg1Ez9CaZTMxcwwPsVod6ejUneJF1y8JxXI+Il2l b0BPjp1oXQk8AGhU5lpYXJ/WVY0oyhRbqxUA66ULRvjniBWCSSP+f7MIWgvcyCrRCGSz sNeA== X-Forwarded-Encrypted: i=1; AJvYcCUgStKEPyvjwnGr/6t0yRHOqxLfLTiU5aCqSRfi21sVsXPYGRmXcPRQYrXt5HBsCKutCTsPaFUonpmQfq8=@vger.kernel.org X-Gm-Message-State: AOJu0YwiSWuraAPQvhfFCHHHAzfxk0blDhF2krUK5hjawOpUtwnmorzE kS9c0bOv1aq1n4aOwY/sBsUVjjl2Xma86N807mSAgH8eGVD4qDr6uXUe4r7KkRdENMswVueTB6h lz8owzA== X-Received: from pjqf2.prod.google.com ([2002:a17:90a:a782:b0:351:b6a:a36b]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4b45:b0:352:ccae:fe65 with SMTP id 98e67ed59e1d1-354870ab6aamr390303a91.4.1770149856475; Tue, 03 Feb 2026 12:17:36 -0800 (PST) Date: Tue, 3 Feb 2026 12:17:34 -0800 In-Reply-To: <4fae16cdcc368d33f128c3a79c788b905b83ffe7.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260129011517.3545883-1-seanjc@google.com> <20260129011517.3545883-21-seanjc@google.com> <4fae16cdcc368d33f128c3a79c788b905b83ffe7.camel@intel.com> Message-ID: Subject: Re: [RFC PATCH v5 20/45] KVM: x86/mmu: Allocate/free S-EPT pages using tdx_{alloc,free}_control_page() From: Sean Christopherson To: Kai Huang Cc: "x86@kernel.org" , "dave.hansen@linux.intel.com" , "kas@kernel.org" , "bp@alien8.de" , "mingo@redhat.com" , "pbonzini@redhat.com" , "tglx@kernel.org" , Rick P Edgecombe , "ackerleytng@google.com" , "sagis@google.com" , Vishal Annapurve , "linux-kernel@vger.kernel.org" , Yan Y Zhao , Xiaoyao Li , "kvm@vger.kernel.org" , "linux-coco@lists.linux.dev" , Isaku Yamahata , "binbin.wu@linux.intel.com" Content-Type: text/plain; charset="us-ascii" On Tue, Feb 03, 2026, Kai Huang wrote: > On Wed, 2026-01-28 at 17:14 -0800, Sean Christopherson wrote: > > int (*set_external_spte)(struct kvm *kvm, gfn_t gfn, enum pg_level level, > > u64 mirror_spte); > > - > > - /* Update external page tables for page table about to be freed. */ > > void (*reclaim_external_sp)(struct kvm *kvm, gfn_t gfn, > > struct kvm_mmu_page *sp); > > - > > - /* Update external page table from spte getting removed, and flush TLB. */ > > The above two comments are still useful to me. > > Not sure why do you want to remove them, especially in _this_ patch? My intent was to replace the individual comments with a more generic comment for all of the "external" hooks. For things like "and flush TLB", IMO those comments belong at the call sites, not at this point. E.g. _KVM_ doesn't require a TLB flush in all cases. And so for the definition of the hooks, I would prefer a more generic comment, so that if there are details that matter to the usage, they are documented there. > > void (*remove_external_spte)(struct kvm *kvm, gfn_t gfn, enum pg_level level, > > u64 mirror_spte); > > > > + > > Unintentional change? Ya. > > > bool (*has_wbinvd_exit)(void); > > > > u64 (*get_l2_tsc_offset)(struct kvm_vcpu *vcpu); > > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > > index 3911ac9bddfd..9b5a6861e2a4 100644 > > --- a/arch/x86/kvm/mmu/mmu.c > > +++ b/arch/x86/kvm/mmu/mmu.c > > @@ -6690,11 +6690,13 @@ int kvm_mmu_create(struct kvm_vcpu *vcpu) > > vcpu->arch.mmu_page_header_cache.kmem_cache = mmu_page_header_cache; > > vcpu->arch.mmu_page_header_cache.gfp_zero = __GFP_ZERO; > > > > - vcpu->arch.mmu_shadow_page_cache.init_value = > > - SHADOW_NONPRESENT_VALUE; > > + vcpu->arch.mmu_shadow_page_cache.init_value = SHADOW_NONPRESENT_VALUE; > > if (!vcpu->arch.mmu_shadow_page_cache.init_value) > > vcpu->arch.mmu_shadow_page_cache.gfp_zero = __GFP_ZERO; > > Ditto. Not sure this adjustment is intentional? Heh, I'm pretty sure it was intentional, but yeah, doesn't belong here.