|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v10 18/20] x86/VPMU: Save VPMU state for PV guests during context switch
Save VPMU state during context switch for both HVM and PV(H) guests.
Since it is now possible for vpmu_switch_to() to call
vmx_vmcs_try_enter()->vcpu_pause()
which needs is_running to be correctly set/cleared we call context_saved()
before
vpmu_switch_to() is executed.
Also, because we are calling both VPMU context switch routines from under the
'if (prev != next)' check we can drop this check from inline definitions.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---
xen/arch/x86/domain.c | 19 +++++++++----------
xen/include/asm-x86/hvm/vpmu.h | 4 ++--
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ecbb3df..18ec530 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1495,16 +1495,14 @@ void context_switch(struct vcpu *prev, struct vcpu
*next)
}
if ( prev != next )
- _update_runstate_area(prev);
-
- if ( is_hvm_vcpu(prev) )
{
+ _update_runstate_area(prev);
vpmu_switch_from(prev, next);
-
- 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);
@@ -1542,15 +1540,16 @@ void context_switch(struct vcpu *prev, struct vcpu
*next)
!is_hardware_domain(next->domain));
}
- if ( is_hvm_vcpu(prev) )
- /* 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);
diff --git a/xen/include/asm-x86/hvm/vpmu.h b/xen/include/asm-x86/hvm/vpmu.h
index 977a44c..ad86390 100644
--- a/xen/include/asm-x86/hvm/vpmu.h
+++ b/xen/include/asm-x86/hvm/vpmu.h
@@ -119,13 +119,13 @@ extern uint64_t vpmu_features;
/* Context switch */
inline void vpmu_switch_from(struct vcpu *prev, struct vcpu *next)
{
- if ( (prev != next) && (vpmu_mode & XENPMU_MODE_SELF) )
+ if ( vpmu_mode & XENPMU_MODE_SELF )
vpmu_save(prev);
}
inline void vpmu_switch_to(struct vcpu *prev, struct vcpu *next)
{
- if ( (prev != next) && (vpmu_mode & XENPMU_MODE_SELF) )
+ if ( vpmu_mode & XENPMU_MODE_SELF )
vpmu_load(next);
}
--
1.8.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |