Eddie,

On Fri, Jul 13, 2007 at 08:46:06AM +0800, Dong, Eddie wrote:
> [EMAIL PROTECTED] wrote:
> > Avi,
> > 
> > A couple of months back, we had a discussion about PMU virtualization
> > and the difficulty I encountered trying to catch the PMU interrupt
> > vector in kvm on VM-exit. KVM does not set ack_intr_on_intr. Would
> > you mind reminding me of the reason for this?
> > 
> > On the topic of scheduler hooks for use by KVM, I think this
> > would help me also because it means I would not have to save
> > and restore the PMU registers on all VM-exit/VM-entry. At least
> 
> W/o the hook, the PMU save/restore can be done in heavy weight 
> VM Exit path, the majority of VM Exit are light weight which doesn't
> need to do if you don't care the cycles spent in KVM.
> refer vmx_vcpu_put & vmx_vcpu_load.
> 
I am not sure I understand your terminology about heavy vs. light. 

You do need to stop monitoring on every VM-exit, because you do not
want to continue measuring while in KVM. On VM-entry, then you need
to re-activate. So you can use explcit code to clear a bunch of 
MSR on VM-exit and restore them on VM-entry. Alternatively, you
can use (on VT-x, not on AMD-v) the VT-x feature to automatically
save and restore MSRs on VM-exit/VM-entry. All of this can be done
lazily, i.e., only once you start using the PMU.

On VM-exit, which leads to context switch of the KVM thread, then
you do need to do more work and save the PMU counters. That would
have to be done by software given that VT-x does not know about
Linux context switching. This is where the hooks come in handy.
Same thing on context switch in.

> With hook, then we can further reduce the save/restore effort :-)

-- 

-Stephane

-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to