From: Dietmar Hahn Subject: Re: [PATCH v25 07/15] x86/VPMU: Save VPMU state for PV guests during context switch Date: Wed, 08 Jul 2015 07:51:22 +0200 Message-ID: <2923579.xUoVzQiUcn@amur> References: <1434739486-1611-1-git-send-email-boris.ostrovsky@oracle.com> <1434739486-1611-8-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: <1434739486-1611-8-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: Boris Ostrovsky Cc: kevin.tian@intel.com, JBeulich@suse.com, andrew.cooper3@citrix.com, xen-devel@lists.xen.org, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org Am Freitag 19 Juni 2015, 14:44:38 schrieb Boris Ostrovsky: > Save VPMU state during context switch for both HVM and PV(H) guests. > > A subsequent patch ("x86/VPMU: NMI-based VPMU support") will make it possible > for vpmu_switch_to() to call 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. (Note that while this change could have > been dalayed until that later patch, the changes are harmless to existing code > and so we do it here) > > Signed-off-by: Boris Ostrovsky > > --- > Changes in v25: > * Replaced is_hvm_vcpu with is_hvm_domain to be consistent with recent changes > to context_switch() Reviewed-by: Dietmar Hahn > > xen/arch/x86/domain.c | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c > index b699f68..11197e4 100644 > --- a/xen/arch/x86/domain.c > +++ b/xen/arch/x86/domain.c > @@ -1543,17 +1543,14 @@ void context_switch(struct vcpu *prev, struct vcpu *next) > } > > if ( prev != next ) > - _update_runstate_area(prev); > - > - if ( is_hvm_domain(prevd) ) > { > - if (prev != next) > - vpmu_switch_from(prev); > - > - if ( !list_empty(&prev->arch.hvm_vcpu.tm_list) ) > - pt_save_timer(prev); > + _update_runstate_area(prev); > + vpmu_switch_from(prev); > } > > + if ( is_hvm_domain(prevd) && !list_empty(&prev->arch.hvm_vcpu.tm_list) ) > + pt_save_timer(prev); > + > local_irq_disable(); > > set_current(next); > @@ -1591,15 +1588,16 @@ void context_switch(struct vcpu *prev, struct vcpu *next) > !is_hardware_domain(nextd)); > } > > - if (is_hvm_domain(nextd) && (prev != next) ) > - /* Must be done with interrupts enabled */ > - vpmu_switch_to(next); > - > context_saved(prev); > > if ( prev != next ) > + { > _update_runstate_area(next); > > + /* Must be done with interrupts enabled */ > + vpmu_switch_to(next); > + } > + > /* Ensure that the vcpu has an up-to-date time base. */ > update_vcpu_system_time(next); > > -- Company details: http://ts.fujitsu.com/imprint.html