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

Re: [Xen-devel] [PATCH v2 02/13] Set VCPU's is_running flag closer to when the VCPU is dispatched

On 25/09/2013 14:42, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

>>>> On 20.09.13 at 11:42, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> wrote:
>> An interrupt handler happening during new VCPU scheduling may want to know
>> who was on the (physical) processor at the point of the interrupt. Just
>> looking at 'current' may not be accurate since there is a window of time when
>> 'current' points to new VCPU and its is_running flag is set but the VCPU has
>> not been dispatched yet. More importantly, on Intel processors, if the
>> handler
>> wants to examine certain state of an HVM VCPU (such as segment registers) the
>> VMCS pointer is not set yet.
>> This patch will move setting the is_running flag to a later point.
> As said on v1 already - I'm all but convinced that this is not going to
> break something in subtle ways. Without you assuring us that you
> carefully inspected _all_ uses of this flag, I don't think this can go in.

It's very definitely not safe. It would break vcpu_sleep_sync() for example
-- which depends on ->is_running being set inside the scheduler lock.
Otherwise, if vcpu_sleep_nosync() occurs immediately after dropping the lock
in schedule() then vcpu_sleep_sync() can see !v->is_running even though v is
in the process of being activated to run.

It's a subtle flag, messing with it is unlikely ever to be the right answer.

 -- Keir

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

Xen-devel mailing list



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