From nobody Thu Nov 6 01:10:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538297735904312.4672246174798; Sun, 30 Sep 2018 01:55:35 -0700 (PDT) Received: from localhost ([::1]:54443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6XVm-0000UK-PT for importer@patchew.org; Sun, 30 Sep 2018 04:55:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Wrf-0002Zd-3H for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6Wre-0000te-98 for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:07 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:33807) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6Wrd-0000si-Ou for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:06 -0400 Received: by mail-wm1-x32c.google.com with SMTP id z25-v6so827237wmf.1 for ; Sun, 30 Sep 2018 01:14:05 -0700 (PDT) Received: from 640k.lan (94-36-187-248.adsl-ull.clienti.tiscali.it. [94.36.187.248]) by smtp.gmail.com with ESMTPSA id u76-v6sm11369194wmd.10.2018.09.30.01.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Sep 2018 01:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XVK4iUB7oEPoDzltm55uEizYBC7Ll0Z07xviUtVLiPw=; b=nsqIBo9PaR8lbNLyGQTC9wnedpPS+Aydw8tCovm+rO2pMkyKd15e5CUpqNvwPR/4Mg xDtXrdlj5S5nQgRzGro8fNxOREkM6kJhjDabiHRpGNVmARUlgq7v9yZiBc9YYB46NcjK LSYRH2WuZYkv7yUFzauwKzK8aw4KL4uucfGWoahQOOfSnCA9ttNHTV2ZFxaqp/xz7fr4 smhLgKoUxOlqiRRua+TRKQnGIKT+8CSVav2TqjMzRCyZuYq/jxbwMltfJTvXsFJwXGOL EUrIndb1DvZ3+rj0vovFYwjcDPRv0MKI/FiLxMxbrqxcJgrqpS6PRrAuNEh/2wI448Vy bzOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=XVK4iUB7oEPoDzltm55uEizYBC7Ll0Z07xviUtVLiPw=; b=FxakNoVoXzEt1KSBmU5x/vHKExIopC1XNwT3NBXnPbAMDf342+mjKx6yzpd5UzpoDs wVMKo5YnVK2iodJaTZcD0/8dBJQ3Ss9WUtBiktO7t05S9RDNy4XojiXCMQ270F8zu2L+ wyTJfMtz2RjijWbe8h8NdZ9TuYdEcKcpPWCNdQYkp5ipBD3C4L8Iorh4tzkybJUGiHqP 4p/6Z2TNAjaxD5hPfc9bTbbG8iiocdtvFVy7bE45qmUjTsIvaZCj+bMG0olC5jn+5/Kg iHJa2VetgbQZnDzejCVqt8/VkiMbAo3AiMr0A2JAT2UZhOJ9P6e30IBSELHjqQbL0+Vt kKQQ== X-Gm-Message-State: ABuFfohcW4g5udsVUB1AeSgDMcpMR63TnfZF9dlAfCOHLhucEUDWP9dN 7p37RKlVv+KnZVMJpiDiWGkOxamJ X-Google-Smtp-Source: ACcGV62/cZ57wQyx202m0WuMfqiaCpawVn98uMEjZguRhqkk5i1m2LAr0x8OxnOlDvpzJDL/Yy2zDg== X-Received: by 2002:a1c:8942:: with SMTP id l63-v6mr6240516wmd.66.1538295243935; Sun, 30 Sep 2018 01:14:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 30 Sep 2018 10:12:39 +0200 Message-Id: <1538295197-23704-42-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> References: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32c Subject: [Qemu-devel] [PULL 41/79] replay: allow loading any snapshots before recording 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch enables using -loadvm in recording mode to allow starting the execution recording from any of the available snapshots. It also fixes loading of the record/replay state, therefore snapshots created in replay mode may also be used for starting the new recording. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180912081939.3228.56131.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- replay/replay-snapshot.c | 17 ++++++++++++----- vl.c | 7 ++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index 2ab85cf..16bacc9 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -33,11 +33,18 @@ static int replay_pre_save(void *opaque) static int replay_post_load(void *opaque, int version_id) { ReplayState *state =3D opaque; - fseek(replay_file, state->file_offset, SEEK_SET); - qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last); - /* If this was a vmstate, saved in recording mode, - we need to initialize replay data fields. */ - replay_fetch_data_kind(); + if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + fseek(replay_file, state->file_offset, SEEK_SET); + qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last); + /* If this was a vmstate, saved in recording mode, + we need to initialize replay data fields. */ + replay_fetch_data_kind(); + } else if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + /* This is only useful for loading the initial state. + Therefore reset all the counters. */ + state->instructions_count =3D 0; + state->block_request_id =3D 0; + } =20 return 0; } diff --git a/vl.c b/vl.c index f2964d9..0388852 100644 --- a/vl.c +++ b/vl.c @@ -4535,9 +4535,7 @@ int main(int argc, char **argv, char **envp) replay_checkpoint(CHECKPOINT_RESET); qemu_system_reset(SHUTDOWN_CAUSE_NONE); register_global_state(); - if (replay_mode !=3D REPLAY_MODE_NONE) { - replay_vmstate_init(); - } else if (loadvm) { + if (loadvm) { Error *local_err =3D NULL; if (load_snapshot(loadvm, &local_err) < 0) { error_report_err(local_err); @@ -4545,6 +4543,9 @@ int main(int argc, char **argv, char **envp) exit(1); } } + if (replay_mode !=3D REPLAY_MODE_NONE) { + replay_vmstate_init(); + } =20 qdev_prop_check_globals(); if (vmstate_dump_file) { --=20 1.8.3.1