From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v11 for-xen-4.5 13/20] x86/VPMU: Save VPMU state for PV guests during context switch Date: Tue, 23 Sep 2014 11:10:39 -0400 Message-ID: <54218D6F.9050808@oracle.com> References: <1411430281-6132-1-git-send-email-boris.ostrovsky@oracle.com> <1411430281-6132-14-git-send-email-boris.ostrovsky@oracle.com> <20140923150131.GI3007@laptop.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140923150131.GI3007@laptop.dumpdata.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: Konrad Rzeszutek Wilk Cc: kevin.tian@intel.com, keir@xen.org, jbeulich@suse.com, jun.nakajima@intel.com, andrew.cooper3@citrix.com, tim@xen.org, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com List-Id: xen-devel@lists.xenproject.org On 09/23/2014 11:01 AM, Konrad Rzeszutek Wilk wrote: > On Mon, Sep 22, 2014 at 07:57:54PM -0400, Boris Ostrovsky wrote: >> Save VPMU state during context switch for both HVM and PV(H) guests. >> >> A subsequent patch will make it possible for vpmu_switch_to() to call > Could you say what is the name of the 'subsequent patch' in the commit > description please? It's patch 19 where NMI PMU interrupts are added. > >> vmx_vmcs_try_enter()->vcpu_pause() which needs is_running to be correctly >> set/cleared. To prepare for that, call context_saved() before vpmu_switch_to() >> is executed. > And what ramifications does that have to the guests if one only applied > patches up to this point? None. Which is why I decided to make this change in this patch and not wait until patch 19. -boris > >> Signed-off-by: Boris Ostrovsky >> --- >> xen/arch/x86/domain.c | 20 +++++++++----------- >> 1 file changed, 9 insertions(+), 11 deletions(-) >> >> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c >> index 5e492d8..d7fb99d 100644 >> --- a/xen/arch/x86/domain.c >> +++ b/xen/arch/x86/domain.c >> @@ -1495,16 +1495,13 @@ void context_switch(struct vcpu *prev, struct vcpu *next) >> } >> >> if ( prev != next ) >> - _update_runstate_area(prev); >> - >> - if ( is_hvm_vcpu(prev) ) >> { >> - if (prev != next) >> - vpmu_switch_from(prev, next); >> + _update_runstate_area(prev); >> + vpmu_switch_from(prev, next); >> + } >> >> - if ( !list_empty(&prev->arch.hvm_vcpu.tm_list) ) >> + if ( is_hvm_vcpu(prev) && !list_empty(&prev->arch.hvm_vcpu.tm_list) ) >> pt_save_timer(prev); >> - } >> >> local_irq_disable(); >> >> @@ -1543,15 +1540,16 @@ void context_switch(struct vcpu *prev, struct vcpu *next) >> !is_hardware_domain(next->domain)); >> } >> >> - if ( is_hvm_vcpu(prev) && (prev != next) ) >> - /* Must be done with interrupts enabled */ >> - vpmu_switch_to(prev, next); >> - >> context_saved(prev); >> >> if ( prev != next ) >> + { >> _update_runstate_area(next); >> >> + /* Must be done with interrupts enabled */ >> + vpmu_switch_to(prev, next); >> + } >> + >> /* Ensure that the vcpu has an up-to-date time base. */ >> update_vcpu_system_time(next); >> >> -- >> 1.8.1.4 >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xen.org >> http://lists.xen.org/xen-devel