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

[Xen-devel] [PATCH RFC 48/49] xen/sched: make vcpu_wake() core scheduling aware



With core scheduling active a vcpu being woken up via vcpu_wake() might
be on a physical cpu in guest idle already. In this case it just needs
to be set to "running" and pinged via cpu_raise_softirq().

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/schedule.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 7b30a153df..ba03b588c8 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -705,16 +705,19 @@ void vcpu_wake(struct vcpu *v)
 {
     unsigned long flags;
     spinlock_t *lock;
+    struct sched_item *item = v->sched_item;
 
     TRACE_2D(TRC_SCHED_WAKE, v->domain->domain_id, v->vcpu_id);
 
-    lock = item_schedule_lock_irqsave(v->sched_item, &flags);
+    lock = item_schedule_lock_irqsave(item, &flags);
 
     if ( likely(vcpu_runnable(v)) )
     {
         if ( v->runstate.state >= RUNSTATE_blocked )
             vcpu_runstate_change(v, RUNSTATE_runnable, NOW());
-        SCHED_OP(vcpu_scheduler(v), wake, v->sched_item);
+        SCHED_OP(vcpu_scheduler(v), wake, item);
+        if ( item->is_running && v->runstate.state != RUNSTATE_running )
+            cpu_raise_softirq(v->processor, SCHEDULE_SOFTIRQ);
     }
     else if ( !(v->pause_flags & VPF_blocked) )
     {
@@ -722,7 +725,7 @@ void vcpu_wake(struct vcpu *v)
             vcpu_runstate_change(v, RUNSTATE_offline, NOW());
     }
 
-    item_schedule_unlock_irqrestore(lock, flags, v->sched_item);
+    item_schedule_unlock_irqrestore(lock, flags, item);
 }
 
 void vcpu_unblock(struct vcpu *v)
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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