From: Feng Wu Subject: [RFC v1 09/15] Add a new per-vCPU tasklet to wakeup the blocked vCPU Date: Wed, 25 Mar 2015 20:31:51 +0800 Message-ID: <1427286717-4093-10-git-send-email-feng.wu@intel.com> References: <1427286717-4093-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: <1427286717-4093-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: yang.z.zhang@intel.com, Feng Wu , kevin.tian@intel.com, keir@xen.org, JBeulich@suse.com 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. 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 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