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

Re: [Xen-devel] [RFC PATCH] dpci: Put the dpci back on the list if running on another CPU.



>>> On 12.01.15 at 18:35, <konrad.wilk@xxxxxxxxxx> wrote:
>> --- a/xen/drivers/passthrough/io.c
>> +++ b/xen/drivers/passthrough/io.c
>> @@ -804,7 +804,17 @@ static void dpci_softirq(void)
>>          d = pirq_dpci->dom;
>>          smp_mb(); /* 'd' MUST be saved before we set/clear the bits. */
>>          if ( test_and_set_bit(STATE_RUN, &pirq_dpci->state) )
>> -            BUG();
>> +        {
>> +            unsigned long flags;
>> +
>> +            /* Put back on the list and retry. */
>> +            local_irq_save(flags);
>> +            list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
> 
> I chatted with Jan on IRC this, and one worry is that if we add
> on our per-cpu list an 'dpci' that is running on another CPU - if
> the other CPU runs 'list_del' it will go BOOM.

Looking at this again, I don't think this particular case is a concern:
The list_del() happens before setting STATE_RUN and clearing
STATE_SCHED, and the race window only opens (and the potential
list_add() can only happen) after this CPU cleared STATE_SCHED.

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