From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/9] KVM: x86: add pcommit support
Date: Tue, 8 Sep 2015 22:17:19 +0800 [thread overview]
Message-ID: <55EEEDEF.4070902@linux.intel.com> (raw)
In-Reply-To: <55ED729F.2020107@redhat.com>
On 09/07/2015 07:18 PM, Paolo Bonzini wrote:
>>
>> +static int handle_pcommit(struct kvm_vcpu *vcpu)
>> +{
>> + /* we never catch pcommit instruct for L1 guest. */
>> + BUG();
>
> Please WARN instead.
>
Okay.
>> + return 1;
>> +}
>> +
>> /*
>> * The exit handlers return 1 if the exit was handled fully and guest execution
>> * may resume. Otherwise they set the kvm_run parameter to indicate what needs
>> @@ -7258,6 +7269,7 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
>> [EXIT_REASON_XSAVES] = handle_xsaves,
>> [EXIT_REASON_XRSTORS] = handle_xrstors,
>> [EXIT_REASON_PML_FULL] = handle_pml_full,
>> + [EXIT_REASON_PCOMMIT] = handle_pcommit,
>> };
>>
>> static const int kvm_vmx_max_exit_handlers =
>> @@ -7559,6 +7571,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
>> * the XSS exit bitmap in vmcs12.
>> */
>> return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
>> + case EXIT_REASON_PCOMMIT:
>> + return nested_cpu_has2(vmcs12, SECONDARY_EXEC_PCOMMIT);
>> default:
>> return true;
>> }
>> @@ -8688,6 +8702,10 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
>> if (best)
>> best->ebx &= ~bit(X86_FEATURE_INVPCID);
>> }
>> +
>> + if (!guest_cpuid_has_pcommit(vcpu) && nested)
>> + vmx->nested.nested_vmx_secondary_ctls_high &=
>> + ~SECONDARY_EXEC_PCOMMIT;
>
> Why is this needed?
>
If pcommit is not allowed in L1 guest, L1 is not allowed to intercept pcommit
for L2.
BTW, the spec saied:
| IA32_VMX_PROCBASED_CTLS2[53] (which enumerates support for the 1-setting of “PCOMMIT exiting”) is
| always the same as CPUID.07H:EBX.PCOMMIT[bit 22]. Thus, software can set “PCOMMIT exiting” to 1
| if and only if the PCOMMIT instruction is enumerated via CPUID
next prev parent reply other threads:[~2015-09-08 14:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 4:50 [PATCH 0/9] KVM: x86: enable cflushopt/clwb/pcommit and simplify code Xiao Guangrong
2015-08-21 4:50 ` [PATCH 1/9] KVM: MMU: fix use uninitialized value Xiao Guangrong
2015-08-21 4:50 ` [PATCH 2/9] KVM: x86: allow guest to use cflushopt anc clwb Xiao Guangrong
2015-08-21 4:50 ` [PATCH 3/9] KVM: x86: add pcommit support Xiao Guangrong
2015-09-07 11:18 ` Paolo Bonzini
2015-09-08 14:17 ` Xiao Guangrong [this message]
2015-09-08 20:33 ` Paolo Bonzini
2015-08-21 4:50 ` [PATCH 4/9] KVM: VMX: drop rdtscp_enabled check in prepare_vmcs02() Xiao Guangrong
2015-08-21 4:50 ` [PATCH 5/9] KVM: VMX: simplify rdtscp handling in vmx_cpuid_update() Xiao Guangrong
2015-08-21 4:50 ` [PATCH 6/9] KVM: VMX: simplify invpcid " Xiao Guangrong
2015-09-07 11:28 ` Paolo Bonzini
2015-09-08 14:18 ` Xiao Guangrong
2015-08-21 4:50 ` [PATCH 7/9] KVM: VMX: unify SECONDARY_VM_EXEC_CONTROL update Xiao Guangrong
2015-08-21 4:50 ` [PATCH 8/9] KVM: VMX: introduce set_clear_2nd_exec_ctrl() Xiao Guangrong
2015-09-07 11:27 ` Paolo Bonzini
2015-09-08 14:24 ` Xiao Guangrong
2015-09-08 20:32 ` Paolo Bonzini
2015-08-21 4:50 ` [PATCH 9/9] KVM: VMX: drop rdtscp_enabled field Xiao Guangrong
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=55EEEDEF.4070902@linux.intel.com \
--to=guangrong.xiao@linux.intel.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.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;
as well as URLs for NNTP newsgroup(s).