mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "kirill.shutemov@linux.intel.com" <kirill.shutemov@linux.intel.com>
Cc: "luto@kernel.org" <luto@kernel.org>,
	"ashish.kalra@amd.com" <ashish.kalra@amd.com>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"seanjc@google.com" <seanjc@google.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"bhe@redhat.com" <bhe@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"nik.borisov@suse.com" <nik.borisov@suse.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"Gao, Chao" <chao.gao@intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH v2 2/5] x86/kexec: do unconditional WBINVD in relocate_kernel()
Date: Mon, 1 Apr 2024 09:13:50 +0000	[thread overview]
Message-ID: <554c27ac68dfc1190f8f932db6a43e622283a978.camel@intel.com> (raw)
In-Reply-To: <unsk2vaqeyh4a3zckf3vd3vxuv7rgtjq7dzv2kfdqrjjy6tvkl@rg5p46djnhmy>

> > > > > > 
> 
> > 
> > Anyway, the current TDX guest doesn't handle #VE due to WBINVD, so I think for
> > simplicity we just don't do WBINVD in stop_this_cpu() and relocate_kernel() for
> > both TDX and SNP/SEV-ES guests.
> > 
> > As mentioned in my earlier reply, we can achieve this by skipping WBINVD when
> > the CC_ATTR_GUEST_MEM_ENCRYPT is true:
> > 
> > 	if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
> > 		native_wbinvd();  
> > 
> > (This skips WBINVD for plain SEV guest too, but this exactly is the current
> > behaviour of the upstream code, so I don't see any problem.)
> > 
> > Alternatively, we can have a dedicated CPU feature flag such as
> > X86_FEATURE_NO_WBINVD,
> > 
> > 	if (!boot_cpu_has(X86_FEATURE_NO_WBINVD))
> > 		native_wbinvd();
> > 
> > Or, we can just change to our mindset to "do unconditional WBINVD, but not in
> > virtualized environment":
> > 
> > 	if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
> > 		native_wbinvd();
> 
> ACPI_FLUSH_CPU_CACHE() uses cpu_feature_enabled(X86_FEATURE_HYPERVISOR)
> check.
> 
> 

Thanks for pointing out this.  Yeah I think skipping WBINVD in virtualized
environment makes sense.  Will use this way.



  reply	other threads:[~2024-04-01  9:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  1:48 [PATCH v2 0/5] TDX host: kexec() support Kai Huang
2024-03-19  1:48 ` [PATCH v2 1/5] x86/kexec: do unconditional WBINVD in stop_this_cpu() Kai Huang
2024-03-19  1:48 ` [PATCH v2 2/5] x86/kexec: do unconditional WBINVD in relocate_kernel() Kai Huang
2024-03-19 11:13   ` Kirill A. Shutemov
2024-03-19 14:38     ` Tom Lendacky
2024-03-19 21:20       ` Huang, Kai
2024-03-20  0:19         ` Kirill A. Shutemov
2024-03-20  0:45           ` Huang, Kai
2024-03-20 12:51             ` Kirill A. Shutemov
2024-03-20 13:49         ` Tom Lendacky
2024-03-20 20:48           ` Huang, Kai
2024-03-20 21:06             ` Tom Lendacky
2024-03-20 21:58               ` Huang, Kai
2024-03-20 23:10             ` Kirill A. Shutemov
2024-03-21 21:02               ` Tom Lendacky
2024-03-22 10:40                 ` Kirill A. Shutemov
2024-03-22 14:50                   ` Tom Lendacky
2024-03-25 13:04                     ` Huang, Kai
2024-03-28 16:10                       ` kirill.shutemov
2024-04-01  9:13                         ` Huang, Kai [this message]
2024-03-19 15:41   ` Borislav Petkov
2024-03-19 21:08     ` Huang, Kai
2024-03-19  1:48 ` [PATCH v2 3/5] x86/kexec: Reset TDX private memory on platforms with TDX erratum Kai Huang
2024-03-19  1:48 ` [PATCH v2 4/5] x86/virt/tdx: Remove the !KEXEC_CORE dependency Kai Huang
2024-03-19  1:48 ` [PATCH v2 5/5] x86/virt/tdx: Add TDX memory reset notifier to reset other private pages Kai Huang

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=554c27ac68dfc1190f8f932db6a43e622283a978.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=ashish.kalra@amd.com \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nik.borisov@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®