public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	 Yan Zhao <yan.y.zhao@intel.com>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	 Isaku Yamahata <isaku.yamahata@intel.com>,
	Tony Lindgren <tony.lindgren@linux.intel.com>,
	 Sean Christopherson <sean.j.christopherson@intel.com>,
	Kai Huang <kai.huang@intel.com>,
	 Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH 23/33] KVM: TDX: create/destroy VM structure
Date: Wed, 25 Jun 2025 09:12:54 -0700	[thread overview]
Message-ID: <aFwgBs2Gdvcj98nH@google.com> (raw)
In-Reply-To: <543bcbd5-c217-41f7-b478-e32e6dcf66dc@intel.com>

On Wed, Jun 25, 2025, Dave Hansen wrote:
> On 2/26/25 10:14, Paolo Bonzini wrote:
> > +static void tdx_clear_page(struct page *page)
> > +{
> > +	const void *zero_page = (const void *) page_to_virt(ZERO_PAGE(0));
> > +	void *dest = page_to_virt(page);
> > +	unsigned long i;
> > +
> > +	/*
> > +	 * The page could have been poisoned.  MOVDIR64B also clears
> > +	 * the poison bit so the kernel can safely use the page again.
> > +	 */
> > +	for (i = 0; i < PAGE_SIZE; i += 64)
> > +		movdir64b(dest + i, zero_page);
> > +	/*
> > +	 * MOVDIR64B store uses WC buffer.  Prevent following memory reads
> > +	 * from seeing potentially poisoned cache.
> > +	 */
> > +	__mb();
> > +}
> 
> Hey guys,
> 
> This ended up in KVM code when we already have the *VERY* similar
> reset_tdx_pages().
> 
> Could we consolidate them, please? There's no reason to sprinkle
> knowledge of movdir64b's memory ordering rules all across the tree.
> 
> Adrian, this is probably something to go do, first, before you try and
> poke at this code that probably shouldn't be in KVM in the first place.

+1

  reply	other threads:[~2025-06-25 16:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 18:14 [PATCH v4 00/33] TDX initialization + vCPU/VM creation Paolo Bonzini
2025-02-26 18:14 ` [PATCH 01/33] KVM: x86: Free vCPUs before freeing VM state Paolo Bonzini
2025-02-26 18:14 ` [PATCH 02/33] KVM: x86: move vm_destroy callback at end of kvm_arch_destroy_vm Paolo Bonzini
2025-02-26 18:14 ` [PATCH 03/33] KVM: x86: Don't load/put vCPU when unloading its MMU during teardown Paolo Bonzini
2025-02-26 18:14 ` [PATCH 04/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX KeyID management Paolo Bonzini
2025-02-26 18:14 ` [PATCH 05/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX TD creation Paolo Bonzini
2025-02-26 18:14 ` [PATCH 06/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX vCPU creation Paolo Bonzini
2025-02-26 18:14 ` [PATCH 07/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX page cache management Paolo Bonzini
2025-03-03  0:22   ` Chenyi Qiang
2025-02-26 18:14 ` [PATCH 08/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX VM/vCPU field access Paolo Bonzini
2025-02-26 18:14 ` [PATCH 09/33] x86/virt/tdx: Add SEAMCALL wrappers for TDX flush operations Paolo Bonzini
2025-02-26 18:14 ` [PATCH 10/33] x86/virt/tdx: allocate tdx_sys_info in static memory Paolo Bonzini
2025-02-26 18:14 ` [PATCH 11/33] x86/virt/tdx: Read essential global metadata for KVM Paolo Bonzini
2025-02-26 18:14 ` [PATCH 12/33] x86/virt/tdx: Add tdx_guest_keyid_alloc/free() to alloc and free TDX guest KeyID Paolo Bonzini
2025-02-26 18:14 ` [PATCH 13/33] KVM: Export hardware virtualization enabling/disabling functions Paolo Bonzini
2025-02-26 18:14 ` [PATCH 14/33] KVM: VMX: Refactor VMX module init/exit functions Paolo Bonzini
2025-02-26 18:14 ` [PATCH 15/33] KVM: VMX: Initialize TDX during KVM module load Paolo Bonzini
2025-02-26 18:14 ` [PATCH 16/33] KVM: TDX: Get TDX global information Paolo Bonzini
2025-02-26 18:14 ` [PATCH 17/33] KVM: TDX: Add placeholders for TDX VM/vCPU structures Paolo Bonzini
2025-02-26 18:14 ` [PATCH 18/33] KVM: TDX: Define TDX architectural definitions Paolo Bonzini
2025-02-26 18:14 ` [PATCH 19/33] KVM: TDX: Add TDX "architectural" error codes Paolo Bonzini
2025-02-26 18:14 ` [PATCH 20/33] KVM: TDX: Add helper functions to print TDX SEAMCALL error Paolo Bonzini
2025-02-26 18:14 ` [PATCH 21/33] KVM: TDX: Add place holder for TDX VM specific mem_enc_op ioctl Paolo Bonzini
2025-02-26 18:14 ` [PATCH 22/33] KVM: TDX: Get system-wide info about TDX module on initialization Paolo Bonzini
2025-02-26 18:14 ` [PATCH 23/33] KVM: TDX: create/destroy VM structure Paolo Bonzini
2025-06-25 15:46   ` Dave Hansen
2025-06-25 16:12     ` Sean Christopherson [this message]
2025-02-26 18:14 ` [PATCH 24/33] KVM: TDX: Support per-VM KVM_CAP_MAX_VCPUS extension check Paolo Bonzini
2025-02-26 18:14 ` [PATCH 25/33] KVM: x86: expose cpuid_entry2_find for TDX Paolo Bonzini
2025-02-26 22:03   ` Huang, Kai
2025-02-26 18:14 ` [PATCH 26/33] KVM: TDX: add ioctl to initialize VM with TDX specific parameters Paolo Bonzini
2025-02-26 18:14 ` [PATCH 27/33] KVM: TDX: Make pmu_intel.c ignore guest TD case Paolo Bonzini
2025-02-26 18:14 ` [PATCH 28/33] KVM: TDX: Don't offline the last cpu of one package when there's TDX guest Paolo Bonzini
2025-02-26 18:14 ` [PATCH 29/33] KVM: TDX: create/free TDX vcpu structure Paolo Bonzini
2025-02-26 18:14 ` [PATCH 30/33] KVM: TDX: Do TDX specific vcpu initialization Paolo Bonzini
2025-02-26 18:14 ` [PATCH 31/33] KVM: x86: Introduce KVM_TDX_GET_CPUID Paolo Bonzini
2025-02-26 18:14 ` [PATCH 32/33] KVM: x86/mmu: Taking guest pa into consideration when calculate tdp level Paolo Bonzini
2025-02-26 18:14 ` [PATCH 33/33] KVM: TDX: Register TDX host key IDs to cgroup misc controller Paolo Bonzini
2025-02-28  1:56   ` Chenyi Qiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aFwgBs2Gdvcj98nH@google.com \
    --to=seanjc@google.com \
    --cc=adrian.hunter@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tony.lindgren@linux.intel.com \
    --cc=yan.y.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox