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

Re: [Xen-devel] [PATCHv2 2/5] evtchn: simplify port_is_valid()



On 15/06/15 16:57, Ian Campbell wrote:
> On Mon, 2015-06-15 at 16:48 +0100, David Vrabel wrote:
>> By keeping a count of the number of currently valid event channels,
>> port_is_valid() can be simplified.
>>
>> d->valid_evtchns can also be tested without holding d->event_lock which
>> will be useful later on.
>>
>> Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
>> ---
>> v2:
>> - Used unsigned int for d->valid_evtchns.
>> ---
>>  xen/common/event_channel.c |    3 +++
>>  xen/include/xen/event.h    |    4 +---
>>  xen/include/xen/sched.h    |    5 +++--
>>  3 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
>> index 947880f..fd48646 100644
>> --- a/xen/common/event_channel.c
>> +++ b/xen/common/event_channel.c
>> @@ -189,6 +189,8 @@ static int get_free_port(struct domain *d)
>>          return -ENOMEM;
>>      bucket_from_port(d, port) = chn;
>>  
>> +    write_atomic(&d->valid_evtchns, d->valid_evtchns + EVTCHNS_PER_BUCKET);
> 
> Shouldn't this be atomic_add? Otherwise the result of what you have here
> is actually a non-atomic read/add/write.

This field is only updated while holding d->event_lock.  Only reads are
unlocked.

David

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