From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH 3/3] KVM: SVM: Lazy fpu for npt Date: Thu, 7 Jan 2010 17:52:04 +0100 Message-ID: <20100107165204.GA17809@8bytes.org> References: <1262866544-4985-1-git-send-email-avi@redhat.com> <1262866544-4985-4-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Marcelo Tosatti , Joerg Roedel , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from 8bytes.org ([88.198.83.132]:50213 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752933Ab0AGRAF (ORCPT ); Thu, 7 Jan 2010 12:00:05 -0500 Content-Disposition: inline In-Reply-To: <1262866544-4985-4-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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