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

Re: [Xen-devel] [PATCHv1 4/6] evtchn: use a per-event channel lock for sending events



>>> On 09.06.15 at 17:17, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 09/06/15 15:59, David Vrabel wrote:
>> @@ -243,6 +248,30 @@ static long evtchn_alloc_unbound(evtchn_alloc_unbound_t 
>> *alloc)
>>  }
>>  
>>  
>> +static void double_evtchn_lock(struct domain *ld, struct evtchn *lchn,
>> +                               struct domain *rd, struct evtchn *rchn)
>> +{
>> +    if ( ld < rd || (ld == rd && lchn->port < rchn->port) )
> 
> ld < rd is undefined behaviour as they are not part of the same
> singly-allocated object.  It would be better to choose order based on
> domid, and looks like the grant code suffers the same issue.

I'm not concerned of undefined behavior here at all (nor in gnttab
code): struct domain * are all page aligned, and hence can be
viewed as elements of a page sized array spanning the entire Xen
heap. What I'd recommend is also making the channel comparison
use the pointers instead of the port numbers. Which then likely
could result in comparing only these two pointers. Or if not, I'd
really like to at least see the struct domain pointers here to get
const qualified.

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