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

Re: [Xen-devel] [PATCH] sched: fix race between sched_move_domain() and vcpu_wake()



On ven, 2013-10-11 at 12:32 +0100, George Dunlap wrote:
> On 11/10/13 12:15, Dario Faggioli wrote:
> > On ven, 2013-10-11 at 11:32 +0100, George Dunlap wrote:

> >> But I think this patch is still not quite right: both v->processor and
> >> per_cpu(schedule_data, ...).schedule_lock may change under your feet; so
> >> you always need to do the lock in a loop, checking to make sure that you
> >> *still* have the right lock after you have actually grabbed it.
> >>
> > Which, if I'm not mistaken, we sort of get for free it we go Jan's way,
> > don't we?
> 
> You mean, we could just call vcpu_schedule_lock..() instead of writing a 
> bespoke loop code?  Sure, that's definitely an advantage.
> 
Yes, provided we go Jan's way and have it return the lock.

That way, we'll have vcpu_schedule_lock() responsible for both finding
the proper lock, and doing it in the right way (with the loop, as you're
suggesting above), and returning it to the caller.

That would mean result in code that is both correct and looks better (no
per_cpu().schedule_lock in the caller), so it's a win win. :-)

Dario

-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
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®.