* Question about guest MSR loading/saving (Intel)
@ 2010-02-02 1:57 Kurt Kiefer
2010-02-02 2:53 ` Sheng Yang
2010-02-04 19:12 ` Avi Kivity
0 siblings, 2 replies; 3+ messages in thread
From: Kurt Kiefer @ 2010-02-02 1:57 UTC (permalink / raw)
To: kvm
Hi all,
This is a vague/general question. For some background: I have a reason
(control of IA32_PERF_GLOBAL_CTRL) for loading/saving MSRs on VM-entry/
exit. To get this to work correctly, I made changes to use the
conventional VMX MSR load areas of the VMCS for this particular MSR.
Works great.
Is there a particular reason why MSRs are currently loaded/saved
through KVM's unconventional facilities (vmx.c:save_msrs(),
vmx.c:load_msrs()), rather than through VM entry/exit MSR load regions
in the VMCS? I see that only long mode guests on x86_64 are effected
by this.
Any insight could be useful. Do you think MSR loading via VMCS would
be faster? Are there downsides to doing it one way or the other?
Kurt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question about guest MSR loading/saving (Intel)
2010-02-02 1:57 Question about guest MSR loading/saving (Intel) Kurt Kiefer
@ 2010-02-02 2:53 ` Sheng Yang
2010-02-04 19:12 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Sheng Yang @ 2010-02-02 2:53 UTC (permalink / raw)
To: kvm; +Cc: Kurt Kiefer
On Tuesday 02 February 2010 09:57:08 Kurt Kiefer wrote:
> Hi all,
>
> This is a vague/general question. For some background: I have a reason
> (control of IA32_PERF_GLOBAL_CTRL) for loading/saving MSRs on VM-entry/
> exit. To get this to work correctly, I made changes to use the
> conventional VMX MSR load areas of the VMCS for this particular MSR.
> Works great.
>
> Is there a particular reason why MSRs are currently loaded/saved
> through KVM's unconventional facilities (vmx.c:save_msrs(),
> vmx.c:load_msrs()), rather than through VM entry/exit MSR load regions
> in the VMCS? I see that only long mode guests on x86_64 are effected
> by this.
>
> Any insight could be useful. Do you think MSR loading via VMCS would
> be faster? Are there downsides to doing it one way or the other?
>
Because not all MSRs are supported for automatically save/load when VMX
transition happened. You used IA32_PERF_GLOBAL_CTRL is supported. But not the
ones saved in save_msrs().
--
regards
Yang, Sheng
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question about guest MSR loading/saving (Intel)
2010-02-02 1:57 Question about guest MSR loading/saving (Intel) Kurt Kiefer
2010-02-02 2:53 ` Sheng Yang
@ 2010-02-04 19:12 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2010-02-04 19:12 UTC (permalink / raw)
To: Kurt Kiefer; +Cc: kvm
On 02/02/2010 03:57 AM, Kurt Kiefer wrote:
> Hi all,
>
> This is a vague/general question. For some background: I have a reason
> (control of IA32_PERF_GLOBAL_CTRL) for loading/saving MSRs on
> VM-entry/exit. To get this to work correctly, I made changes to use
> the conventional VMX MSR load areas of the VMCS for this particular
> MSR. Works great.
>
> Is there a particular reason why MSRs are currently loaded/saved
> through KVM's unconventional facilities (vmx.c:save_msrs(),
> vmx.c:load_msrs()), rather than through VM entry/exit MSR load regions
> in the VMCS? I see that only long mode guests on x86_64 are effected
> by this.
>
> Any insight could be useful. Do you think MSR loading via VMCS would
> be faster? Are there downsides to doing it one way or the other?
kvm doesn't switch msrs on every entry/exit. For example, the syscall
msrs are only used by the syscall/sysret instructions, so we only switch
them before returning to userspace, which happens much less frequently
than vmexits.
The PMU is used by the processor at all times, so it makes perfect sense
to use the vmx autoload/autosave regions for that.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-04 19:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 1:57 Question about guest MSR loading/saving (Intel) Kurt Kiefer
2010-02-02 2:53 ` Sheng Yang
2010-02-04 19:12 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox