From patchwork Sat Feb 26 15:39:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 84645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C14DAB7146 for ; Sun, 27 Feb 2011 02:42:13 +1100 (EST) Received: from localhost ([127.0.0.1]:39262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtMHa-0002E1-NQ for incoming@patchwork.ozlabs.org; Sat, 26 Feb 2011 10:42:10 -0500 Received: from [140.186.70.92] (port=40442 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtMFz-0002Bn-Jf for qemu-devel@nongnu.org; Sat, 26 Feb 2011 10:40:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtMFy-0007Rj-Na for qemu-devel@nongnu.org; Sat, 26 Feb 2011 10:40:31 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:41779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtMFy-0007RV-Eg for qemu-devel@nongnu.org; Sat, 26 Feb 2011 10:40:30 -0500 Received: by wwb29 with SMTP id 29so366964wwb.10 for ; Sat, 26 Feb 2011 07:40:29 -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=k7V4nWDJmk+y+5pK/KrwOEURHV6wi/LqeBjPIcRvmzsf5KLD0mvLrPeAs4t3oRvSN3 Xat/XfETHw+WCGahgLVtjcW/Y7x88rVtbte7GD/rj16h93e47gVZVkk6arlEjwKSsVrL NP4KllQ3clOT0zDczXT5BejFrNXZ+326sGbUY= 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=A+L+B9ej0avih6xoQKJFRCCVTX2Y333Y7GOeQgotkDtZgVvj20zAxglkBbTl/t1W8m IJ1J5cfH8AXloyDzbYSEvUw8QnIr1s0EywXQoJoB0TDDg2JS1McpH+So2xjtwyLi7257 6Sr3hhkrOv4ejMH2mylHHVZvIptBvyvdFfElU= Received: by 10.227.138.19 with SMTP id y19mr3233791wbt.55.1298734829548; Sat, 26 Feb 2011 07:40:29 -0800 (PST) Received: from localhost.localdomain (93-34-149-100.ip50.fastwebnet.it [93.34.149.100]) by mx.google.com with ESMTPS id f27sm1592788wbf.1.2011.02.26.07.40.28 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 26 Feb 2011 07:40:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sat, 26 Feb 2011 16:39:59 +0100 Message-Id: <1298734819-1960-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1298734819-1960-1-git-send-email-pbonzini@redhat.com> References: <1298734819-1960-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.53 Cc: jan.kiszka@siemens.com, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v2 upstream 02/22] implement win32 dynticks timer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini --- qemu-timer.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) 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,