RTDS: fix another instance of the 'read NOW()' race
authorDario Faggioli <dario.faggioli@citrix.com>
Wed, 25 May 2016 12:33:57 +0000 (14:33 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 25 May 2016 12:33:57 +0000 (14:33 +0200)
which was overlooked in 779511f4bf5ae ("sched: avoid
races on time values read from NOW()").

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: Meng Xu <mengxu@cis.upenn.edu>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/common/sched_rt.c

index 094610122e5658ec51c2038ae0905d4089f41dd4..5b077d764e1116a66b0f2770fe864f19f5686305 100644 (file)
@@ -840,12 +840,14 @@ static void
 rt_vcpu_insert(const struct scheduler *ops, struct vcpu *vc)
 {
     struct rt_vcpu *svc = rt_vcpu(vc);
-    s_time_t now = NOW();
+    s_time_t now;
     spinlock_t *lock;
 
     BUG_ON( is_idle_vcpu(vc) );
 
     lock = vcpu_schedule_lock_irq(vc);
+
+    now = NOW();
     if ( now >= svc->cur_deadline )
         rt_update_deadline(now, svc);