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

Re: [Xen-devel] [RFC v1 09/15] Add a new per-vCPU tasklet to wakeup the blocked vCPU



> From: Wu, Feng
> Sent: Wednesday, March 25, 2015 8:32 PM
> 
> This patch adds a new per-vCPU tasklet to wakeup the blocked
> vCPU. It can be used in the case vcpu_unblock cannot be called
> directly.

could you elaborate under which scenario vcpu_unblock can't
be called directly?

> 
> Signed-off-by: Feng Wu <feng.wu@xxxxxxxxx>
> ---
>  xen/common/domain.c     | 11 +++++++++++
>  xen/include/xen/sched.h |  3 +++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index aa78fd7..fe89658 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -109,6 +109,13 @@ static void vcpu_check_shutdown(struct vcpu *v)
>      spin_unlock(&d->shutdown_lock);
>  }
> 
> +static void vcpu_wakeup_tasklet_handler(unsigned long arg)
> +{
> +    struct vcpu *v = (void *)arg;
> +
> +    vcpu_unblock(v);
> +}
> +
>  struct vcpu *alloc_vcpu(
>      struct domain *d, unsigned int vcpu_id, unsigned int cpu_id)
>  {
> @@ -126,6 +133,9 @@ struct vcpu *alloc_vcpu(
> 
>      tasklet_init(&v->continue_hypercall_tasklet, NULL, 0);
> 
> +    tasklet_init(&v->vcpu_wakeup_tasklet, vcpu_wakeup_tasklet_handler,
> +                 (unsigned long)v);
> +
>      if ( !zalloc_cpumask_var(&v->cpu_hard_affinity) ||
>           !zalloc_cpumask_var(&v->cpu_hard_affinity_tmp) ||
>           !zalloc_cpumask_var(&v->cpu_hard_affinity_saved) ||
> @@ -784,6 +794,7 @@ static void complete_domain_destroy(struct rcu_head
> *head)
>          if ( (v = d->vcpu[i]) == NULL )
>              continue;
>          tasklet_kill(&v->continue_hypercall_tasklet);
> +        tasklet_kill(&v->vcpu_wakeup_tasklet);
>          vcpu_destroy(v);
>          sched_destroy_vcpu(v);
>          destroy_waitqueue_vcpu(v);
> diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
> index ccd7ed8..c874dd4 100644
> --- a/xen/include/xen/sched.h
> +++ b/xen/include/xen/sched.h
> @@ -239,6 +239,9 @@ struct vcpu
>      /* Tasklet for continue_hypercall_on_cpu(). */
>      struct tasklet   continue_hypercall_tasklet;
> 
> +    /* Tasklet for wakeup_blocked_vcpu(). */
> +    struct tasklet   vcpu_wakeup_tasklet;
> +
>      /* Multicall information. */
>      struct mc_state  mc_state;
> 
> --
> 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®.