[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/AMD: Stop counters on VPMU save
commit 5fb2decd2d3a821a7e9cff8c53220eaa45557d8f Author: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> AuthorDate: Mon Apr 15 11:25:18 2013 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Apr 15 11:25:18 2013 +0200 x86/AMD: Stop counters on VPMU save Stop the counters during VPMU save operation since they shouldn't be running when VPCU that controls them is not. This also makes it unnecessary to check for overflow in context_restore() Set LVTPC vector before loading the context during vpmu_restore(). Otherwise it is possible to trigger an interrupt without proper vector. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Reviewed-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx> --- xen/arch/x86/hvm/svm/vpmu.c | 22 ++++++---------------- 1 files changed, 6 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/hvm/svm/vpmu.c b/xen/arch/x86/hvm/svm/vpmu.c index 4be5652..51e5495 100644 --- a/xen/arch/x86/hvm/svm/vpmu.c +++ b/xen/arch/x86/hvm/svm/vpmu.c @@ -197,20 +197,9 @@ static inline void context_restore(struct vcpu *v) struct amd_vpmu_context *ctxt = vpmu->context; for ( i = 0; i < num_counters; i++ ) - wrmsrl(ctrls[i], ctxt->ctrls[i]); - - for ( i = 0; i < num_counters; i++ ) { wrmsrl(counters[i], ctxt->counters[i]); - - /* Force an interrupt to allow guest reset the counter, - if the value is positive */ - if ( is_overflowed(ctxt->counters[i]) && (ctxt->counters[i] > 0) ) - { - gdprintk(XENLOG_WARNING, "VPMU: Force a performance counter " - "overflow interrupt!\n"); - amd_vpmu_do_interrupt(0); - } + wrmsrl(ctrls[i], ctxt->ctrls[i]); } } @@ -223,8 +212,8 @@ static void amd_vpmu_restore(struct vcpu *v) vpmu_is_set(vpmu, VPMU_RUNNING)) ) return; - context_restore(v); apic_write(APIC_LVTPC, ctxt->hw_lapic_lvtpc); + context_restore(v); vpmu_set(vpmu, VPMU_CONTEXT_LOADED); } @@ -236,10 +225,11 @@ static inline void context_save(struct vcpu *v) struct amd_vpmu_context *ctxt = vpmu->context; for ( i = 0; i < num_counters; i++ ) - rdmsrl(counters[i], ctxt->counters[i]); - - for ( i = 0; i < num_counters; i++ ) + { rdmsrl(ctrls[i], ctxt->ctrls[i]); + wrmsrl(ctrls[i], 0); + rdmsrl(counters[i], ctxt->counters[i]); + } } static void amd_vpmu_save(struct vcpu *v) -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |