From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Chao Gao <chao.gao@intel.com>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Subject: Re: [PATCH 2/2] KVM: VMX: Drop unnecessary vmx_fb_clear_ctrl_available "cache"
Date: Thu, 8 Jun 2023 11:15:00 +0800 [thread overview]
Message-ID: <217febbf-07fd-32dd-de6b-2e767de6a9eb@intel.com> (raw)
In-Reply-To: <20230607004311.1420507-3-seanjc@google.com>
On 6/7/2023 8:43 AM, Sean Christopherson wrote:
> Now that KVM snapshots the host's MSR_IA32_ARCH_CAPABILITIES, drop the
> similar snapshot/cache of whether or not KVM is allowed to manipulate
> ARCH_CAPABILITIES.FB_CLEAR_CTRL. The motivation for the cache was
> presumably to avoid the RDMSR, e.g. boot_cpu_has_bug() is quite cheap, and
> modifying the vCPU's MSR_IA32_ARCH_CAPABILITIES is an infrequent option
> and a relatively slow path.
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Cc: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> arch/x86/kvm/vmx/vmx.c | 17 +++--------------
> 1 file changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 42d1148f933c..17003660138a 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -237,9 +237,6 @@ static const struct {
> #define L1D_CACHE_ORDER 4
> static void *vmx_l1d_flush_pages;
>
> -/* Control for disabling CPU Fill buffer clear */
> -static bool __read_mostly vmx_fb_clear_ctrl_available;
> -
> static int vmx_setup_l1d_flush(enum vmx_l1d_flush_state l1tf)
> {
> struct page *page;
> @@ -366,14 +363,6 @@ static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp)
> return sprintf(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option);
> }
>
> -static void vmx_setup_fb_clear_ctrl(void)
> -{
> - if ((host_arch_capabilities & ARCH_CAP_FB_CLEAR_CTRL) &&
> - !boot_cpu_has_bug(X86_BUG_MDS) &&
> - !boot_cpu_has_bug(X86_BUG_TAA))
> - vmx_fb_clear_ctrl_available = true;
> -}
> -
> static __always_inline void vmx_disable_fb_clear(struct vcpu_vmx *vmx)
> {
> u64 msr;
> @@ -399,7 +388,9 @@ static __always_inline void vmx_enable_fb_clear(struct vcpu_vmx *vmx)
>
> static void vmx_update_fb_clear_dis(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx)
> {
> - vmx->disable_fb_clear = vmx_fb_clear_ctrl_available;
> + vmx->disable_fb_clear = (host_arch_capabilities & ARCH_CAP_FB_CLEAR_CTRL) &&
> + !boot_cpu_has_bug(X86_BUG_MDS) &&
> + !boot_cpu_has_bug(X86_BUG_TAA);
>
> /*
> * If guest will not execute VERW, there is no need to set FB_CLEAR_DIS
> @@ -8580,8 +8571,6 @@ static int __init vmx_init(void)
> if (r)
> goto err_l1d_flush;
>
> - vmx_setup_fb_clear_ctrl();
> -
> for_each_possible_cpu(cpu) {
> INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu));
>
next prev parent reply other threads:[~2023-06-08 3:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 0:43 [PATCH 0/2] KVM: x86: Snapshot host MSR_IA32_ARCH_CAPABILITIES Sean Christopherson
2023-06-07 0:43 ` [PATCH 1/2] KVM: x86: Snapshot host's MSR_IA32_ARCH_CAPABILITIES Sean Christopherson
2023-06-08 3:12 ` Xiaoyao Li
2023-06-12 8:34 ` Chao Gao
2023-06-07 0:43 ` [PATCH 2/2] KVM: VMX: Drop unnecessary vmx_fb_clear_ctrl_available "cache" Sean Christopherson
2023-06-07 20:20 ` Pawan Gupta
2023-06-08 3:15 ` Xiaoyao Li [this message]
2023-08-03 0:04 ` [PATCH 0/2] KVM: x86: Snapshot host MSR_IA32_ARCH_CAPABILITIES Sean Christopherson
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=217febbf-07fd-32dd-de6b-2e767de6a9eb@intel.com \
--to=xiaoyao.li@intel.com \
--cc=chao.gao@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.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