All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
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 0/5] Lazy fpu, cr0.ts
Date: Thu, 31 Dec 2009 17:23:13 +0800	[thread overview]
Message-ID: <200912311723.13785.sheng@linux.intel.com> (raw)
In-Reply-To: <1262190342-18611-1-git-send-email-avi@redhat.com>

On Thursday 31 December 2009 00:25:37 Avi Kivity wrote:
> There are currently some inefficiencies in how we virtualize the fpu and
>  cr0:
> 
> - we trap changes to cr0.ts unconditionally; however, when the guest fpu
>   is loaded, we're not really interested in cr0.ts (it's only needed when
>   the host fpu is loaded, to prevent the guest from accessing it)
> - we deactivate the fpu on every guest context switch, for no reason at all
> 
> Fix these issues by being as lazy as possible: deactivate the fpu at
> heavyweight context switch time, and when the fpu is active, give the guest
> ownership of cr0.ts.

Looks fine to me.

-- 
regards
Yang, Sheng

> 
> Joerg, I wasn't able to extend this to svm/npt.  If we switch to the guest
> with the host fpu loaded, then we must set cr0.ts and enable cr0
>  intercepts. I think this is much more expensive than keeping the guest fpu
>  active at all times.
> 
> Avi Kivity (5):
>   KVM: VMX: trace clts and lmsw instructions as cr accesses
>   KVM: Replace read accesses of vcpu->arch.cr0 by an accessor
>   KVM: VMX: Allow the guest to own some cr0 bits
>   KVM: Lazify fpu activation and deactivation
>   KVM: VMX: Give the guest ownership of cr0.ts when the fpu is active
> 
>  arch/x86/include/asm/kvm_host.h |    3 ++
>  arch/x86/kvm/emulate.c          |    6 ++--
>  arch/x86/kvm/kvm_cache_regs.h   |   12 +++++++++
>  arch/x86/kvm/mmu.c              |    2 +-
>  arch/x86/kvm/mmu.h              |    2 +-
>  arch/x86/kvm/svm.c              |   46
>  ++++++++++++++++++++++-------------- arch/x86/kvm/vmx.c              |  
>  48 ++++++++++++++++++++++++-------------- arch/x86/kvm/x86.c             
>  |   26 ++++++++++++---------
>  8 files changed, 93 insertions(+), 52 deletions(-)
> 

      parent reply	other threads:[~2009-12-31  9:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 16:25 [PATCH 0/5] Lazy fpu, cr0.ts Avi Kivity
2009-12-30 16:25 ` [PATCH 1/5] KVM: VMX: trace clts and lmsw instructions as cr accesses Avi Kivity
2009-12-30 16:25 ` [PATCH 2/5] KVM: Replace read accesses of vcpu->arch.cr0 by an accessor Avi Kivity
2009-12-30 16:25 ` [PATCH 3/5] KVM: VMX: Allow the guest to own some cr0 bits Avi Kivity
2009-12-30 16:25 ` [PATCH 4/5] KVM: Lazify fpu activation and deactivation Avi Kivity
2010-01-06  0:25   ` Marcelo Tosatti
2010-01-06  3:18     ` Avi Kivity
2010-01-06  6:21       ` Avi Kivity
2010-01-06 10:47       ` Joerg Roedel
2010-01-06 11:00         ` Avi Kivity
2010-01-14 13:11   ` Avi Kivity
2010-01-14 13:11     ` Avi Kivity
2010-01-14 14:34       ` Lucas Meneghel Rodrigues
2010-01-14 15:04         ` Avi Kivity
2009-12-30 16:25 ` [PATCH 5/5] KVM: VMX: Give the guest ownership of cr0.ts when the fpu is active Avi Kivity
2010-01-06  0:40   ` Marcelo Tosatti
2009-12-31  9:23 ` Sheng Yang [this message]

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=200912311723.13785.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.