From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v4 14/17] x86/VPMU: Save VPMU state for PV guests during context switch Date: Tue, 04 Feb 2014 10:56:36 -0500 Message-ID: <52F10DB4.9070407@oracle.com> References: <1390331342-3967-1-git-send-email-boris.ostrovsky@oracle.com> <1390331342-3967-15-git-send-email-boris.ostrovsky@oracle.com> <52F0DF430200007800118F76@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52F0DF430200007800118F76@nat28.tlf.novell.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: Jan Beulich Cc: keir@xen.org, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org On 02/04/2014 06:38 AM, Jan Beulich wrote: >>>> On 21.01.14 at 20:08, Boris Ostrovsky wrote: >> Save VPMU state during context switch for both HVM and PV guests unless we >> are in PMU privileged mode (i.e. dom0 is doing all profiling) and the >> switched >> out domain is not the control domain. The latter condition is needed because >> me may have just turned the privileged PMU mode on and thus need to save >> last domain. > While this is understandable, ... > >> --- a/xen/arch/x86/domain.c >> +++ b/xen/arch/x86/domain.c >> @@ -1444,17 +1444,16 @@ 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 & XENPMU_MODE_PRIV) || >> + !is_control_domain(prev->domain) ) >> vpmu_save(prev); > ... I'd really like you to investigate ways to achieve the same effect > without this extra second condition added to the context switch path. > E.g. by synchronously issuing a save on all affected vCPU-s when > privileged mode gets turned on. Yes, I should do something like that. -boris