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,
Nathan Chancellor <nathan@kernel.org>,
Emanuele Giuseppe Esposito <eesposit@redhat.com>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH 2/6] KVM: VMX: Passthrough MSR_IA32_PRED_CMD based purely on host+guest CPUID
Date: Mon, 27 Mar 2023 11:46:25 +0800 [thread overview]
Message-ID: <541e48f0-9985-885a-d296-4bcd9d5101a3@intel.com> (raw)
In-Reply-To: <20230322011440.2195485-3-seanjc@google.com>
On 3/22/2023 9:14 AM, Sean Christopherson wrote:
> Passthrough MSR_IA32_PRED_CMD based purely on whether or not the MSR is
> supported and enabled, i.e. don't wait until the first write. There's no
> benefit to deferred passthrough, and the extra logic only adds complexity.
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> arch/x86/kvm/vmx/vmx.c | 16 +++-------------
> 1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index f777509ecf17..5c01c76c0d45 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -2298,19 +2298,6 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> break;
>
> wrmsrl(MSR_IA32_PRED_CMD, PRED_CMD_IBPB);
> -
> - /*
> - * For non-nested:
> - * When it's written (to non-zero) for the first time, pass
> - * it through.
> - *
> - * For nested:
> - * The handling of the MSR bitmap for L2 guests is done in
> - * nested_vmx_prepare_msr_bitmap. We should not touch the
> - * vmcs02.msr_bitmap here since it gets completely overwritten
> - * in the merging.
> - */
> - vmx_disable_intercept_for_msr(vcpu, MSR_IA32_PRED_CMD, MSR_TYPE_W);
> break;
> case MSR_IA32_CR_PAT:
> if (!kvm_pat_valid(data))
> @@ -7743,6 +7730,9 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
> vmx_set_intercept_for_msr(vcpu, MSR_IA32_XFD_ERR, MSR_TYPE_R,
> !guest_cpuid_has(vcpu, X86_FEATURE_XFD));
>
> + if (boot_cpu_has(X86_FEATURE_IBPB))
> + vmx_set_intercept_for_msr(vcpu, MSR_IA32_PRED_CMD, MSR_TYPE_W,
> + !guest_has_pred_cmd_msr(vcpu));
>
> set_cr4_guest_host_mask(vmx);
>
next prev parent reply other threads:[~2023-03-27 3:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 1:14 [PATCH 0/6] KVM: x86: Unhost the *_CMD MSR mess Sean Christopherson
2023-03-22 1:14 ` [PATCH 1/6] KVM: x86: Revert MSR_IA32_FLUSH_CMD.FLUSH_L1D enabling Sean Christopherson
2023-03-22 8:15 ` Mathias Krause
2023-03-22 1:14 ` [PATCH 2/6] KVM: VMX: Passthrough MSR_IA32_PRED_CMD based purely on host+guest CPUID Sean Christopherson
2023-03-27 3:46 ` Xiaoyao Li [this message]
2023-03-22 1:14 ` [PATCH 3/6] KVM: SVM: " Sean Christopherson
2023-03-22 1:14 ` [PATCH 4/6] KVM: x86: Move MSR_IA32_PRED_CMD WRMSR emulation to common code Sean Christopherson
2023-03-27 6:41 ` Xiaoyao Li
2023-03-22 1:14 ` [PATCH 5/6] KVM: x86: Virtualize FLUSH_L1D and passthrough MSR_IA32_FLUSH_CMD Sean Christopherson
2023-03-23 5:07 ` Pawan Gupta
2023-03-23 22:17 ` Sean Christopherson
2023-03-24 8:48 ` Zhi Wang
2023-03-27 3:33 ` Xiaoyao Li
2023-03-27 15:37 ` Jim Mattson
2023-03-27 16:00 ` Sean Christopherson
2023-03-22 1:14 ` [PATCH 6/6] KVM: SVM: Return the local "r" variable from svm_set_msr() Sean Christopherson
2023-03-23 22:46 ` [PATCH 0/6] KVM: x86: Unhost the *_CMD MSR mess Sean Christopherson
2023-03-27 15:19 ` Paolo Bonzini
2023-03-27 15:28 ` Sean Christopherson
2023-03-27 15:46 ` Paolo Bonzini
2023-04-12 19:49 ` Paolo Bonzini
2023-04-12 20:00 ` 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=541e48f0-9985-885a-d296-4bcd9d5101a3@intel.com \
--to=xiaoyao.li@intel.com \
--cc=eesposit@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@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
all inboxes | Powered by JetHome®