All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, Dexuan Cui <dexuan.cui@intel.com>
Subject: Re: [PATCH v4] KVM: VMX: Enable XSAVE/XRSTORE for guest
Date: Mon, 24 May 2010 16:40:51 +0300	[thread overview]
Message-ID: <4BFA81E3.1020205@redhat.com> (raw)
In-Reply-To: <4BFA80CC.9070800@redhat.com>

On 05/24/2010 04:36 PM, Avi Kivity wrote:
>
> may be simplified if we move xcr0 reload back to guest entry (... :)  
> but make it lazy:
>
>   save_host_state: nothing
>   set cr4.osxsave: nothing
>   clear cr4.osxsave: nothing
>   guest entry: if (gcr4.osxsave && !guest_xcr0_loaded) { 
> guest_xcr0_loaded = true, load gxcr0 }
>   load_host_state: if (guest_xcr0_loaded) { guest_xcr0_loaded = false; 
> load host xcr0 }
>   fpu switching:  if (guest_xcr0_loaded) { guest_xcr0_loaded = false; 
> load host xcr0 }, do fpu stuff
>
> So we delay xcr0 reload as late as possible for both entry and exit.
>

btw, this is similar to how we switch the fpu itself: 
if-needed-and-not-already-loaded on guest entry, if-loaded on vcpu_put.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2010-05-24 13:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 10:03 [PATCH v4] KVM: VMX: Enable XSAVE/XRSTORE for guest Sheng Yang
2010-05-24 13:36 ` Avi Kivity
2010-05-24 13:40   ` Avi Kivity [this message]
2010-05-25  6:28   ` Sheng Yang
2010-05-25  7:14     ` Avi Kivity
2010-05-24 13:47 ` 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=4BFA81E3.1020205@redhat.com \
    --to=avi@redhat.com \
    --cc=dexuan.cui@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=sheng@linux.intel.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.