From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQNTT-00068v-SF for qemu-devel@nongnu.org; Tue, 24 Feb 2015 16:57:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQNTP-0000n5-RT for qemu-devel@nongnu.org; Tue, 24 Feb 2015 16:57:03 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:51510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQNTP-0000mu-Kf for qemu-devel@nongnu.org; Tue, 24 Feb 2015 16:56:59 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Feb 2015 14:56:59 -0700 From: Michael Roth Date: Tue, 24 Feb 2015 15:48:17 -0600 Message-Id: <1424814498-6993-43-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1424814498-6993-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1424814498-6993-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 42/43] qtest: Fix deadloop by running main loop AIO context's timers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Fam Zheng , qemu-stable@nongnu.org, Stefan Hajnoczi From: Fam Zheng qemu_clock_run_timers() only takes care of main_loop_tlg, we shouldn't forget aio timer list groups. Currently, the qemu_clock_deadline_ns_all (a few lines above) counts all the timergroups of this clock type, including aio tlg, but we don't fire them, so they are never cleared, which makes a dead loop. For example, this function hangs when trying to drive throttled block request queue with qtest clock_step. Signed-off-by: Fam Zheng Acked-by: Paolo Bonzini Message-id: 1421661103-29153-1-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit efef88b3d9ad4325172ed288032807fa88d683cc) Signed-off-by: Michael Roth --- cpus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpus.c b/cpus.c index 0c33458..ff555e2 100644 --- a/cpus.c +++ b/cpus.c @@ -372,15 +372,19 @@ static void icount_warp_rt(void *opaque) void qtest_clock_warp(int64_t dest) { int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + AioContext *aio_context; assert(qtest_enabled()); + aio_context = qemu_get_aio_context(); while (clock < dest) { int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); int64_t warp = qemu_soonest_timeout(dest - clock, deadline); + seqlock_write_lock(&timers_state.vm_clock_seqlock); timers_state.qemu_icount_bias += warp; seqlock_write_unlock(&timers_state.vm_clock_seqlock); qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); + timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]); clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); } qemu_clock_notify(QEMU_CLOCK_VIRTUAL); -- 1.9.1