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

Re: [Xen-devel] [PATCH v2 2/3] xen: add hypercall option to temporarily pin a vcpu



>>> On 01.03.16 at 16:55, <george.dunlap@xxxxxxxxxx> wrote:
> On 01/03/16 15:52, George Dunlap wrote:
>> On 01/03/16 09:02, Juergen Gross wrote:
>>> --- a/xen/common/schedule.c
>>> +++ b/xen/common/schedule.c
>>> @@ -271,6 +271,12 @@ int sched_move_domain(struct domain *d, struct cpupool 
>>> *c)
>>>      struct scheduler *old_ops;
>>>      void *old_domdata;
>>>  
>>> +    for_each_vcpu ( d, v )
>>> +    {
>>> +        if ( v->affinity_broken )
>>> +            return -EBUSY;
>>> +    }
>>> +
>>>      domdata = SCHED_OP(c->sched, alloc_domdata, d);
>>>      if ( domdata == NULL )
>>>          return -ENOMEM;
>>> @@ -669,6 +675,14 @@ int cpu_disable_scheduler(unsigned int cpu)
>>>              if ( cpumask_empty(&online_affinity) &&
>>>                   cpumask_test_cpu(cpu, v->cpu_hard_affinity) )
>>>              {
>>> +                if ( v->affinity_broken )
>>> +                {
>>> +                    /* The vcpu is temporarily pinned, can't move it. */
>>> +                    vcpu_schedule_unlock_irqrestore(lock, flags, v);
>>> +                    ret = -EBUSY;
>>> +                    break;
>>> +                }
>> 
>> Does this mean that if the user closes the laptop lid while one of these
>> drivers has vcpu0 pinned, that Xen will crash (see
>> xen/arch/x86/smpboot.c:__cpu_disable())?  Or is it the OS's job to make
>> sure that all temporary pins are removed before suspending?
>> 
>> Also -- have you actually tested the "cpupool move while pinned"
>> functionality to make sure it actually works?  There's a weird bit in
>> cpupool_unassign_cpu_helper() where after calling
>> cpu_disable_scheduler(cpu), it unconditionally sets the cpu bit in the
>> cpupool_free_cpus mask, even if it returns an error.  That can't be
>> right, even for the existing -EAGAIN case, can it?
>> 
>> I see that you have a loop to retry this call several times in the next
>> patch; but what if it fails every time -- what state is the system in?
>> 
>> And, in general, what happens if the device driver gets mixed up and
>> forgets to unpin the vcpu?  Is the only recourse to reboot your host (or
>> deal with the fact that you can't reconfigure your cpupools)?
> 
> (I should say, I think this probably is the best solution to this
> problem; I just want to make sure we think about the error cases carefully.)

I guess in the worst case there could be a utility or xl command
doing the missing unpin in such an emergency?

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