diff mbox series

[RFC,48/49] xen/sched: make vcpu_wake() core scheduling aware

Message ID 20190329150934.17694-49-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: add core scheduling support | expand

Commit Message

Jürgen Groß March 29, 2019, 3:09 p.m. UTC
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@suse.com>
---
 xen/common/schedule.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox series

Patch

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)