From: Anthony Liguori <anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH][SVM] Only save/restore MSRs when needed
Date: Sat, 28 Apr 2007 19:37:16 -0500 [thread overview]
Message-ID: <4633E8BC.1020407@codemonkey.ws> (raw)
In-Reply-To: <4632E780.8060907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Avi Kivity wrote:
> Anthony Liguori wrote:
>
>> Anthony Liguori wrote:
>>
>>> I've tested this with 32-bit and 64-bit guests on a 64-bit host and
>>> with 32-bit guests on a 32-bit host.
>>>
>>> I *think* it's doing the right thing wrt to DEBUGCTL but an extra set
>>> of eyes would be helpful.
>>>
>> I think the follow patch preserves the current behavior but I'm
>> starting to believe that the current behavior is wrong.
>>
>> The current code assumes that the guest DEBUGCTL gets loaded/saved
>> during vmrun/vmexit. By my reading of the spec (I finally printed out
>> the new one :-)), DEBUGCTL only gets saved if LBR virtualization is
>> enabled. LBR virtualization also triggers the save/restore of the
>> other 4 debug registers. The spec seems to suggest that the host
>> version is saved before the guest is loaded too.
>>
>> I think the right behavior is to do nothing if LBR is available and
>> enabled; hw will do it all for us. If LBR isn't available, I think we
>> should be saving/restoring not just DEBUGCTL but the other 4. We can
>> further optimize that path though by doing the same sort of tricks I
>> have below.
>>
>> If that all seems sane, I'll submit another patch to fix that up.
>>
>>
>
> Some observations from grepping the sources:
>
> - The host never uses the DEBUGCTL msr. So we only need to restore it
> (to zero) if the guest changes it.
> - The guest never uses the DEBUGCTL msr, as kvm doesn't handle wrmsr to
> DEBUGCTL.
>
> So, doing nothing (in hardware and software) would probably work well
> and be quite fast. If we ever emulate DEBUGCTL, we can conditionally
> enable hardware or software save/restore (this is fairly similar to lazy
> fpu).
Okay, so I'll resubmit with DEBUGCTL disabled (including lbr_enable =
0). I'll also see if I can find something that uses DEBUGCTL.
Regards,
Anthony Liguori
> If Linux ever gets DEBUGCTL support, we'd just ask for a hook so
> we can conditionally save and restore on the host side.
>
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
prev parent reply other threads:[~2007-04-29 0:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-27 23:30 [PATCH][SVM] Only save/restore MSRs when needed Anthony Liguori
[not found] ` <4632878B.6090606-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-04-28 5:14 ` Anthony Liguori
[not found] ` <4632D841.6060202-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-04-28 6:19 ` Avi Kivity
[not found] ` <4632E780.8060907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-29 0:37 ` Anthony Liguori [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=4633E8BC.1020407@codemonkey.ws \
--to=anthony-rdkfgonbjusknkdkm+me6a@public.gmane.org \
--cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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