diff options
author | Boris Ostrovsky <boris.ostrovsky@oracle.com> | 2013-04-15 11:27:32 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-04-15 11:27:32 +0200 |
commit | 055898c9c61d462888941eaede436db4d335890e (patch) | |
tree | a7491be0bf478ca3530c56cf4f39d95defcc0ed8 /xen/arch/x86/domain.c | |
parent | 426368be82b0184df1b537bb659680026b747a50 (diff) | |
download | xen-055898c9c61d462888941eaede436db4d335890e.tar.gz xen-055898c9c61d462888941eaede436db4d335890e.tar.bz2 xen-055898c9c61d462888941eaede436db4d335890e.zip |
x86/VPMU: Save/restore VPMU only when necessary
VPMU doesn't need to always be saved during context switch. If we are
comming back to the same processor and no other VPCU has run here we can
simply continue running. This is especailly useful on Intel processors
where Global Control MSR is stored in VMCS, thus not requiring us to stop
the counters during save operation. On AMD we need to explicitly stop the
counters but we don't need to save them.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Tested-by: Dietmar Hahn <dietmar.hahn@ts.fujitsu.com>
Diffstat (limited to 'xen/arch/x86/domain.c')
-rw-r--r-- | xen/arch/x86/domain.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 0d7a40cc73..6f9cbed7cb 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1535,8 +1535,14 @@ void context_switch(struct vcpu *prev, struct vcpu *next) if (prev != next) update_runstate_area(prev); - if ( is_hvm_vcpu(prev) && !list_empty(&prev->arch.hvm_vcpu.tm_list) ) - pt_save_timer(prev); + if ( is_hvm_vcpu(prev) ) + { + if (prev != next) + vpmu_save(prev); + + if ( !list_empty(&prev->arch.hvm_vcpu.tm_list) ) + pt_save_timer(prev); + } local_irq_disable(); @@ -1574,6 +1580,10 @@ void context_switch(struct vcpu *prev, struct vcpu *next) (next->domain->domain_id != 0)); } + if (is_hvm_vcpu(next) && (prev != next) ) + /* Must be done with interrupts enabled */ + vpmu_load(next); + context_saved(prev); if (prev != next) |