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

Re: [Xen-devel] [PATCHv1 3/6] evtchn: simplify port_is_valid()



On 09/06/15 16:08, Andrew Cooper wrote:
> On 09/06/15 15:59, 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.
[...]
>> --- a/xen/include/xen/sched.h
>> +++ b/xen/include/xen/sched.h
>> @@ -336,8 +336,9 @@ struct domain
>>      /* Event channel information. */
>>      struct evtchn   *evtchn;                         /* first bucket only */
>>      struct evtchn  **evtchn_group[NR_EVTCHN_GROUPS]; /* all other buckets */
>> -    unsigned int     max_evtchns;
>> -    unsigned int     max_evtchn_port;
>> +    unsigned int     max_evtchns;     /* number supported by ABI */
>> +    unsigned int     max_evtchn_port; /* max permitted port number */
>> +    atomic_t         valid_evtchns;   /* number of allocated event channels 
>> */
> 
> atomic_t contains a signed integer.  You probably want a BUILD_BUG_ON()
> if any ABI maximum value exceeds INT_MAX.

Probably better to use unsigned int and read_atomic().  All the updates
to valid_evtchns are done while holding d->event_lock.

David

ps. please trim replies.


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