* KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run
@ 2009-10-20 12:37 Marcelo Tosatti
2009-10-20 13:14 ` Avi Kivity
2009-10-22 7:35 ` Sheng Yang
0 siblings, 2 replies; 6+ messages in thread
From: Marcelo Tosatti @ 2009-10-20 12:37 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value
changes.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 364263a..325075f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3638,10 +3638,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
- if (enable_ept && is_paging(vcpu)) {
- vmcs_writel(GUEST_CR3, vcpu->arch.cr3);
+ if (enable_ept && is_paging(vcpu))
ept_load_pdptrs(vcpu);
- }
+
/* Record the guest's net vcpu time for enforced NMI injections. */
if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
vmx->entry_time = ktime_get();
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run
2009-10-20 12:37 KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run Marcelo Tosatti
@ 2009-10-20 13:14 ` Avi Kivity
2009-10-20 13:59 ` Marcelo Tosatti
2009-10-22 7:35 ` Sheng Yang
1 sibling, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2009-10-20 13:14 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kvm
On 10/20/2009 09:37 PM, Marcelo Tosatti wrote:
> GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value
> changes.
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 364263a..325075f 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3638,10 +3638,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
> {
> struct vcpu_vmx *vmx = to_vmx(vcpu);
>
> - if (enable_ept&& is_paging(vcpu)) {
> - vmcs_writel(GUEST_CR3, vcpu->arch.cr3);
> + if (enable_ept&& is_paging(vcpu))
> ept_load_pdptrs(vcpu);
> - }
> +
> /* Record the guest's net vcpu time for enforced NMI injections. */
> if (unlikely(!cpu_has_virtual_nmis()&& vmx->soft_vnmi_blocked))
> vmx->entry_time = ktime_get();
>
Nice. Any reason why ept_load_pdptrs() couldn't go the same way?
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run
2009-10-20 13:14 ` Avi Kivity
@ 2009-10-20 13:59 ` Marcelo Tosatti
2009-10-22 7:06 ` Avi Kivity
0 siblings, 1 reply; 6+ messages in thread
From: Marcelo Tosatti @ 2009-10-20 13:59 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
On Tue, Oct 20, 2009 at 10:14:52PM +0900, Avi Kivity wrote:
> On 10/20/2009 09:37 PM, Marcelo Tosatti wrote:
>> GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value
>> changes.
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 364263a..325075f 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -3638,10 +3638,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
>> {
>> struct vcpu_vmx *vmx = to_vmx(vcpu);
>>
>> - if (enable_ept&& is_paging(vcpu)) {
>> - vmcs_writel(GUEST_CR3, vcpu->arch.cr3);
>> + if (enable_ept&& is_paging(vcpu))
>> ept_load_pdptrs(vcpu);
>> - }
>> +
>> /* Record the guest's net vcpu time for enforced NMI injections. */
>> if (unlikely(!cpu_has_virtual_nmis()&& vmx->soft_vnmi_blocked))
>> vmx->entry_time = ktime_get();
>>
>
> Nice. Any reason why ept_load_pdptrs() couldn't go the same way?
Its already protected by VCPU_EXREG_PDPTR caching, so it does not buy
much.
The advantage would symmetry to cr3.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run
2009-10-20 13:59 ` Marcelo Tosatti
@ 2009-10-22 7:06 ` Avi Kivity
0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-10-22 7:06 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kvm
On 10/20/2009 04:59 PM, Marcelo Tosatti wrote:
>
>
>> Nice. Any reason why ept_load_pdptrs() couldn't go the same way?
>>
> Its already protected by VCPU_EXREG_PDPTR caching, so it does not buy
> much.
>
> The advantage would symmetry to cr3.
>
>
Yes, the PDPTRs fulfil exactly the same role as cr3, so the same rules
should apply.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run
2009-10-20 12:37 KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run Marcelo Tosatti
2009-10-20 13:14 ` Avi Kivity
@ 2009-10-22 7:35 ` Sheng Yang
2009-10-22 7:48 ` Avi Kivity
1 sibling, 1 reply; 6+ messages in thread
From: Sheng Yang @ 2009-10-22 7:35 UTC (permalink / raw)
To: kvm; +Cc: Marcelo Tosatti, Avi Kivity
On Tuesday 20 October 2009 20:37:20 Marcelo Tosatti wrote:
> GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value
> changes.
The description is not that accuracy... If CR3 value change in guest when EPT
enabled, no VM Exit would happen, then no kvm_set_cr3...
--
regards
Yang, Sheng
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 364263a..325075f 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3638,10 +3638,9 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
> {
> struct vcpu_vmx *vmx = to_vmx(vcpu);
>
> - if (enable_ept && is_paging(vcpu)) {
> - vmcs_writel(GUEST_CR3, vcpu->arch.cr3);
> + if (enable_ept && is_paging(vcpu))
> ept_load_pdptrs(vcpu);
> - }
> +
> /* Record the guest's net vcpu time for enforced NMI injections. */
> if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked))
> vmx->entry_time = ktime_get();
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run
2009-10-22 7:35 ` Sheng Yang
@ 2009-10-22 7:48 ` Avi Kivity
0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-10-22 7:48 UTC (permalink / raw)
To: Sheng Yang; +Cc: kvm, Marcelo Tosatti
On 10/22/2009 09:35 AM, Sheng Yang wrote:
> On Tuesday 20 October 2009 20:37:20 Marcelo Tosatti wrote:
>
>> GUEST_CR3 is updated via kvm_set_cr3 whenever CR3 value
>> changes.
>>
> The description is not that accuracy... If CR3 value change in guest when EPT
> enabled, no VM Exit would happen, then no kvm_set_cr3...
>
True, should be 'changed from userspace'.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-22 7:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20 12:37 KVM: VMX: remove GUEST_CR3 write from vmx_vcpu_run Marcelo Tosatti
2009-10-20 13:14 ` Avi Kivity
2009-10-20 13:59 ` Marcelo Tosatti
2009-10-22 7:06 ` Avi Kivity
2009-10-22 7:35 ` Sheng Yang
2009-10-22 7:48 ` Avi Kivity
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).