From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: Re: [PATCH 1/2] xen/event: Add reference counting to event channel Date: Tue, 25 Oct 2011 15:09:44 -0400 Message-ID: <20111025190944.GF10062@phenom.dumpdata.com> References: <1316207684-19860-1-git-send-email-dgdegra@tycho.nsa.gov> <1318971851-12809-1-git-send-email-dgdegra@tycho.nsa.gov> <1318971851-12809-2-git-send-email-dgdegra@tycho.nsa.gov> <20111024202242.GD2441@phenom.dumpdata.com> <1319530635.3385.215.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1319530635.3385.215.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: Ian Jackson , Daniel De Graaf , "xen-devel@lists.xensource.com" , "Keir (Xen.org)" , "jeremy@goop.org" List-Id: xen-devel@lists.xenproject.org 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!