From: Feng Wu Subject: [RFC v2 09/15] Add a new per-vCPU tasklet to wakeup the blocked vCPU Date: Fri, 8 May 2015 17:07:12 +0800 Message-ID: <1431076038-7497-10-git-send-email-feng.wu@intel.com> References: <1431076038-7497-1-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1431076038-7497-1-git-send-email-feng.wu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: kevin.tian@intel.com, keir@xen.org, george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, jbeulich@suse.com, yang.z.zhang@intel.com, Feng Wu List-Id: xen-devel@lists.xenproject.org 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. This tasklet will be used in later patch in this series. Signed-off-by: Feng Wu --- 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 6803c4d..95e2a10 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) || @@ -785,6 +795,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 80c6f62..fd9e01e 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