From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54615) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6iiw-0007uA-Cs for qemu-devel@nongnu.org; Tue, 06 Aug 2013 10:58:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6iit-0001Gz-W9 for qemu-devel@nongnu.org; Tue, 06 Aug 2013 10:58:58 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:56570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6iit-0001Ge-PX for qemu-devel@nongnu.org; Tue, 06 Aug 2013 10:58:55 -0400 Date: Tue, 06 Aug 2013 15:58:40 +0100 From: Alex Bligh Message-ID: <4FE95B1A574C1722D12112FE@nimrod.local> In-Reply-To: <20130806144512.GD4373@stefanha-thinkpad.redhat.com> References: <1375639805-1943-1-git-send-email-alex@alex.org.uk> <1375780592-22842-1-git-send-email-alex@alex.org.uk> <1375780592-22842-9-git-send-email-alex@alex.org.uk> <20130806123043.GD30812@stefanha-thinkpad.redhat.com> <37C2525C31EFF8413E621C3E@nimrod.local> <20130806144512.GD4373@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext Reply-To: Alex Bligh List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , Alex Bligh , qemu-devel@nongnu.org, liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net Stefan, --On 6 August 2013 16:45:12 +0200 Stefan Hajnoczi wrote: >> Because otherwise make check SEGVs after the patch. > > It wasn't clear from the patch why there would be a crash. I looked > deeper and timerlistgroup_init() calls qemu_get_clock() indirectly, so > we need to make sure that qemu_clocks[] is initialized to avoid a NULL > pointer dereference. Actually now I recall v4 had: @@ -215,6 +216,12 @@ AioContext *aio_context_new(void) aio_set_event_notifier(ctx, &ctx->notifier, (EventNotifierHandler *) event_notifier_test_and_clear, NULL); + /* Assert if we don't have rt_clock yet. If you see this assertion + * it means you are using AioContext without having first called + * init_clocks() in main(). + */ + assert(rt_clock); + ctx->tl = qemu_new_timerlist(rt_clock); The equivalent in v7 would be an assert in timerlist_new_from_clock to check 'clock' is non-NULL. I shall put that in as the reason for this SEGV is non-obvious. -- Alex Bligh