kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Joerg Roedel <joerg.roedel@amd.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 3/3] KVM: SVM: Lazy fpu for npt
Date: Thu, 7 Jan 2010 17:52:04 +0100	[thread overview]
Message-ID: <20100107165204.GA17809@8bytes.org> (raw)
In-Reply-To: <1262866544-4985-4-git-send-email-avi@redhat.com>

On Thu, Jan 07, 2010 at 02:15:44PM +0200, Avi Kivity wrote:
> If two conditions apply:
>  - no bits outside TS and EM differ between the host and guest cr0
>  - the fpu is active
> 
> then we can activate the selective cr0 write intercept and drop the
> unconditional cr0 read and write intercept, and allow the guest to run
> with the host fpu state.  This reduces the heavyweight context switch
> when npt is enabled.


> -	if (npt_enabled) {
> -		int mmu_reload = 0;
> -		if ((kvm_read_cr0_bits(vcpu, X86_CR0_PG) ^ svm->vmcb->save.cr0)
> -		    & X86_CR0_PG) {
> -			svm_set_cr0(vcpu, svm->vmcb->save.cr0);
> -			mmu_reload = 1;
> -		}
> +	if (!(svm->vmcb->control.intercept_cr_write & INTERCEPT_CR0_MASK))
>  		vcpu->arch.cr0 = svm->vmcb->save.cr0;
> +	if (npt_enabled)
>  		vcpu->arch.cr3 = svm->vmcb->save.cr3;
> -		if (mmu_reload) {
> -			kvm_mmu_reset_context(vcpu);
> -			kvm_mmu_load(vcpu);
> -		}
> -	}
> -

Hmm, I think removing this hack is a seperate issue. Should it be a
sepearte patch which enables cr0 intercept for npt and removes these
lines? It makes this change more clear in the logs.

Joerg


  reply	other threads:[~2010-01-07 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-07 12:15 [PATCH 0/3] Lazy fpu for svm/npt Avi Kivity
2010-01-07 12:15 ` [PATCH 1/3] KVM: SVM: Fix SVM_CR0_SELECTIVE_MASK Avi Kivity
2010-01-07 12:15 ` [PATCH 2/3] KVM: SVM: Initialize fpu_active in init_vmcb() Avi Kivity
2010-01-07 12:15 ` [PATCH 3/3] KVM: SVM: Lazy fpu for npt Avi Kivity
2010-01-07 16:52   ` Joerg Roedel [this message]
2010-01-07 16:55     ` Avi Kivity

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=20100107165204.GA17809@8bytes.org \
    --to=joro@8bytes.org \
    --cc=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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).