From patchwork Wed Mar 10 10:38:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 47244 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 EB55DB7CF6 for ; Wed, 10 Mar 2010 22:40:57 +1100 (EST) Received: from localhost ([127.0.0.1]:55341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpKHW-0006em-Fu for incoming@patchwork.ozlabs.org; Wed, 10 Mar 2010 06:40:54 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpJJt-0008O0-8H for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:39:17 -0500 Received: from [199.232.76.173] (port=52793 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpJJr-0008MN-Uo for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:39:16 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpJJr-0004vP-0K for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:39:15 -0500 Received: from mail-ew0-f225.google.com ([209.85.219.225]:44410) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NpJJq-0004sQ-LI for qemu-devel@nongnu.org; Wed, 10 Mar 2010 05:39:14 -0500 Received: by mail-ew0-f225.google.com with SMTP id 25so153299ewy.16 for ; Wed, 10 Mar 2010 02:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:subject:date :message-id:x-mailer:in-reply-to:references; bh=adBVkltBnwsIbcMqA9DXm8yraIIdonlm8QlTxNH+9eg=; b=kQ2Glt5gMhLqaUK9zCPU6OMzNliL5Y2PFcysyEMwq8ubDOK5Ba0QepIgHYmIfmmEY6 ez6pnPp+VpSmuxuIOCZmLPBAZzOJjYSPP69LbiISykNg7j9C2xeoTB585OxKFf+6lcXt 1eQ2AeVjYTlVnWQBjpKl3+xYVB4HGGsnIu4SU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; b=X4lXnDjRYM40ZiK7eLKoWznHaPlHw9NW82Y9FLCu24Wmzl4ySRH8zZHDf7VujtyoMk MnKH/gzpQXi2Z4YnJ5kHpioRzOqvgYo7+kNwLV41jho2ORrX3J6qnyH8Dky2BvBVxwV8 gewEcPpuyWKHAGa369Bm8DywzzZjkJpgloX14= Received: by 10.213.104.72 with SMTP id n8mr4856520ebo.13.1268217553687; Wed, 10 Mar 2010 02:39:13 -0800 (PST) Received: from localhost.localdomain (nat-pool-brq-t.redhat.com [209.132.186.34]) by mx.google.com with ESMTPS id 14sm3836002ewy.2.2010.03.10.02.39.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Mar 2010 02:39:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 10 Mar 2010 11:38:52 +0100 Message-Id: <1268217535-26554-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.6.6 In-Reply-To: <1268217535-26554-1-git-send-email-pbonzini@redhat.com> References: <1268217535-26554-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 15/18] move vmstate registration of vmstate_timers earlier 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 --- vl.c | 62 +++++++++++++++++++++++++++++++------------------------------- 1 files changed, 31 insertions(+), 31 deletions(-) diff --git a/vl.c b/vl.c index d10319f..3d8f089 100644 --- a/vl.c +++ b/vl.c @@ -722,36 +722,6 @@ static void icount_adjust_vm(void * opaque) icount_adjust(); } -static void configure_icount(const char *option) -{ - if (!option) - return; - - if (strcmp(option, "auto") != 0) { - icount_time_shift = strtol(option, NULL, 0); - use_icount = 1; - return; - } - - use_icount = 2; - - /* 125MIPS seems a reasonable initial guess at the guest speed. - It will be corrected fairly quickly anyway. */ - icount_time_shift = 3; - - /* Have both realtime and virtual time triggers for speed adjustment. - The realtime trigger catches emulated time passing too slowly, - the virtual time trigger catches emulated time passing too fast. - Realtime triggers occur even when idle, so use them less frequently - than VM triggers. */ - icount_rt_timer = qemu_new_timer(rt_clock, icount_adjust_rt, NULL); - qemu_mod_timer(icount_rt_timer, - qemu_get_clock(rt_clock) + 1000); - icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL); - qemu_mod_timer(icount_vm_timer, - qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10); -} - static int64_t qemu_icount_round(int64_t count) { return (count + (1 << icount_time_shift) - 1) >> icount_time_shift; @@ -1056,6 +1026,37 @@ static const VMStateDescription vmstate_timers = { } }; +static void configure_icount(const char *option) +{ + vmstate_register(0, &vmstate_timers, &timers_state); + if (!option) + return; + + if (strcmp(option, "auto") != 0) { + icount_time_shift = strtol(option, NULL, 0); + use_icount = 1; + return; + } + + use_icount = 2; + + /* 125MIPS seems a reasonable initial guess at the guest speed. + It will be corrected fairly quickly anyway. */ + icount_time_shift = 3; + + /* Have both realtime and virtual time triggers for speed adjustment. + The realtime trigger catches emulated time passing too slowly, + the virtual time trigger catches emulated time passing too fast. + Realtime triggers occur even when idle, so use them less frequently + than VM triggers. */ + icount_rt_timer = qemu_new_timer(rt_clock, icount_adjust_rt, NULL); + qemu_mod_timer(icount_rt_timer, + qemu_get_clock(rt_clock) + 1000); + icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL); + qemu_mod_timer(icount_vm_timer, + qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10); +} + static void qemu_run_all_timers(void) { /* rearm timer, if not periodic */ @@ -5929,7 +5930,6 @@ int main(int argc, char **argv, char **envp) if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, machine, 1) != 0) exit(1); - vmstate_register(0, &vmstate_timers ,&timers_state); register_savevm_live("ram", 0, 3, NULL, ram_save_live, NULL, ram_load, NULL);