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/include/asm-x86/hvm | |
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/include/asm-x86/hvm')
-rw-r--r-- | xen/include/asm-x86/hvm/vpmu.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/xen/include/asm-x86/hvm/vpmu.h b/xen/include/asm-x86/hvm/vpmu.h index 01be97683e..03b9462317 100644 --- a/xen/include/asm-x86/hvm/vpmu.h +++ b/xen/include/asm-x86/hvm/vpmu.h @@ -52,7 +52,7 @@ struct arch_vpmu_ops { unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx); void (*arch_vpmu_destroy)(struct vcpu *v); - void (*arch_vpmu_save)(struct vcpu *v); + int (*arch_vpmu_save)(struct vcpu *v); void (*arch_vpmu_load)(struct vcpu *v); void (*arch_vpmu_dump)(struct vcpu *v); }; @@ -62,17 +62,23 @@ int svm_vpmu_initialise(struct vcpu *, unsigned int flags); struct vpmu_struct { u32 flags; + u32 last_pcpu; u32 hw_lapic_lvtpc; void *context; struct arch_vpmu_ops *arch_vpmu_ops; }; +/* VPMU states */ #define VPMU_CONTEXT_ALLOCATED 0x1 #define VPMU_CONTEXT_LOADED 0x2 #define VPMU_RUNNING 0x4 -#define VPMU_PASSIVE_DOMAIN_ALLOCATED 0x8 -#define VPMU_CPU_HAS_DS 0x10 /* Has Debug Store */ -#define VPMU_CPU_HAS_BTS 0x20 /* Has Branch Trace Store */ +#define VPMU_CONTEXT_SAVE 0x8 /* Force context save */ +#define VPMU_FROZEN 0x10 /* Stop counters while VCPU is not running */ +#define VPMU_PASSIVE_DOMAIN_ALLOCATED 0x20 + +/* VPMU features */ +#define VPMU_CPU_HAS_DS 0x100 /* Has Debug Store */ +#define VPMU_CPU_HAS_BTS 0x200 /* Has Branch Trace Store */ #define vpmu_set(_vpmu, _x) ((_vpmu)->flags |= (_x)) |