From: Ian Jackson Subject: Re: [PATCH 2/2] libxl: fix stale timeout event callback race Date: Thu, 13 Dec 2012 13:07:25 +0000 Message-ID: <20681.54029.391833.313611@mariner.uk.xensource.com> References: <20678.5159.946248.90947@mariner.uk.xensource.com> <1355158624-11163-2-git-send-email-ian.jackson@eu.citrix.com> <50C7B974.4050706@suse.com> <20680.47971.962603.851882@mariner.uk.xensource.com> <50C8BE3F.4040402@suse.com> <20680.49391.646654.814456@mariner.uk.xensource.com> <50C8C665.2030202@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <50C8C665.2030202@suse.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: Jim Fehlig Cc: Bamvor Jian Zhang , Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Jim Fehlig writes ("Re: [Xen-devel] [PATCH 2/2] libxl: fix stale timeout event callback race"): > Ian Jackson wrote: > > Well your patch is only correct when used with the new libxl, with my > > patches. > > Hmm, it is not clear to me how to make the libxl driver work correctly > with libxl pre and post your patches :-/. This should be straightforward I think, except for the deregistration race bug which is unavoidable with the old libxl. Simply correctly implementing both the deregistration callback and the modification callback ought to do it. > >> @@ -184,6 +184,8 @@ static void libxlTimerCallback(int timer > >> ATTRIBUTE_UNUSED, void *timer_v) > >> { > >> struct libxlOSEventHookTimerInfo *timer_info = timer_v; > >> > >> + virEventRemoveTimeout(timer_info->id); > >> + timer_info->id = -1; > >> > > > > I don't understand why you need this. Doesn't libvirt remove timers > > when they fire ? If it doesn't, do they otherwise not keep reoccurring ? > > No, timers are not removed when they fire. And they are continuous, so > will keep firing at each timeout. They can be disabled by setting the > timeout to -1, and can be set to fire on each iteration of the event > loop by setting the timeout to 0. But they must be explicitly removed > with virEventRemoveTimeout when no longer needed. Right. Well then yes you need to call virEventRemoveTimeout here. But that applies to both old and new libxl. Ian.