From: Dario Faggioli Date: Wed, 25 May 2016 12:33:57 +0000 (+0200) Subject: RTDS: fix another instance of the 'read NOW()' race X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1090 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4074e4ebe9115ac4986f963a13feada3e0560460;p=xen.git RTDS: fix another instance of the 'read NOW()' race which was overlooked in 779511f4bf5ae ("sched: avoid races on time values read from NOW()"). Reported-by: Jan Beulich Signed-off-by: Dario Faggioli Reviewed-by: Meng Xu Release-acked-by: Wei Liu --- diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 094610122e..5b077d764e 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -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);