From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6yB1-0001ob-Uw for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:29:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6yAt-000672-Fm for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:28:59 -0400 Received: from mail-we0-x235.google.com ([2a00:1450:400c:c03::235]:52449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6yAt-00066w-9s for qemu-devel@nongnu.org; Wed, 07 Aug 2013 03:28:51 -0400 Received: by mail-we0-f181.google.com with SMTP id p58so1173482wes.26 for ; Wed, 07 Aug 2013 00:28:50 -0700 (PDT) Date: Wed, 7 Aug 2013 09:28:48 +0200 From: Stefan Hajnoczi Message-ID: <20130807072848.GD19825@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> <4FE95B1A574C1722D12112FE@nimrod.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FE95B1A574C1722D12112FE@nimrod.local> Subject: Re: [Qemu-devel] [RFC] [PATCHv6 08/16] aio / timers: Add QEMUTimerListGroup to AioContext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org, liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net On Tue, Aug 06, 2013 at 03:58:40PM +0100, Alex Bligh wrote: > --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. Nice, the comment makes the SEGV clear.