From patchwork Mon Feb 28 09:10:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 594641 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1S9AkBt006587 for ; Mon, 28 Feb 2011 09:10:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752799Ab1B1JKn (ORCPT ); Mon, 28 Feb 2011 04:10:43 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:49007 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577Ab1B1JKm (ORCPT ); Mon, 28 Feb 2011 04:10:42 -0500 Received: by gyh20 with SMTP id 20so1435602gyh.19 for ; Mon, 28 Feb 2011 01:10:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=t1zGv1ssbZSPBi72/eX3rwLIPqGnl8qRQUaYS52MUr0=; b=C38OBymiCcezsHqV4IcUt/TMmOMnJgMGvkDdSUP+OJpJQpmxqEl+7UE0otqaqYN0hm zWYFisREGkjPcwrJh/Bywauw0hGihaB4jSUaTQAC0TIANWHo8l6CPVjhczbBumLjsWrI GvEipo7abTngtaJr3Ftw+WOUdp29tPE/j4cYU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=IjW2poNAwP26dxc82CB8jpRDtSmYFptGj3izCuB+H4doC/qwe4mxvbizhDgnWb2xtq /oafOxrxRIMe0rIeU9lXfm+m8lp41M+WurIWgKowOPyqiLQ3Y/U13KO/qIBsc8HjSdhv 7TSwusci/qEY47UoERt7R767AfBGtgN9ez+6k= Received: by 10.150.205.17 with SMTP id c17mr719524ybg.365.1298884241456; Mon, 28 Feb 2011 01:10:41 -0800 (PST) Received: from localhost.localdomain (93-34-149-100.ip50.fastwebnet.it [93.34.149.100]) by mx.google.com with ESMTPS id 1sm2037209yhl.11.2011.02.28.01.10.39 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 28 Feb 2011 01:10:40 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, aurelien@aurel32.net, blauwirbel@gmail.com, jan.kiszka@siemes.com, mtosatti@redhat.com Subject: [PATCH v3 uq/master 02/22] implement win32 dynticks timer Date: Mon, 28 Feb 2011 10:10:04 +0100 Message-Id: <1298884224-19734-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1298884224-19734-1-git-send-email-pbonzini@redhat.com> References: <1298884224-19734-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Feb 2011 09:10:47 +0000 (UTC) diff --git a/qemu-timer.c b/qemu-timer.c index 88c7b28..122e7ed 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -1004,6 +1004,7 @@ static void win32_stop_timer(struct qemu_alarm_timer *t) static void win32_rearm_timer(struct qemu_alarm_timer *t) { struct qemu_alarm_win32 *data = t->priv; + int nearest_delta_ms; assert(alarm_has_dynticks(t)); if (!active_timers[QEMU_CLOCK_REALTIME] && @@ -1013,7 +1014,11 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t) timeKillEvent(data->timerId); - data->timerId = timeSetEvent(1, + nearest_delta_ms = (qemu_next_alarm_deadline() + 999999) / 1000000; + if (nearest_delta_ms < 1) { + nearest_delta_ms = 1; + } + data->timerId = timeSetEvent(nearest_delta_ms, data->period, host_alarm_handler, (DWORD)t,