From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 5/6] libxl: events: Deregister evtchn fd when not needed Date: Fri, 28 Nov 2014 14:52:30 +0000 Message-ID: <1417186350.23604.54.camel@citrix.com> References: <1417083745.12784.1.camel@citrix.com> <1417112870-31894-1-git-send-email-ian.jackson@eu.citrix.com> <1417112870-31894-6-git-send-email-ian.jackson@eu.citrix.com> <1417179851.23604.41.camel@citrix.com> <21624.35587.721780.498045@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21624.35587.721780.498045@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Jim Fehlig , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, 2014-11-28 at 14:47 +0000, Ian Jackson wrote: > Ian Campbell writes ("Re: [PATCH 5/6] libxl: events: Deregister evtchn fd when not needed"): > > On Thu, 2014-11-27 at 18:27 +0000, Ian Jackson wrote: > > > We want to have no fd events registered when we are idle. > > > In this patch, deal with the evtchn fd: > > > > > > * Defer setup of the evtchn handle to the first use. > > > * Defer registration of the evtchn fd; register as needed on use. > > > * When cancelling an evtchn wait, or when wait setup fails, check > > > whether there are now no evtchn waits and if so deregister the fd. > > > * On libxl teardown, the evtchn fd should therefore be unregistered. > > > assert that this is the case. > > > > Is there no locking required when registering/deregistering? Since there > > are list manipulations in most of these places I presume it already > > exists, but I thought I should check. > > libxl__ev_evtchn_* is always called with the ctx lock held. For the most part this is implicit due to the caller being in an ao callback, right? > However, that they don't take the lock is contrary to the rules stated > for libxl__ev_* in the doc comment. That should be fixed for 4.6. OK. > libxl__ev_fd_* already take and release the lock to protect their own > data structures etc. > > Ian.