lkml.org 
[lkml]   [2010]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 09/10] KVM: SVM: Make lazy FPU switching work with nested svm
On 02/18/2010 01:38 PM, Joerg Roedel wrote:
> TDB.
>
>

...

> @@ -973,6 +973,7 @@ static void svm_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
>
> static void update_cr0_intercept(struct vcpu_svm *svm)
> {
> + struct vmcb *vmcb = svm->vmcb;
> ulong gcr0 = svm->vcpu.arch.cr0;
> u64 *hcr0 =&svm->vmcb->save.cr0;
>
> @@ -984,11 +985,25 @@ static void update_cr0_intercept(struct vcpu_svm *svm)
>
>
> if (gcr0 == *hcr0&& svm->vcpu.fpu_active) {
> - svm->vmcb->control.intercept_cr_read&= ~INTERCEPT_CR0_MASK;
> - svm->vmcb->control.intercept_cr_write&= ~INTERCEPT_CR0_MASK;
> + vmcb->control.intercept_cr_read&= ~INTERCEPT_CR0_MASK;
> + vmcb->control.intercept_cr_write&= ~INTERCEPT_CR0_MASK;
> + if (is_nested(svm)) {
> + struct vmcb *hsave = svm->nested.hsave;
> +
> + hsave->control.intercept_cr_read&= ~INTERCEPT_CR0_MASK;
> + hsave->control.intercept_cr_write&= ~INTERCEPT_CR0_MASK;
> + vmcb->control.intercept_cr_read |= svm->nested.intercept_cr_read;
> + vmcb->control.intercept_cr_write |= svm->nested.intercept_cr_write;
>

Why are the last two lines needed?

> + }
> } else {
> svm->vmcb->control.intercept_cr_read |= INTERCEPT_CR0_MASK;
> svm->vmcb->control.intercept_cr_write |= INTERCEPT_CR0_MASK;
> + if (is_nested(svm)) {
> + struct vmcb *hsave = svm->nested.hsave;
> +
> + hsave->control.intercept_cr_read |= INTERCEPT_CR0_MASK;
> + hsave->control.intercept_cr_write |= INTERCEPT_CR0_MASK;
> + }
> }
> }
>

Maybe it's better to call update_cr0_intercept() after a vmexit instead,
to avoid this repetition, and since the if () may take a different
branch for the nested guest and guest cr0.


--
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2010-02-18 15:35    [W:0.092 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site