[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 2/3] vcpu: track hvm vcpu number on the system
This number is used to calculate how many hvm vcpu on a pcpu on average. This counting is x86 specific. Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx> --- xen/arch/x86/domain.c | 10 ++++++++++ xen/include/asm-x86/domain.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 13cdc50..050fe0e 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -66,6 +66,9 @@ DEFINE_PER_CPU(struct vcpu *, curr_vcpu); +/* how many hvm vcpu on this system? */ +atomic_t num_hvm_vcpus; + static void default_idle(void); void (*pm_idle) (void) __read_mostly = default_idle; void (*dead_idle) (void) __read_mostly = default_dead_idle; @@ -467,7 +470,11 @@ int vcpu_initialise(struct vcpu *v) xfree(v->arch.pv_vcpu.trap_ctxt); } else if ( !is_idle_domain(v->domain) ) + { vpmu_initialise(v); + if ( is_hvm_domain(v->domain) ) + atomic_inc(&num_hvm_vcpus); + } return rc; } @@ -489,7 +496,10 @@ void vcpu_destroy(struct vcpu *v) vpmu_destroy(v); if ( is_hvm_vcpu(v) ) + { hvm_vcpu_destroy(v); + atomic_dec(&num_hvm_vcpus); + } else xfree(v->arch.pv_vcpu.trap_ctxt); } diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index 924caac..769cde2 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -31,6 +31,8 @@ #define nmi_pending nmi_state.pending #define mce_pending mce_state.pending +extern atomic_t num_hvm_vcpus; + struct trap_bounce { uint32_t error_code; uint8_t flags; /* TBF_ */ -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |