[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 2/3] vcpu: track hvm vcpu number on the system



>>> On 24.05.17 at 08:56, <chao.gao@xxxxxxxxx> wrote:
> This number is used to calculate how many hvm vcpu on a pcpu on average.

This doesn't read well. Perhaps "This number is used to calculate the
average vcpus per pcpu ratio"?

> This counting is x86 specific.

By titling the patch accordingly you wouldn't even need to say so
here.

> --- 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? */

"Total number of HVM vCPU-s on this system" or some such.

> @@ -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);
> +    }

Please instead put this in the code block calling
hvm_vcpu_initialise().

> @@ -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);
> +    }

To mirror initialization behavior I think you want to decrement the
counter before calling the function.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.