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

Re: [Xen-devel] [PATCH] xen: sanity check input and serialize vcpu data in sched_rt.c



>>> On 26.09.14 at 20:29, <mengxu@xxxxxxxxxxxxx> wrote:
> Sanity check input params in rt_dom_cntl();
> Serialize rt_dom_cntl() against the global lock;
> Move the call to rt_update_deadline() from _alloc to _insert.

Regarding this last sentence - the patch clearly does more in this
regard than just move the call from _alloc or _insert. Please make
sure your description matches the patch (which doesn't necessarily
mean enumerating all places it gets moved from - all I'd like to see
is that description and implementation don't disagree).

And aren't the two changes here independent anyway? In which
case submitting them as two patches might be better?

> @@ -577,7 +579,12 @@ rt_vcpu_remove(const struct scheduler *ops, struct vcpu 
> *vc)
>      BUG_ON( sdom == NULL );
>  
>      if ( __vcpu_on_q(svc) )
> +    {
> +        spinlock_t *lock;
> +        lock = vcpu_schedule_lock_irq(vc);
>          __q_remove(svc);
> +        vcpu_schedule_unlock_irq(lock, vc);
> +    }

While Andrew already pointed out that this needs to change anyway,
I'd still like to point out that declarations should be separated from
statements by a blank line.

> @@ -1042,11 +1044,14 @@ rt_dom_cntl(
>      struct domain *d,
>      struct xen_domctl_scheduler_op *op)
>  {
> +    struct rt_private *prv = rt_priv(ops);
>      struct rt_dom * const sdom = rt_dom(d);
>      struct rt_vcpu *svc;
>      struct list_head *iter;
> +    unsigned long flags;
>      int rc = 0;
>  
> +    spin_lock_irqsave(&prv->lock, flags);
>      switch ( op->cmd )
>      {
>      case XEN_DOMCTL_SCHEDOP_getinfo:
> @@ -1055,6 +1060,12 @@ rt_dom_cntl(
>          op->u.rtds.budget = svc->budget / MICROSECS(1);
>          break;
>      case XEN_DOMCTL_SCHEDOP_putinfo:
> +        if ( op->u.rtds.period == 0 || op->u.rtds.budget == 0 )
> +        {
> +            rc = -EINVAL;
> +            break;
> +        }
> +
>          list_for_each( iter, &sdom->vcpu )
>          {
>              struct rt_vcpu * svc = list_entry(iter, struct rt_vcpu, 
> sdom_elem);
> @@ -1064,6 +1075,8 @@ rt_dom_cntl(
>          break;
>      }
>  
> +    spin_unlock_irqrestore(&prv->lock, flags);

Do you really need the lock to be held for the "get" side too?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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