diff mbox

xen: RTDS: fix another instance of the 'read NOW()' race

Message ID 146410241867.30357.7157102219398554511.stgit@Solace.fritz.box (mailing list archive)
State New, archived
Headers show

Commit Message

Dario Faggioli May 24, 2016, 3:06 p.m. UTC
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>
---
Cc: Meng Xu <mengxu@cis.upenn.edu>
Cc: George Dunlap <george.dunlap@citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 xen/common/sched_rt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Meng Xu May 24, 2016, 7:32 p.m. UTC | #1
On Tue, May 24, 2016 at 11:06 AM, Dario Faggioli
<dario.faggioli@citrix.com> wrote:
> 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>
> ---
> Cc: Meng Xu <mengxu@cis.upenn.edu>
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Jan Beulich <JBeulich@suse.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---

Reviewed-by: Meng Xu <mengxu@cis.upenn.edu>
Wei Liu May 24, 2016, 8:05 p.m. UTC | #2
On Tue, May 24, 2016 at 05:06:58PM +0200, Dario Faggioli wrote:
> 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>

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
> Cc: Meng Xu <mengxu@cis.upenn.edu>
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Jan Beulich <JBeulich@suse.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  xen/common/sched_rt.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
> index 0946101..5b077d7 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);
>  
>
George Dunlap May 26, 2016, 8:38 a.m. UTC | #3
On 24/05/16 16:06, Dario Faggioli wrote:
> 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>

Acked-by: George Dunlap <george.dunlap@citrix.com>

> ---
> Cc: Meng Xu <mengxu@cis.upenn.edu>
> Cc: George Dunlap <george.dunlap@citrix.com>
> Cc: Jan Beulich <JBeulich@suse.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  xen/common/sched_rt.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
> index 0946101..5b077d7 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);
>  
>
diff mbox

Patch

diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c
index 0946101..5b077d7 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);