On Fri, 2016-03-11 at 23:54 -0500, Meng Xu wrote: >  > > @@ -1150,6 +1300,101 @@ rt_dom_cntl( > >      return rc; > >  } > > > > +/* > > + * The replenishment timer handler picks vcpus > > + * from the replq and does the actual replenishment. > > + */ > > +static void repl_handler(void *data){ > > +    unsigned long flags; > > +    s_time_t now = NOW(); > > +    struct scheduler *ops = data; > > +    struct rt_private *prv = rt_priv(ops); > > +    struct list_head *replq = rt_replq(ops); > > +    struct list_head *runq = rt_runq(ops); > > +    struct timer *repl_timer = prv->repl_timer; > > +    struct list_head *iter, *tmp; > > +    struct list_head tmp_replq; > > +    struct rt_vcpu *svc = NULL; > > + > > +    spin_lock_irqsave(&prv->lock, flags); > Hmm, I haven't thought hard about the choice between > spin_lock_irqsave() and spin_lock_irq(), before. > > Hi Dario, > Is it better to use spin_lock_irqsave() or spin_lock_irq() at this > place? > Just very quickly about this (I'll comment about the rest of the patch later). > I'm not quite sure if the handler can be called in an interrupt > disabled context? Can it? > I recommend looking at what happens inside init_timer(), i.e., where a pointer to this function is stashed. Then, still in xen/common/timer.c, check where this (and, in general, a timer handling function provided to timer_init()) is actually invoked. When you'll find that spot, the answer to whether spin_lock_irq() is safe or not in here, will appear quite evident. :-) > When I used the spin_lock_irq(save), I just refered to what credit2 > scheduler does, but didn't think hard enough about which one has > better performance. > I'm not sure what you mean when you talk about Credit2, as there are no timers in there. In any case, it is indeed the case that, if just _irq() is safe, we should use it, as it's cheaper. Regards, Dario -- <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)