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

Re: [Xen-devel] [RFC v1 10/15] vmx: Define two per-cpu variants




> -----Original Message-----
> From: Tian, Kevin
> Sent: Thursday, April 02, 2015 1:55 PM
> To: Wu, Feng; xen-devel@xxxxxxxxxxxxx
> Cc: JBeulich@xxxxxxxx; keir@xxxxxxx; Zhang, Yang Z
> Subject: RE: [RFC v1 10/15] vmx: Define two per-cpu variants
> 
> > From: Wu, Feng
> > Sent: Wednesday, March 25, 2015 8:32 PM
> >
> > This patch defines two per-cpu variants:
> >
> > blocked_vcpu_on_cpu:
> > A list storing the vCPUs which were blocked on this pCPU.
> >
> > blocked_vcpu_on_cpu_lock:
> > The spinlock to protect blocked_vcpu_on_cpu.
> 
> since above two are already per-cpu variants, you don't need
> 'on_cpu' in the name to duplicate it. How about just call them
> "blocked_vcpus" and "blocked_vcpus_lock"? :-)

Sounds great!

Thanks,
Feng

> 
> >
> > Signed-off-by: Feng Wu <feng.wu@xxxxxxxxx>
> > ---
> >  xen/arch/x86/hvm/vmx/vmcs.c       | 3 +++
> >  xen/arch/x86/hvm/vmx/vmx.c        | 7 +++++++
> >  xen/include/asm-x86/hvm/vmx/vmx.h | 3 +++
> >  3 files changed, 13 insertions(+)
> >
> > diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> > index 942f4b7..1345e69 100644
> > --- a/xen/arch/x86/hvm/vmx/vmcs.c
> > +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> > @@ -585,6 +585,9 @@ int vmx_cpu_up(void)
> >      if ( cpu_has_vmx_vpid )
> >          vpid_sync_all();
> >
> > +    INIT_LIST_HEAD(&per_cpu(blocked_vcpu_on_cpu, cpu));
> > +    spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu));
> > +
> >      return 0;
> >  }
> >
> > diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> > index e1c55ce..ff5544d 100644
> > --- a/xen/arch/x86/hvm/vmx/vmx.c
> > +++ b/xen/arch/x86/hvm/vmx/vmx.c
> > @@ -81,6 +81,13 @@ static int vmx_msr_read_intercept(unsigned int msr,
> > uint64_t *msr_content);
> >  static int vmx_msr_write_intercept(unsigned int msr, uint64_t
> msr_content);
> >  static void vmx_invlpg_intercept(unsigned long vaddr);
> >
> > +/*
> > + * We maintian a per-CPU linked-list of vCPU, so in PI wakeup handler we
> > + * can find which vCPU should be waken up.
> > + */
> > +DEFINE_PER_CPU(struct list_head, blocked_vcpu_on_cpu);
> > +DEFINE_PER_CPU(spinlock_t, blocked_vcpu_on_cpu_lock);
> > +
> >  uint8_t __read_mostly posted_intr_vector;
> >
> >  static int vmx_domain_initialise(struct domain *d)
> > diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h
> > b/xen/include/asm-x86/hvm/vmx/vmx.h
> > index 3cd75eb..e643c3c 100644
> > --- a/xen/include/asm-x86/hvm/vmx/vmx.h
> > +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
> > @@ -30,6 +30,9 @@
> >  #include <asm/hvm/vmx/vmcs.h>
> >  #include <asm/apic.h>
> >
> > +DECLARE_PER_CPU(struct list_head, blocked_vcpu_on_cpu);
> > +DECLARE_PER_CPU(spinlock_t, blocked_vcpu_on_cpu_lock);
> > +
> >  extern uint8_t posted_intr_vector;
> >
> >  typedef union {
> > --
> > 2.1.0


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


 


Rackspace

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