From patchwork Tue Aug 9 07:49:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 9270569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0755A60839 for ; Tue, 9 Aug 2016 07:50:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECF7B27D0C for ; Tue, 9 Aug 2016 07:50:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD9C9283EE; Tue, 9 Aug 2016 07:50:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4900827D0C for ; Tue, 9 Aug 2016 07:50:26 +0000 (UTC) Received: from localhost ([::1]:34034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX1ns-0008V7-Q7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Aug 2016 03:50:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX1nR-0008Un-LI for qemu-devel@nongnu.org; Tue, 09 Aug 2016 03:49:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bX1nN-0006py-Gz for qemu-devel@nongnu.org; Tue, 09 Aug 2016 03:49:56 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:54187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX1nM-0006oP-HG; Tue, 09 Aug 2016 03:49:53 -0400 Received: from 172.24.1.60 (EHLO szxeml434-hub.china.huawei.com) ([172.24.1.60]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DPC39751; Tue, 09 Aug 2016 15:49:38 +0800 (CST) Received: from localhost (10.177.18.62) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.235.1; Tue, 9 Aug 2016 15:49:28 +0800 From: Gonglei To: Date: Tue, 9 Aug 2016 15:49:15 +0800 Message-ID: <1470728955-90600-1-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 2.6.3.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.18.62] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.57A98B15.00B3, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 41450560950c65cf0684bab94ef6f722 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 58.251.152.64 Subject: [Qemu-devel] [PATCH] timer: set vm_clock disabled default X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr . David Alan Gilbert" , qemu-stable@nongnu.org, Gonglei , stefanha@redhat.com, amit.shah@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP (commit 80dcfb8532ae76343109a48f12ba8ca1c505c179) Upon migration, the code use a timer based on vm_clock for 1ns in the future from post_load to do the event send in case host_connected differs between migration source and target. However, it's not guaranteed that the apic is ready to inject irqs into the guest, and the irq line remained high, resulting in any future interrupts going unnoticed by the guest as well. That's because 1) the migration coroutine is not blocked when it get EAGAIN while reading QEMUFile. 2) The vm_clock is enabled default currently, it doesn't rely on the calling of vm_start(), that means vm_clock timers can run before VCPUs are running. So, let's set the vm_clock disabled default, keep the initial intention of design for vm_clock timers. Meanwhile, change the test-aio usecase, using QEMU_CLOCK_REALTIME instead of QEMU_CLOCK_VIRTUAL as the block code does. CC: Paolo Bonzini CC: Dr. David Alan Gilbert CC: qemu-stable@nongnu.org Signed-off-by: Gonglei --- qemu-timer.c | 2 +- tests/test-aio.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qemu-timer.c b/qemu-timer.c index eb22e92..9299cdc 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -129,7 +129,7 @@ static void qemu_clock_init(QEMUClockType type) assert(main_loop_tlg.tl[type] == NULL); clock->type = type; - clock->enabled = true; + clock->enabled = (type == QEMU_CLOCK_VIRTUAL ? false : true); clock->last = INT64_MIN; QLIST_INIT(&clock->timerlists); notifier_list_init(&clock->reset_notifiers); diff --git a/tests/test-aio.c b/tests/test-aio.c index 982339c..03aa846 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -452,7 +452,7 @@ static void test_timer_schedule(void) { TimerTestData data = { .n = 0, .ctx = ctx, .ns = SCALE_MS * 750LL, .max = 2, - .clock_type = QEMU_CLOCK_VIRTUAL }; + .clock_type = QEMU_CLOCK_REALTIME }; EventNotifier e; /* aio_poll will not block to wait for timers to complete unless it has @@ -782,7 +782,7 @@ static void test_source_timer_schedule(void) { TimerTestData data = { .n = 0, .ctx = ctx, .ns = SCALE_MS * 750LL, .max = 2, - .clock_type = QEMU_CLOCK_VIRTUAL }; + .clock_type = QEMU_CLOCK_REALTIME }; EventNotifier e; int64_t expiry;