WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [PATCH 1/2] xen/event: Add reference counting to eve

On Tue, Oct 25, 2011 at 09:17:15AM +0100, Ian Campbell wrote:
> On Mon, 2011-10-24 at 21:22 +0100, Konrad Rzeszutek Wilk wrote:
> > 
> > > +void evtchn_put(unsigned int evtchn)
> > 
> > The decleration for 'evtchn' is 'unsigned short' so that can be
> > used instead of 'unsigned int'.
> 
> I think I nearly made the same comment but then I looked at
> drivers/xen/events.c and found that it uses "unsigned", "unsigned
> short", "unsigned int" and "int" fairly interchangeably. The externally
> visible API (i.e. include/xen/events.h) tends to stick to just "unsigned
> int" or "int".
> 
> The problem with the short types is that they don't leave room for an
> error indication, which is why on the Xen tools (libxc) side we have his
> piece of minor ugliness:
>         typedef int evtchn_port_or_error_t;
> 
> The actual hypercall interface uses "typedef uint32_t evtchn_port_t" but
> AIUI real evtchn values are guaranteed to fit in 31 bits.


Oh fun! So we actually have a bug with 'unsigned short' cutting it down
from 2^31 to 2^16!

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>