From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: [PATCH v1 12/13] x86/PMU: Save VPMU state for PV guests during context switch Date: Tue, 10 Sep 2013 11:21:09 -0400 Message-ID: <1378826470-4085-13-git-send-email-boris.ostrovsky@oracle.com> References: <1378826470-4085-1-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1378826470-4085-1-git-send-email-boris.ostrovsky@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: jun.nakajima@intel.com, JBeulich@suse.com, George.Dunlap@eu.citrix.com, jacob.shin@amd.com, eddie.dong@intel.com, dietmar.hahn@ts.fujitsu.com, suravee.suthikulpanit@amd.com, Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org Save VPMU state during context switch for both HVM and PV guests unless we are in VPMU_DOM0 vpmu mode (i.e. dom0 is doing all profiling). Signed-off-by: Boris Ostrovsky --- xen/arch/x86/domain.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 36f4192..e74ad5c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1416,17 +1416,15 @@ void context_switch(struct vcpu *prev, struct vcpu *next) } if (prev != next) - update_runstate_area(prev); - - if ( is_hvm_vcpu(prev) ) { - if (prev != next) + update_runstate_area(prev); + if ( !(vpmu_mode & VPMU_PRIV) || prev->domain != dom0 ) vpmu_save(prev); - - if ( !list_empty(&prev->arch.hvm_vcpu.tm_list) ) - pt_save_timer(prev); } + if ( is_hvm_vcpu(prev) && !list_empty(&prev->arch.hvm_vcpu.tm_list) ) + pt_save_timer(prev); + local_irq_disable(); set_current(next); @@ -1463,7 +1461,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next) (next->domain->domain_id != 0)); } - if (is_hvm_vcpu(next) && (prev != next) ) + if ( prev != next && !(vpmu_mode & VPMU_PRIV) ) /* Must be done with interrupts enabled */ vpmu_load(next); -- 1.8.1.4