From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel De Graaf Subject: Re: Re: [PATCH 2/2] xen/gnt{dev, alloc}: reserve event channels for notify Date: Tue, 25 Oct 2011 16:42:26 -0400 Message-ID: <4EA71F32.9040208@tycho.nsa.gov> References: <1316207684-19860-1-git-send-email-dgdegra@tycho.nsa.gov> <1318971851-12809-1-git-send-email-dgdegra@tycho.nsa.gov> <1318971851-12809-3-git-send-email-dgdegra@tycho.nsa.gov> <20111024205708.GE2441@phenom.dumpdata.com> <4EA5E024.7040708@tycho.nsa.gov> <20111025190231.GD10062@phenom.dumpdata.com> <4EA710EB.3030809@tycho.nsa.gov> <1319574443.16747.1.camel@dagon.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1319574443.16747.1.camel@dagon.hellion.org.uk> 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: "Keir (Xen.org)" , "jeremy@goop.org" , "xen-devel@lists.xensource.com" , Ian Jackson , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org On 10/25/2011 04:27 PM, Ian Campbell wrote: > On Tue, 2011-10-25 at 20:41 +0100, Daniel De Graaf wrote: >> >>>> Hmm. Perhaps have a magic value for refcount (-1?) that indicates >> evtchn_get is not >>>> available. That would become the default value of refcnt, and >> evtchn.c would then >>>> use evtchn_make_refcounted() to change the refcount to 1 and allow >> _get/_put to work. >>> >>> How would that work when the IRQ subsystem (so everything is setup >> in the kernel) >>> gets an event? Would the refcount be for that -1.. oh. You would >> only set >>> the refcnt when the _get/_put calls are made and not when in-kernel >> calls to setup> IRQs are done? >>> >> >> Right. The reference count would be a dual-purpose field indicating if >> the event channel is kernel-internal (value -1) or userspace-visible >> (reference count > 0). New event channels would start out at -1, and >> evtchn.c would change them to 1. > > Is there any way that the reference count could be made part of the > datastructures associated with the /dev/xen/evtchn driver instead of the > core evtchn.c stuff? That wouldreduce the chance of current or futures > users getting something wrong. > > Ian. This would require that the gntdev and gntalloc modules have a dependency on the evtchn module, with the evtchn_{get,put} functions moved into that module. The only other way would be to add a refcount maintenance function pointer to the IRQ data structure, which seems like it would lead to more problems than a simple reference count. -- Daniel De Graaf National Security Agency