From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957818; cv=none; d=zoho.com; s=zohoarc; b=L7SqBVXB5pfI6KkOWt4qwALcgkgWKAi9NRj+5Hw4J/wnT1N+f1GYPZvwNMokleHe7HFCdhjGPNlTUbyQUd20rJxNORCU9QboC6i4fJkYjUgmz6ywMzUYi2VhCIYWEi889XZrx5+J8n5vQwEWW+bwFsS/sRszpzSX0Hc/zX7eVOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957818; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=buPsL5PLrDwxxgpsn9NBvoRVU78cNf46I1QhIpZJ/uU=; b=SRnlu2lC19cEo73gwN+t5rjz4TlcvPA7cTLM17KVijWKfRMMvNPAMa5i0JNByl6Yq6T7RMYfOa8IVdVPRNeHFFE63dd1YmHUIX9O3o8TfuSKHJB5h8lU0t0rvxq9mor/kh/D5sNxu5XCP3D1fkyI0fgIGRLx14KwoeBB20U5Qn8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957818106609.1958661102599; Wed, 24 Jul 2019 01:43:38 -0700 (PDT) Received: from localhost ([::1]:49720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCs4-0002Be-L8 for importer@patchew.org; Wed, 24 Jul 2019 04:43:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33803) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCrq-0001QJ-1t for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCrp-0001WZ-1g for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:21 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58774) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCro-0001WG-On for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:20 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id DE9D454006A; Wed, 24 Jul 2019 11:43:19 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:14 +0300 Message-ID: <156395779468.510.5523165981170975777.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 01/14] replay: add missing fix for internal function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: pbonzini@redhat.com This is a fix which was missed by patch 74c0b816adfc6aa1b01b4426fdf385e32e35cbac, which added current_step parameter to the replay_advance_current_step function. Signed-off-by: Pavel Dovgalyuk --- replay/replay-internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/replay/replay-internal.c b/replay/replay-internal.c index 9e41ed1dcf..979f3a0b39 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -228,7 +228,7 @@ void replay_mutex_unlock(void) =20 void replay_advance_current_step(uint64_t current_step) { - int diff =3D (int)(replay_get_current_step() - replay_state.current_st= ep); + int diff =3D (int)(current_step - replay_state.current_step); =20 /* Time can only go forward */ assert(diff >=3D 0); From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957831; cv=none; d=zoho.com; s=zohoarc; b=Ep4YPoUYFWboQN0BmgkZ0y3fhMYxYPcdwdQf5XVChi6MeTrOLrpumaIxyLdMfHJ6s5nH9RnqjgJhgk/el0v4Gy/2K00LnXhzd6Pv4wq7bKTzrxiasDAB38JDz/J/I+4q85VErTizQ0lM4aIMCW2KA1Saig2k9jhHts121gyraUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957831; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=oesNHVg6krrhz9pMWh+r/v3Dq4dM4AdMKalEHvOa2ZI=; b=bz6rnirdIIdVoxHF0sWhhloXpa8HGfw0F5gjaHtbDxQpwnErtBz9Hkcblk8EOTi/GO0HTypztltuJLk+Swmu5LmPDouGnQIhfYK1qiPbJlJNoPymtXjLAPsD3Zo4qBP9klju+bnfNaqmB44u+0cpZpePaG84PklN1SYTGKpmuPA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957831522570.0669269709546; Wed, 24 Jul 2019 01:43:51 -0700 (PDT) Received: from localhost ([::1]:49724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsI-000338-7n for importer@patchew.org; Wed, 24 Jul 2019 04:43:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33860) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCrv-0001pH-Gg for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCru-0001aw-JZ for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:27 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCru-0001aZ-Bs for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:26 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 81DA054006A; Wed, 24 Jul 2019 11:43:25 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:25 +0300 Message-ID: <156395780533.510.15015784076229983598.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 02/14] block: implement bdrv_snapshot_goto for blkreplay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch enables making snapshots with blkreplay used in block devices. This function is required to make bdrv_snapshot_goto without calling .bdrv_open which is not implemented. Signed-off-by: Pavel Dovgalyuk Acked-by: Kevin Wolf --- block/blkreplay.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/blkreplay.c b/block/blkreplay.c index 2b7931b940..c96ac8f4bc 100644 --- a/block/blkreplay.c +++ b/block/blkreplay.c @@ -126,6 +126,12 @@ static int coroutine_fn blkreplay_co_flush(BlockDriver= State *bs) return ret; } =20 +static int blkreplay_snapshot_goto(BlockDriverState *bs, + const char *snapshot_id) +{ + return bdrv_snapshot_goto(bs->file->bs, snapshot_id, NULL); +} + static BlockDriver bdrv_blkreplay =3D { .format_name =3D "blkreplay", .instance_size =3D 0, @@ -140,6 +146,8 @@ static BlockDriver bdrv_blkreplay =3D { .bdrv_co_pwrite_zeroes =3D blkreplay_co_pwrite_zeroes, .bdrv_co_pdiscard =3D blkreplay_co_pdiscard, .bdrv_co_flush =3D blkreplay_co_flush, + + .bdrv_snapshot_goto =3D blkreplay_snapshot_goto, }; =20 static void bdrv_blkreplay_init(void) From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957840; cv=none; d=zoho.com; s=zohoarc; b=DG3sfhYoIQIIS6yQWvPYc5iCujO3GEWv9IqX2pRL6nW/Yx9rcwYcH3AYVnxs+ssdCe9+Nrtrv0H4VRQ65vABZLgPf5YON0/pGNf0jB77bPaCKRYL1gkyQCjkl/dNa6cTqq9Lvz0pGVVosMBARryYAaREQoZskpMNnqsX1zgh8As= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957840; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aG8MdpbyH1QBkk5/LwbaTHdjBVVJdCbU3FNx4aSEY40=; b=aIjO4qjCsPE23Yp4/buDsuLxP9E3g/Wt7Oqcw23/JSucfeOu8RQaJTf7Ipp89admJfKpiVqZaADcoCtMvJfmesw750PcfTbnOjSfem/xWOtY4dDWE1wbIa8XVlfU1nG0XSbye6lTGHEeS1GOzjHamDCKGecKhh2w9vW1Ga23xAo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957840674473.3674410918985; Wed, 24 Jul 2019 01:44:00 -0700 (PDT) Received: from localhost ([::1]:49730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsR-0003ep-9K for importer@patchew.org; Wed, 24 Jul 2019 04:43:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33900) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCs1-0002GC-B2 for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCs0-0001jN-61 for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:33 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCrz-0001j6-Tp for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:32 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 16FEC54006A; Wed, 24 Jul 2019 11:43:31 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:30 +0300 Message-ID: <156395781091.510.11391851999381257435.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 03/14] replay: disable default snapshot for record/replay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch disables setting '-snapshot' option on by default in record/replay mode. This is needed for creating vmstates in record and replay modes. Signed-off-by: Pavel Dovgalyuk Acked-by: Kevin Wolf --- vl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index b426b32134..b73fd078a8 100644 --- a/vl.c +++ b/vl.c @@ -1202,7 +1202,7 @@ static void configure_blockdev(BlockdevOptionsQueue *= bdo_queue, qapi_free_BlockdevOptions(bdo->bdo); g_free(bdo); } - if (snapshot || replay_mode !=3D REPLAY_MODE_NONE) { + if (snapshot) { qemu_opts_foreach(qemu_find_opts("drive"), drive_enable_snapshot, NULL, NULL); } @@ -3051,7 +3051,13 @@ int main(int argc, char **argv, char **envp) drive_add(IF_PFLASH, -1, optarg, PFLASH_OPTS); break; case QEMU_OPTION_snapshot: - snapshot =3D 1; + { + Error *blocker =3D NULL; + snapshot =3D 1; + error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, + "-snapshot"); + replay_add_blocker(blocker); + } break; case QEMU_OPTION_numa: opts =3D qemu_opts_parse_noisily(qemu_find_opts("numa"), From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957853; cv=none; d=zoho.com; s=zohoarc; b=TNqyEGJeygBZqyVnGqR+PfdXnoPp7fA6Abm212izbhDvFPCicf5FGb1BTdNlU4/JcDwNbMJ5NM1lFyssuwcYSNT2t/AkXucQ8iHLU8zynSsCUvHEBzJnyLyiO+98fiErvz8XaTLr6GijYppEsuxMnSrCUCdryX0m1OoJXFjxA1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957853; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=woLJi0eBoTgOWu5b82JfPVbadUBgDRHctkII+RZrH/c=; b=Q+eijI2GKB/y5HInAemXT0DIkfa3m7hQdsBQfWYxeWw7vD7TS2os9KxpKujaBalcL/0ggGFFIB1G12YfOZG4Z+mbbCuaRHx5dhzh8Pje9ayKIXIExyzYxcZG+uMJfaUemgZxJnOn+g0ZQWAVj5uAG5AnsH4PDltWJzc+FTGCxG8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957853751484.7931450723769; Wed, 24 Jul 2019 01:44:13 -0700 (PDT) Received: from localhost ([::1]:49736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCse-0004cO-Du for importer@patchew.org; Wed, 24 Jul 2019 04:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33959) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCs7-0002gg-A0 for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCs5-0001p1-Uj for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:39 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCs5-0001oc-Kh for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:37 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id B390E54006A; Wed, 24 Jul 2019 11:43:36 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:36 +0300 Message-ID: <156395781647.510.3444198291663687522.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 04/14] replay: update docs for record/replay with block devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch updates the description of the command lines for using record/replay with attached block devices. Signed-off-by: Pavel Dovgalyuk --- docs/replay.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/replay.txt b/docs/replay.txt index ee6aee9861..ce97c3f72f 100644 --- a/docs/replay.txt +++ b/docs/replay.txt @@ -27,7 +27,7 @@ Usage of the record/replay: * First, record the execution with the following command line: qemu-system-i386 \ -icount shift=3D7,rr=3Drecord,rrfile=3Dreplay.bin \ - -drive file=3Ddisk.qcow2,if=3Dnone,id=3Dimg-direct \ + -drive file=3Ddisk.qcow2,if=3Dnone,snapshot,id=3Dimg-direct \ -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkre= play \ -device ide-hd,drive=3Dimg-blkreplay \ -netdev user,id=3Dnet1 -device rtl8139,netdev=3Dnet1 \ @@ -35,7 +35,7 @@ Usage of the record/replay: * After recording, you can replay it by using another command line: qemu-system-i386 \ -icount shift=3D7,rr=3Dreplay,rrfile=3Dreplay.bin \ - -drive file=3Ddisk.qcow2,if=3Dnone,id=3Dimg-direct \ + -drive file=3Ddisk.qcow2,if=3Dnone,snapshot,id=3Dimg-direct \ -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkre= play \ -device ide-hd,drive=3Dimg-blkreplay \ -netdev user,id=3Dnet1 -device rtl8139,netdev=3Dnet1 \ @@ -223,7 +223,7 @@ Block devices record/replay module intercepts calls of bdrv coroutine functions at the top of block drivers stack. To record and replay block operations the drive must be configured as following: - -drive file=3Ddisk.qcow2,if=3Dnone,id=3Dimg-direct + -drive file=3Ddisk.qcow2,if=3Dnone,snapshot,id=3Dimg-direct -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkreplay -device ide-hd,drive=3Dimg-blkreplay =20 @@ -252,6 +252,12 @@ This snapshot is created at start of recording and res= tored at start of replaying. It also can be loaded while replaying to roll back the execution. =20 +'snapshot' flag of the disk image must be removed to save the snapshots +in the overlay (or original image) instead of using the temporary overlay. + -drive file=3Ddisk.ovl,if=3Dnone,id=3Dimg-direct + -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkreplay + -device ide-hd,drive=3Dimg-blkreplay + Use QEMU monitor to create additional snapshots. 'savevm ' command created the snapshot and 'loadvm ' restores it. To prevent corruption of the original disk image, use overlay files linked to the original image= s. From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957879; cv=none; d=zoho.com; s=zohoarc; b=WbupSAj3kNK5JN17tKkpv0rPL5Ly1dUdSh5r//GXXcBWe3VZRjpPdOEPMCyf56pTCUa8LUjxIrQZ3mdXaFF8sPnKo5/QtX75WaRrQJIcAxrBP/ii/ccFOEvaGMyZQITTekI57auifCMedoJM9TLTMmbLVdOJhpbCpLH8TSwldDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jJRqyXWsq/0D9rFSsID73lc4bQwoqXKtz/BEWCCsWrk=; b=hxBj2LObDz/6jznxWjQzd1GPaJmKC0lBcXx6LQ2R1AzC6FEiKN+CcjhX3uNsD67+M4ReK0Cr/xAmEi08Qs2yZWuUXQrV3IAaSYanCzZt6MeVv7J9887EElsKDoIj6dfh/+Q+KMOhejy6Yjt16nQ7gSi7I/8Q75uYu4y79Q0eKaU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957879066242.9228575178804; Wed, 24 Jul 2019 01:44:39 -0700 (PDT) Received: from localhost ([::1]:49750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCt3-0006FD-KG for importer@patchew.org; Wed, 24 Jul 2019 04:44:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34042) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsI-0003XA-Kt for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsG-0001w1-Kx for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:49 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsE-0001sE-Kg for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:46 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 616E154006A; Wed, 24 Jul 2019 11:43:42 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:42 +0300 Message-ID: <156395782219.510.3522820414145670622.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 05/14] replay: don't drain/flush bdrv queue while RR is working X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk In record/replay mode bdrv queue is controlled by replay mechanism. It does not allow saving or loading the snapshots when bdrv queue is not empty. Stopping the VM is not blocked by nonempty queue, but flushing the queue is still impossible there, because it may cause deadlocks in replay mode. This patch disables bdrv_drain_all and bdrv_flush_all in record/replay mode. Stopping the machine when the IO requests are not finished is needed for the debugging. E.g., breakpoint may be set at the specified step, and forcing the IO requests to finish may break the determinism of the execution. Signed-off-by: Pavel Dovgalyuk Acked-by: Kevin Wolf --- block/io.c | 28 ++++++++++++++++++++++++++++ cpus.c | 2 -- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/block/io.c b/block/io.c index 06305c6ea6..2e71bcb8d6 100644 --- a/block/io.c +++ b/block/io.c @@ -32,6 +32,7 @@ #include "qemu/cutils.h" #include "qapi/error.h" #include "qemu/error-report.h" +#include "sysemu/replay.h" =20 #define NOT_DONE 0x7fffffff /* used while emulated sync operation in progr= ess */ =20 @@ -598,6 +599,15 @@ void bdrv_drain_all_begin(void) return; } =20 + /* + * bdrv queue is managed by record/replay, + * waiting for finishing the I/O requests may + * be infinite + */ + if (replay_events_enabled()) { + return; + } + /* AIO_WAIT_WHILE() with a NULL context can only be called from the ma= in * loop AioContext, so make sure we're in the main context. */ assert(qemu_get_current_aio_context() =3D=3D qemu_get_aio_context()); @@ -627,6 +637,15 @@ void bdrv_drain_all_end(void) BlockDriverState *bs =3D NULL; int drained_end_counter =3D 0; =20 + /* + * bdrv queue is managed by record/replay, + * waiting for finishing the I/O requests may + * be endless + */ + if (replay_events_enabled()) { + return; + } + while ((bs =3D bdrv_next_all_states(bs))) { AioContext *aio_context =3D bdrv_get_aio_context(bs); =20 @@ -1997,6 +2016,15 @@ int bdrv_flush_all(void) BlockDriverState *bs =3D NULL; int result =3D 0; =20 + /* + * bdrv queue is managed by record/replay, + * creating new flush request for stopping + * the VM may break the determinism + */ + if (replay_events_enabled()) { + return result; + } + for (bs =3D bdrv_first(&it); bs; bs =3D bdrv_next(&it)) { AioContext *aio_context =3D bdrv_get_aio_context(bs); int ret; diff --git a/cpus.c b/cpus.c index 927a00aa90..a71081b709 100644 --- a/cpus.c +++ b/cpus.c @@ -1081,7 +1081,6 @@ static int do_vm_stop(RunState state, bool send_stop) } =20 bdrv_drain_all(); - replay_disable_events(); ret =3D bdrv_flush_all(); =20 return ret; @@ -2162,7 +2161,6 @@ int vm_prepare_start(void) /* We are sending this now, but the CPUs will be resumed shortly later= */ qapi_event_send_resume(); =20 - replay_enable_events(); cpu_enable_ticks(); runstate_set(RUN_STATE_RUNNING); vm_state_notify(1, RUN_STATE_RUNNING); From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957923; cv=none; d=zoho.com; s=zohoarc; b=cWHjYMG9ECsWaPheapFVlL8BAzRjSfSVoA3OPAagpQuOH/kZE6lIoNy3/jRosXBaNXQTD9heHffEqdS4lOsfz02w0b/0syoxr6HDwKuL3KSJ4U3Vcx7ou6dGRJ0wMsW9c59qqKQ9+E+ZXC0LsV7aF5cB5IDL1VhsIj5Vx+PngA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957923; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eiopLL/FgHQpdjtwDye5AgzZL++KB+wG0aAjKprHRBM=; b=cSezP3N/+XpyTRCMet7SRWDohn7Au9KGwVAjnU2nOEx52zKE5H+UZOIVQXLx+bZC2SRsAEkQoOzvtgrdgRIUI6/lYOq+0Ly3+BMUdUJBhv0ZeAuJXol2+ZUQmNI3+VkWe0MZ/ufezQb9VGMb2rleCrbyRs7qfEkzeH0d/SYWJ2g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957923228220.45634556590846; Wed, 24 Jul 2019 01:45:23 -0700 (PDT) Received: from localhost ([::1]:49780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCtl-00010k-8a for importer@patchew.org; Wed, 24 Jul 2019 04:45:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34101) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsM-0003p4-Mm for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsK-00020o-NS for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:54 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsK-0001vu-Ct for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:52 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id EFEA354006B; Wed, 24 Jul 2019 11:43:47 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:47 +0300 Message-ID: <156395782778.510.5969781377069459076.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 06/14] replay: finish record/replay before closing the disks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk After recent updates block devices cannot be closed on qemu exit. This happens due to the block request polling when replay is not finished. Therefore now we stop execution recording before closing the block devices. Signed-off-by: Pavel Dovgalyuk --- replay/replay.c | 2 ++ vl.c | 1 + 2 files changed, 3 insertions(+) diff --git a/replay/replay.c b/replay/replay.c index 8b172b2d1b..b75820a1c1 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -385,6 +385,8 @@ void replay_finish(void) g_free(replay_snapshot); replay_snapshot =3D NULL; =20 + replay_mode =3D REPLAY_MODE_NONE; + replay_finish_events(); } =20 diff --git a/vl.c b/vl.c index b73fd078a8..2a341f5ad2 100644 --- a/vl.c +++ b/vl.c @@ -4499,6 +4499,7 @@ int main(int argc, char **argv, char **envp) =20 /* No more vcpu or device emulation activity beyond this point */ vm_shutdown(); + replay_finish(); =20 job_cancel_sync_all(); bdrv_close_all(); From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957896; cv=none; d=zoho.com; s=zohoarc; b=nwOGKZwmQOi0U1bxKlkej0B6B9NcRWiA9OwE/esoleQyEV5iTYlZkHU7Y39Tu1m0AIMQBwBzZ+3zz+U0g8VkzDGJZ0Co1b2ahxpSkUfHofsOIkjLts5sRp2L5sggNmVLqvT//TCP9f+x7G25wptCnb6znl+htEV/vasyBgtLlps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957896; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=F2hX2nGVf7YsepvW82z5tMqG9yridcyQMiHcfdsFoBg=; b=BAJ7Bu2hoQqC7z62UtrVx65GkukdTAiEqLUKfrqawbFv4HbN85Mh/IG1W+SqhB5jEH7LShhL1GWtKkfxFze1mpRiRfQ2uPIR/2zHOO3dTXDbV0xMo/5CO7bktNN102XCxAZvLj0NvMA29L9LXYtCKIZDMr3BVgu9qXDF5EXGcDg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957896603717.9796815657353; Wed, 24 Jul 2019 01:44:56 -0700 (PDT) Received: from localhost ([::1]:49760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCtK-0007cA-RN for importer@patchew.org; Wed, 24 Jul 2019 04:44:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34138) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsO-0003vl-7F for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsM-00022C-Un for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:56 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsM-00021d-MF for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:43:54 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 9C83254006A; Wed, 24 Jul 2019 11:43:53 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:53 +0300 Message-ID: <156395783337.510.3362257297033654967.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 07/14] replay: provide an accessor for rr filename X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch adds an accessor function for the name of the record/replay log file. Adding an accessor instead of making variable global, prevents accidental modification of this variable by other modules. Signed-off-by: Pavel Dovgalyuk --- include/sysemu/replay.h | 2 ++ replay/replay.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 3a7c58e423..b3f593f2f0 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -71,6 +71,8 @@ void replay_start(void); void replay_finish(void); /*! Adds replay blocker with the specified error description */ void replay_add_blocker(Error *reason); +/* Returns name of the replay log file */ +const char *replay_get_filename(void); =20 /* Processing the instructions */ =20 diff --git a/replay/replay.c b/replay/replay.c index b75820a1c1..aa534116b5 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -394,3 +394,8 @@ void replay_add_blocker(Error *reason) { replay_blockers =3D g_slist_prepend(replay_blockers, reason); } + +const char *replay_get_filename(void) +{ + return replay_filename; +} From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957955; cv=none; d=zoho.com; s=zohoarc; b=MSUUpACC6GKal3eNYeZcbAkeQoZXoQkF+BW8ePG+gZ0g5X8fiJsENetgABIbeSx4MDp7rwFVmVdE6ONmZZ1tCFDK+3c5UIYmqk5iAwZLsSD3+9/M2D7uNTgeX3MeSXa1af2s1kN0nWAS39hiWGYnleyPJ1Ier2FSx8F3VidvZ3g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957955; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pnyfidgY1kFU/GCWNHuEeIG9jzeNtxk4Dkq2N4IXV34=; b=EIQeuki4TVg5C+nyNzp+cqOAzlu5OaPEzPRnBrYLpSNXdn7BoxKFhvgW4CstdgsUO8GbjclzsQVpYSy3ZH5a0+9/8zpoUrxhtJ/nqBzkvY0p90hAinG939enqCIIAQsgmEd7kt3tH17WSCu9J0Gy6P8cZQ/xntAhaaBacXFrzwQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957955018112.89081166660412; Wed, 24 Jul 2019 01:45:55 -0700 (PDT) Received: from localhost ([::1]:49796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCuH-00039f-K0 for importer@patchew.org; Wed, 24 Jul 2019 04:45:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34169) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsU-0004NV-9x for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsS-00027X-HM for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:02 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsS-000274-1M for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:00 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 3518254006A; Wed, 24 Jul 2019 11:43:59 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:43:59 +0300 Message-ID: <156395783901.510.17125506199916135606.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 08/14] replay: add BH oneshot event for block layer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk Replay is capable of recording normal BH events, but sometimes there are single use callbacks scheduled with aio_bh_schedule_oneshot function. This patch enables recording and replaying such callbacks. Block layer uses these events for calling the completion function. Replaying these calls makes the execution deterministic. Signed-off-by: Pavel Dovgalyuk Acked-by: Kevin Wolf -- v6: - moved stub function to the separate file for fixing linux-user build v10: - replaced all block layer aio_bh_schedule_oneshot calls --- block/block-backend.c | 8 +++++--- block/io.c | 4 ++-- block/iscsi.c | 5 +++-- block/nfs.c | 5 +++-- block/null.c | 4 +++- block/nvme.c | 6 ++++-- block/rbd.c | 5 +++-- block/vxhs.c | 5 +++-- include/sysemu/replay.h | 3 +++ replay/replay-events.c | 16 ++++++++++++++++ replay/replay-internal.h | 1 + replay/replay.c | 2 +- stubs/Makefile.objs | 1 + stubs/replay-user.c | 9 +++++++++ 14 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 stubs/replay-user.c diff --git a/block/block-backend.c b/block/block-backend.c index 0056b526b8..b8b45e9e82 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -17,6 +17,7 @@ #include "block/throttle-groups.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" +#include "sysemu/replay.h" #include "qapi/error.h" #include "qapi/qapi-events-block.h" #include "qemu/id.h" @@ -1296,7 +1297,8 @@ BlockAIOCB *blk_abort_aio_request(BlockBackend *blk, acb->blk =3D blk; acb->ret =3D ret; =20 - aio_bh_schedule_oneshot(blk_get_aio_context(blk), error_callback_bh, a= cb); + replay_bh_schedule_oneshot_event(blk_get_aio_context(blk), + error_callback_bh, acb); return &acb->common; } =20 @@ -1352,8 +1354,8 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, in= t64_t offset, int bytes, =20 acb->has_returned =3D true; if (acb->rwco.ret !=3D NOT_DONE) { - aio_bh_schedule_oneshot(blk_get_aio_context(blk), - blk_aio_complete_bh, acb); + replay_bh_schedule_oneshot_event(blk_get_aio_context(blk), + blk_aio_complete_bh, acb); } =20 return &acb->common; diff --git a/block/io.c b/block/io.c index 2e71bcb8d6..ebff47e6e1 100644 --- a/block/io.c +++ b/block/io.c @@ -367,8 +367,8 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDr= iverState *bs, if (bs) { bdrv_inc_in_flight(bs); } - aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), - bdrv_co_drain_bh_cb, &data); + replay_bh_schedule_oneshot_event(bdrv_get_aio_context(bs), + bdrv_co_drain_bh_cb, &data); =20 qemu_coroutine_yield(); /* If we are resumed from some other event (such as an aio completion = or a diff --git a/block/iscsi.c b/block/iscsi.c index 506bf5f875..2ced15066a 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -40,6 +40,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "qemu/uuid.h" +#include "sysemu/replay.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc.h" #include "qapi/qmp/qdict.h" @@ -280,8 +281,8 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int st= atus, } =20 if (iTask->co) { - aio_bh_schedule_oneshot(iTask->iscsilun->aio_context, - iscsi_co_generic_bh_cb, iTask); + replay_bh_schedule_oneshot_event(iTask->iscsilun->aio_context, + iscsi_co_generic_bh_cb, iTask); } else { iTask->complete =3D 1; } diff --git a/block/nfs.c b/block/nfs.c index d93241b3bb..cfd6c956b3 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -37,6 +37,7 @@ #include "qemu/uri.h" #include "qemu/cutils.h" #include "sysemu/sysemu.h" +#include "sysemu/replay.h" #include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" @@ -257,8 +258,8 @@ nfs_co_generic_cb(int ret, struct nfs_context *nfs, voi= d *data, if (task->ret < 0) { error_report("NFS Error: %s", nfs_get_error(nfs)); } - aio_bh_schedule_oneshot(task->client->aio_context, - nfs_co_generic_bh_cb, task); + replay_bh_schedule_oneshot_event(task->client->aio_context, + nfs_co_generic_bh_cb, task); } =20 static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, uint64_t offse= t, diff --git a/block/null.c b/block/null.c index 699aa295cb..15e1d56746 100644 --- a/block/null.c +++ b/block/null.c @@ -17,6 +17,7 @@ #include "qemu/module.h" #include "qemu/option.h" #include "block/block_int.h" +#include "sysemu/replay.h" =20 #define NULL_OPT_LATENCY "latency-ns" #define NULL_OPT_ZEROES "read-zeroes" @@ -179,7 +180,8 @@ static inline BlockAIOCB *null_aio_common(BlockDriverSt= ate *bs, timer_mod_ns(&acb->timer, qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + s->latency_n= s); } else { - aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), null_bh_cb, acb); + replay_bh_schedule_oneshot_event(bdrv_get_aio_context(bs), + null_bh_cb, acb); } return &acb->common; } diff --git a/block/nvme.c b/block/nvme.c index c28755cc31..ac652e878c 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -22,6 +22,7 @@ #include "qemu/option.h" #include "qemu/vfio-helpers.h" #include "block/block_int.h" +#include "sysemu/replay.h" #include "trace.h" =20 #include "block/nvme.h" @@ -350,7 +351,8 @@ static bool nvme_process_completion(BDRVNVMeState *s, N= VMeQueuePair *q) smp_mb_release(); *q->cq.doorbell =3D cpu_to_le32(q->cq.head); if (!qemu_co_queue_empty(&q->free_req_queue)) { - aio_bh_schedule_oneshot(s->aio_context, nvme_free_req_queue_cb= , q); + replay_bh_schedule_oneshot_event(s->aio_context, + nvme_free_req_queue_cb, q); } } q->busy =3D false; @@ -934,7 +936,7 @@ static void nvme_rw_cb(void *opaque, int ret) /* The rw coroutine hasn't yielded, don't try to enter. */ return; } - aio_bh_schedule_oneshot(data->ctx, nvme_rw_cb_bh, data); + replay_bh_schedule_oneshot_event(data->ctx, nvme_rw_cb_bh, data); } =20 static coroutine_fn int nvme_co_prw_aligned(BlockDriverState *bs, diff --git a/block/rbd.c b/block/rbd.c index 59757b3120..a1ce5b9292 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -22,6 +22,7 @@ #include "block/qdict.h" #include "crypto/secret.h" #include "qemu/cutils.h" +#include "sysemu/replay.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" @@ -884,8 +885,8 @@ static void rbd_finish_aiocb(rbd_completion_t c, RADOSC= B *rcb) rcb->ret =3D rbd_aio_get_return_value(c); rbd_aio_release(c); =20 - aio_bh_schedule_oneshot(bdrv_get_aio_context(acb->common.bs), - rbd_finish_bh, rcb); + replay_bh_schedule_oneshot_event(bdrv_get_aio_context(acb->common.bs), + rbd_finish_bh, rcb); } =20 static int rbd_aio_discard_wrapper(rbd_image_t image, diff --git a/block/vxhs.c b/block/vxhs.c index 77fd5eb20d..d79fc97df6 100644 --- a/block/vxhs.c +++ b/block/vxhs.c @@ -22,6 +22,7 @@ #include "qapi/error.h" #include "qemu/uuid.h" #include "crypto/tlscredsx509.h" +#include "sysemu/replay.h" =20 #define VXHS_OPT_FILENAME "filename" #define VXHS_OPT_VDISK_ID "vdisk-id" @@ -105,8 +106,8 @@ static void vxhs_iio_callback(void *ctx, uint32_t opcod= e, uint32_t error) trace_vxhs_iio_callback(error); } =20 - aio_bh_schedule_oneshot(bdrv_get_aio_context(acb->common.bs), - vxhs_complete_aio_bh, acb); + replay_bh_schedule_oneshot_event(bdrv_get_aio_context(acb->common.= bs), + vxhs_complete_aio_bh, acb); break; =20 default: diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index b3f593f2f0..503bb6258d 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -142,6 +142,9 @@ void replay_enable_events(void); bool replay_events_enabled(void); /*! Adds bottom half event to the queue */ void replay_bh_schedule_event(QEMUBH *bh); +/* Adds oneshot bottom half event to the queue */ +void replay_bh_schedule_oneshot_event(AioContext *ctx, + QEMUBHFunc *cb, void *opaque); /*! Adds input event to the queue */ void replay_input_event(QemuConsole *src, InputEvent *evt); /*! Adds input sync event to the queue */ diff --git a/replay/replay-events.c b/replay/replay-events.c index 60d17f6edb..e5bf1bc2e6 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -36,6 +36,9 @@ static void replay_run_event(Event *event) case REPLAY_ASYNC_EVENT_BH: aio_bh_call(event->opaque); break; + case REPLAY_ASYNC_EVENT_BH_ONESHOT: + ((QEMUBHFunc *)event->opaque)(event->opaque2); + break; case REPLAY_ASYNC_EVENT_INPUT: qemu_input_event_send_impl(NULL, (InputEvent *)event->opaque); qapi_free_InputEvent((InputEvent *)event->opaque); @@ -131,6 +134,17 @@ void replay_bh_schedule_event(QEMUBH *bh) } } =20 +void replay_bh_schedule_oneshot_event(AioContext *ctx, + QEMUBHFunc *cb, void *opaque) +{ + if (events_enabled) { + uint64_t id =3D replay_get_current_step(); + replay_add_event(REPLAY_ASYNC_EVENT_BH_ONESHOT, cb, opaque, id); + } else { + aio_bh_schedule_oneshot(ctx, cb, opaque); + } +} + void replay_add_input_event(struct InputEvent *event) { replay_add_event(REPLAY_ASYNC_EVENT_INPUT, event, NULL, 0); @@ -161,6 +175,7 @@ static void replay_save_event(Event *event, int checkpo= int) /* save event-specific data */ switch (event->event_kind) { case REPLAY_ASYNC_EVENT_BH: + case REPLAY_ASYNC_EVENT_BH_ONESHOT: replay_put_qword(event->id); break; case REPLAY_ASYNC_EVENT_INPUT: @@ -216,6 +231,7 @@ static Event *replay_read_event(int checkpoint) /* Events that has not to be in the queue */ switch (replay_state.read_event_kind) { case REPLAY_ASYNC_EVENT_BH: + case REPLAY_ASYNC_EVENT_BH_ONESHOT: if (replay_state.read_event_id =3D=3D -1) { replay_state.read_event_id =3D replay_get_qword(); } diff --git a/replay/replay-internal.h b/replay/replay-internal.h index af6f4d55d4..f3cdcfd93e 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -51,6 +51,7 @@ enum ReplayEvents { =20 enum ReplayAsyncEventKind { REPLAY_ASYNC_EVENT_BH, + REPLAY_ASYNC_EVENT_BH_ONESHOT, REPLAY_ASYNC_EVENT_INPUT, REPLAY_ASYNC_EVENT_INPUT_SYNC, REPLAY_ASYNC_EVENT_CHAR_READ, diff --git a/replay/replay.c b/replay/replay.c index aa534116b5..df019c51ad 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -22,7 +22,7 @@ =20 /* Current version of the replay mechanism. Increase it when file format changes. */ -#define REPLAY_VERSION 0xe02007 +#define REPLAY_VERSION 0xe02008 /* Size of replay log header */ #define HEADER_SIZE (sizeof(uint32_t) + sizeof(uint64_t)) =20 diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 9c7393b08c..4a50e95ec3 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -20,6 +20,7 @@ stub-obj-y +=3D monitor.o stub-obj-y +=3D notify-event.o stub-obj-y +=3D qtest.o stub-obj-y +=3D replay.o +stub-obj-y +=3D replay-user.o stub-obj-y +=3D runstate-check.o stub-obj-y +=3D set-fd-handler.o stub-obj-y +=3D sysbus.o diff --git a/stubs/replay-user.c b/stubs/replay-user.c new file mode 100644 index 0000000000..2ad9e27203 --- /dev/null +++ b/stubs/replay-user.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "sysemu/replay.h" +#include "sysemu/sysemu.h" + +void replay_bh_schedule_oneshot_event(AioContext *ctx, + QEMUBHFunc *cb, void *opaque) +{ + aio_bh_schedule_oneshot(ctx, cb, opaque); +} From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957936; cv=none; d=zoho.com; s=zohoarc; b=lRPKvjGlCGQlRbMg7xboaHLrqZlQX68lGTbwQGB4y4sTOQQfYUxtPkggR8Ze1VzBsgnhx+P2lKFUONjuSCiwjzbWrdFHJ3qCzln8TRHtKFUVu4DJPBKwcmdrBJH6YM9ExDz2X0ZDYhXnAY/z3bsPSQk0NdAdQqzLWqwjD+UWpTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957936; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8ihHEaEmEQs266HY8i9RIsFrv0NlHuRc3X6MKQwEvPs=; b=alVA+zv2fTg4OVQiE1OBsDKo/7R+gbdSjcf7bMSMYKCjyCDFfSVXa95u8jKWxDHiCDp/27sjNPXHTiFY7ZZjfrmPuHJ49FqAvC+Byc9j9kwSeZHkeyuQyWvBby7d8gcUBB1PQSBv5dCYquIJIkXXbnaJA1I7NPMzDlW80r+TGB0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957936703393.27070804030166; Wed, 24 Jul 2019 01:45:36 -0700 (PDT) Received: from localhost ([::1]:49786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCtz-00022A-70 for importer@patchew.org; Wed, 24 Jul 2019 04:45:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34204) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCse-00059P-Ec for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsZ-0002Cr-JZ for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:08 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsY-0002Bj-SK for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:07 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id BC71F54006A; Wed, 24 Jul 2019 11:44:04 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:44:04 +0300 Message-ID: <156395784459.510.4803952583406884224.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 09/14] replay: document development rules X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch introduces docs/devel/replay.txt which describes the rules that should be followed to make virtual devices usable in record/replay mod= e. Signed-off-by: Pavel Dovgalyuk -- v9: fixed external virtual clock description (reported by Artem Pisarenko) --- docs/devel/replay.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/devel/replay.txt diff --git a/docs/devel/replay.txt b/docs/devel/replay.txt new file mode 100644 index 0000000000..e641c35add --- /dev/null +++ b/docs/devel/replay.txt @@ -0,0 +1,46 @@ +Record/replay mechanism, that could be enabled through icount mode, expects +the virtual devices to satisfy the following requirements. + +The main idea behind this document is that everything that affects +the guest state during execution in icount mode should be deterministic. + +Timers +=3D=3D=3D=3D=3D=3D + +All virtual devices should use virtual clock for timers that change the gu= est +state. Virtual clock is deterministic, therefore such timers are determini= stic +too. + +Virtual devices can also use realtime clock for the events that do not cha= nge +the guest state directly. When the clock ticking should depend on VM execu= tion +speed, use virtual clock with EXTERNAL attribute. It is not deterministic, +but its speed depends on the guest execution. This clock is used by +the virtual devices (e.g., slirp routing device) that lie outside the +replayed guest. + +Bottom halves +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Bottom half callbacks, that affect the guest state, should be invoked thro= ugh +replay_bh_schedule_event or replay_bh_schedule_oneshot_event functions. +Their invocations are saved in record mode and synchronized with the exist= ing +log in replay mode. + +Saving/restoring the VM state +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D + +All fields in the device state structure (including virtual timers) +should be restored by loadvm to the same values they had before savevm. + +Avoid accessing other devices' state, because the order of saving/restoring +is not defined. It means that you should not call functions like +'update_irq' in post_load callback. Save everything explicitly to avoid +the dependencies that may make restoring the VM state non-deterministic. + +Stopping the VM +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Stopping the guest should not interfere with its state (with the exception +of the network connections, that could be broken by the remote timeouts). +VM can be stopped at any moment of replay by the user. Restarting the VM +after that stop should not break the replay by the unneeded guest state ch= ange. From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957979; cv=none; d=zoho.com; s=zohoarc; b=UUVBMwWomD2pZfBJjkejn8Q5w3ap2wwNgV2rhTzGNiOOjZVvF7FRTzwZly8bZEukYmzIKXgHIGfCQ8c12BfXc2VfJ/ng8C5Bu1u79wRqeYGNqGR1ArkF4wOxcOSrRDsj1VMjp4c6dLRp8PbwTIiTy1rg0txRuY2OScx2ZgWAK0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957979; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2U01om39kz8unaB2IC7/JNS+frXZcii3VvEloLjghQM=; b=Nux4WZ5gdLFD3VZ90TW46rvF4CZ7Rz73mcrhVmzmfrmOW4qxKr+83w9YTz2f9oU8iAjCcu9T26rKrS5UnsVZSwV5ju1iAG3TVPmXZYPoZLO8ZWLJjI9Ws+vXBt+Vr+kmuNB1owDmwptXn7hiM5xHyJTPxObkLfJyA2k6WTStbAc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957979812229.24120832795245; Wed, 24 Jul 2019 01:46:19 -0700 (PDT) Received: from localhost ([::1]:49812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCug-0004sp-Ph for importer@patchew.org; Wed, 24 Jul 2019 04:46:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34261) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsg-0005Jm-Nl for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCse-0002KB-SR for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:14 -0400 Received: from mail.ispras.ru ([83.149.199.45]:58982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCse-0002HO-Fu for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:12 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 5B63854006A; Wed, 24 Jul 2019 11:44:10 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:44:10 +0300 Message-ID: <156395785017.510.9244716077158313815.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 10/14] util/qemu-timer: refactor deadline calculation for external timers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk icount-based record/replay uses qemu_clock_deadline_ns_all to measure the period until vCPU may be interrupted. This function takes in account the virtual timers, because they belong to the virtual devices that may generate interrupt request or affect the virtual machine state. However, there are a subset of virtual timers, that are marked with 'external' flag. These do not change the virtual machine state and only based on virtual clock. Calculating the deadling using the external timers breaks the determinism, because they do not belong to the replayed part of the virtual machine. This patch fixes the deadline calculation for this case. Signed-off-by: Pavel Dovgalyuk -- v15 changes: - fixed misprint in the test --- cpus.c | 9 ++++----- include/qemu/timer.h | 7 +++---- qtest.c | 2 +- tests/ptimer-test-stubs.c | 4 ++-- tests/ptimer-test.c | 4 ++-- util/qemu-timer.c | 41 +++++++++++++++++++++++++++++++++-------- 6 files changed, 45 insertions(+), 22 deletions(-) diff --git a/cpus.c b/cpus.c index a71081b709..3bce11df8c 100644 --- a/cpus.c +++ b/cpus.c @@ -553,7 +553,7 @@ void qtest_clock_warp(int64_t dest) assert(qtest_enabled()); aio_context =3D qemu_get_aio_context(); while (clock < dest) { - int64_t deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL= ); + int64_t deadline =3D virtual_clock_deadline_ns(); int64_t warp =3D qemu_soonest_timeout(dest - clock, deadline); =20 seqlock_write_lock(&timers_state.vm_clock_seqlock, @@ -613,7 +613,7 @@ void qemu_start_warp_timer(void) =20 /* We want to use the earliest deadline from ALL vm_clocks */ clock =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT); - deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); + deadline =3D virtual_clock_deadline_ns(); if (deadline < 0) { static bool notified; if (!icount_sleep && !notified) { @@ -1348,7 +1348,7 @@ static int64_t tcg_get_icount_limit(void) int64_t deadline; =20 if (replay_mode !=3D REPLAY_MODE_PLAY) { - deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); + deadline =3D virtual_clock_deadline_ns(); =20 /* Maintain prior (possibly buggy) behaviour where if no deadline * was set (as there is no QEMU_CLOCK_VIRTUAL timer) or it is more= than @@ -1369,8 +1369,7 @@ static void handle_icount_deadline(void) { assert(qemu_in_vcpu_thread()); if (use_icount) { - int64_t deadline =3D - qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); + int64_t deadline =3D virtual_clock_deadline_ns(); =20 if (deadline =3D=3D 0) { /* Wake up other AioContexts. */ diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 5d978e1634..9df45fbaeb 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -175,16 +175,15 @@ bool qemu_clock_expired(QEMUClockType type); bool qemu_clock_use_for_deadline(QEMUClockType type); =20 /** - * qemu_clock_deadline_ns_all: - * @type: the clock type + * virtual_clock_deadline_ns: * * Calculate the deadline across all timer lists associated - * with a clock (as opposed to just the default one) + * with virtual clock (excluding external timers) * in nanoseconds, or -1 if no timer is set to expire. * * Returns: time until expiry in nanoseconds or -1 */ -int64_t qemu_clock_deadline_ns_all(QEMUClockType type); +int64_t virtual_clock_deadline_ns(void); =20 /** * qemu_clock_get_main_loop_timerlist: diff --git a/qtest.c b/qtest.c index 15e27e911f..825bf558d1 100644 --- a/qtest.c +++ b/qtest.c @@ -655,7 +655,7 @@ static void qtest_process_command(CharBackend *chr, gch= ar **words) int ret =3D qemu_strtoi64(words[1], NULL, 0, &ns); g_assert(ret =3D=3D 0); } else { - ns =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); + ns =3D virtual_clock_deadline_ns(); } qtest_clock_warp(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns); qtest_send_prefix(chr); diff --git a/tests/ptimer-test-stubs.c b/tests/ptimer-test-stubs.c index 54b3fd26f6..49acfed76f 100644 --- a/tests/ptimer-test-stubs.c +++ b/tests/ptimer-test-stubs.c @@ -88,9 +88,9 @@ int64_t qemu_clock_get_ns(QEMUClockType type) return ptimer_test_time_ns; } =20 -int64_t qemu_clock_deadline_ns_all(QEMUClockType type) +int64_t virtual_clock_deadline_ns(void) { - QEMUTimerList *timer_list =3D main_loop_tlg.tl[type]; + QEMUTimerList *timer_list =3D main_loop_tlg.tl[QEMU_CLOCK_VIRTUAL]; QEMUTimer *t =3D timer_list->active_timers.next; int64_t deadline =3D -1; =20 diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c index b30aad0737..338a4e0c10 100644 --- a/tests/ptimer-test.c +++ b/tests/ptimer-test.c @@ -50,13 +50,13 @@ static void ptimer_test_set_qemu_time_ns(int64_t ns) =20 static void qemu_clock_step(uint64_t ns) { - int64_t deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); + int64_t deadline =3D virtual_clock_deadline_ns(); int64_t advanced_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns; =20 while (deadline !=3D -1 && deadline <=3D advanced_time) { ptimer_test_set_qemu_time_ns(deadline); ptimer_test_expire_qemu_timers(deadline, QEMU_CLOCK_VIRTUAL); - deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); + deadline =3D virtual_clock_deadline_ns(); } =20 ptimer_test_set_qemu_time_ns(advanced_time); diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 1cc1b2f2c3..88fbf04469 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -236,6 +236,7 @@ int64_t timerlist_deadline_ns(QEMUTimerList *timer_list) qemu_mutex_unlock(&timer_list->active_timers_lock); return -1; } + expire_time =3D timer_list->active_timers->expire_time; qemu_mutex_unlock(&timer_list->active_timers_lock); =20 @@ -248,19 +249,43 @@ int64_t timerlist_deadline_ns(QEMUTimerList *timer_li= st) return delta; } =20 -/* Calculate the soonest deadline across all timerlists attached - * to the clock. This is used for the icount timeout so we - * ignore whether or not the clock should be used in deadline - * calculations. +/* + * Calculate the soonest deadline across all timerlists attached + * to the virtual clock (excluding the external timers that do not affect + * the replayed guest state. */ -int64_t qemu_clock_deadline_ns_all(QEMUClockType type) +int64_t virtual_clock_deadline_ns(void) { int64_t deadline =3D -1; + int64_t delta; + int64_t expire_time; + QEMUTimer *ts; QEMUTimerList *timer_list; - QEMUClock *clock =3D qemu_clock_ptr(type); + QEMUClock *clock =3D qemu_clock_ptr(QEMU_CLOCK_VIRTUAL); + + if (!clock->enabled) { + return -1; + } + QLIST_FOREACH(timer_list, &clock->timerlists, list) { - deadline =3D qemu_soonest_timeout(deadline, - timerlist_deadline_ns(timer_list)); + qemu_mutex_lock(&timer_list->active_timers_lock); + ts =3D timer_list->active_timers; + /* Skip all external timers */ + while (ts && (ts->attributes & QEMU_TIMER_ATTR_EXTERNAL)) { + ts =3D ts->next; + } + if (!ts) { + qemu_mutex_unlock(&timer_list->active_timers_lock); + continue; + } + expire_time =3D ts->expire_time; + qemu_mutex_unlock(&timer_list->active_timers_lock); + + delta =3D expire_time - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + if (delta <=3D 0) { + delta =3D 0; + } + deadline =3D qemu_soonest_timeout(deadline, delta); } return deadline; } From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957892; cv=none; d=zoho.com; s=zohoarc; b=bIIQ41RR45GRSrVMvUqGh1vggjEl/T5Lna9Jy+NHvVszDSLjhg7TYmxzCNNZaU5k6pCZE468ifowVpMKeifmLXj7Esm8aaNwqUvaEn0cLPQ/cts6vCyT/3PKXq/NwqWagOltQmfimW/pVVHR6vU4iWNovUqnPNV0RFwCpDPrZTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957892; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Pwi6r8Ebzqek45T6HtAv4d8DogxXhYCHqL3b07ZJV4M=; b=HhWjK7W7D+jYc4MkoQR6+HZzh/coSQwcN1mel9zkl9Yl4QLPgFQhCH2FHE9Mq65+Pzd04jhpA4eJ6AbCGLMiivNfBM47Bo6A53OumMVjAXcytINzTeDN7uxPatV2McQX/7mO/o0J1MnBEf1scG1q1bSOTtAI27b7yGctqk/32WY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957892751968.0875325001454; Wed, 24 Jul 2019 01:44:52 -0700 (PDT) Received: from localhost ([::1]:49758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCtH-0007KV-7U for importer@patchew.org; Wed, 24 Jul 2019 04:44:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34300) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsk-0005ZD-2L for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsj-0002QA-2T for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:17 -0400 Received: from mail.ispras.ru ([83.149.199.45]:59018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsi-0002OJ-QA for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:17 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id EB50D54006A; Wed, 24 Jul 2019 11:44:15 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:44:15 +0300 Message-ID: <156395785575.510.6170762426726740637.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 11/14] replay: fix replay shutdown X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch fixes shutdown of the replay process, which is terminated with the assert when shutdown event is read from the log. replay_finish_event reads new data_kind and therefore the value of data_kind should be preserved to be valid at qemu_system_shutdown_request call. Signed-off-by: Pavel Dovgalyuk --- replay/replay.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/replay/replay.c b/replay/replay.c index df019c51ad..73c5d4e207 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -45,14 +45,14 @@ bool replay_next_event_is(int event) } =20 while (true) { - if (event =3D=3D replay_state.data_kind) { + unsigned int data_kind =3D replay_state.data_kind; + if (event =3D=3D data_kind) { res =3D true; } - switch (replay_state.data_kind) { + switch (data_kind) { case EVENT_SHUTDOWN ... EVENT_SHUTDOWN_LAST: replay_finish_event(); - qemu_system_shutdown_request(replay_state.data_kind - - EVENT_SHUTDOWN); + qemu_system_shutdown_request(data_kind - EVENT_SHUTDOWN); break; default: /* clock, time_t, checkpoint and other events */ From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957994; cv=none; d=zoho.com; s=zohoarc; b=GU4sD8sD/ZsLHkfJgX9z52chY4yOT0QQC2avNwkTGKcdrtYKGKo6rIJq0nnLA5mnU3ybcDKGMS7imcN0ymiclpeMs9KsSvpW6C+1EpB86Ea9mt7VRaj/lD7ihUyxyNWr/zN0EdDveEadg7tNSxe4fRMHfALZESKjT/kNviAVbCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957994; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sfqjak1f3Z5qZI8/97nmf1t3HGsdYTPg4bICM4QTWx8=; b=aVHLeFyosIc6ZBlhyZ5SSpWu3utD5eScd27g6wcLl+cpsV4nVjb+TjRQm2KtrN2YNgYRsWSe6mGJ42nn+LiA+PIARwTJAXtYTOUqKtWwGi7KIBZ5BHJFw8CVCknLualFlj+RW1a2EkO/BYvrHawCdipmI+jQICU+O7tPlPZVM4c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957994256242.24172182643474; Wed, 24 Jul 2019 01:46:34 -0700 (PDT) Received: from localhost ([::1]:49818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCuv-0005nZ-9a for importer@patchew.org; Wed, 24 Jul 2019 04:46:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34359) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsp-0005xj-Ot for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCso-0002Xz-Ls for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:23 -0400 Received: from mail.ispras.ru ([83.149.199.45]:59052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCso-0002Xh-Ef for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:22 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 90F5054006A; Wed, 24 Jul 2019 11:44:21 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:44:21 +0300 Message-ID: <156395786137.510.11135678145835158746.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 12/14] replay: refine replay-time module X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch removes refactoring artifacts from the replay/replay-time.c Signed-off-by: Pavel Dovgalyuk --- replay/replay-time.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/replay/replay-time.c b/replay/replay-time.c index 5154cb0ce9..49c9e5d8b2 100644 --- a/replay/replay-time.c +++ b/replay/replay-time.c @@ -14,18 +14,19 @@ #include "replay-internal.h" #include "qemu/error-report.h" =20 -int64_t replay_save_clock(ReplayClockKind kind, int64_t clock, int64_t raw= _icount) +int64_t replay_save_clock(ReplayClockKind kind, int64_t clock, + int64_t raw_icount) { - if (replay_file) { - g_assert(replay_mutex_locked()); + g_assert(replay_file); + g_assert(replay_mutex_locked()); =20 - /* Due to the caller's locking requirements we get the icount from= it - * instead of using replay_save_instructions(). - */ - replay_advance_current_step(raw_icount); - replay_put_event(EVENT_CLOCK + kind); - replay_put_qword(clock); - } + /* + * Due to the caller's locking requirements we get the icount from it + * instead of using replay_save_instructions(). + */ + replay_advance_current_step(raw_icount); + replay_put_event(EVENT_CLOCK + kind); + replay_put_qword(clock); =20 return clock; } @@ -47,20 +48,15 @@ void replay_read_next_clock(ReplayClockKind kind) /*! Reads next clock event from the input. */ int64_t replay_read_clock(ReplayClockKind kind) { + int64_t ret; g_assert(replay_file && replay_mutex_locked()); =20 replay_account_executed_instructions(); =20 - if (replay_file) { - int64_t ret; - if (replay_next_event_is(EVENT_CLOCK + kind)) { - replay_read_next_clock(kind); - } - ret =3D replay_state.cached_clock[kind]; - - return ret; + if (replay_next_event_is(EVENT_CLOCK + kind)) { + replay_read_next_clock(kind); } + ret =3D replay_state.cached_clock[kind]; =20 - error_report("REPLAY INTERNAL ERROR %d", __LINE__); - exit(1); + return ret; } From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957911; cv=none; d=zoho.com; s=zohoarc; b=XNjF6bpR4F9sFxiF32SAWbWsk4gZoTgsHBk71Q+ouqXyu4CTmRNn8dJS58MtGZFeznVt2DNp/BicYtpWF0oMczH4eVkt4ZWNoQTC8jFA/E66APLu4QgWnR9r5Rg1SRYSlOAgfWur5wmxwAxw9A8mBAgDB/9DDqAgNJ4GQj3hjuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957911; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Mgi/5UNE+eRHpGWwQEiI1T9f+4HDw8WY3Y+35VaZEAw=; b=hiktbhsMZUTgtiUOBGAHKNvMoqDQT1bGjBPmYLcwlKbW5e1aYKlt77IBYeSGLBZi4tydsx4tVFodY8QrIq69zyekIEhIn6/2Tun4HiQJ5MpKYPMaEYWZ/VlW+Re0TBbZr4xAn0ZLaDvAxKC2UbU1lqP7tIaYjNed8kNjlBUNvUI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957911875437.2390381244902; Wed, 24 Jul 2019 01:45:11 -0700 (PDT) Received: from localhost ([::1]:49766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCta-0000Co-HU for importer@patchew.org; Wed, 24 Jul 2019 04:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34406) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCsy-0006di-RL for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCsw-0002dU-TR for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:32 -0400 Received: from mail.ispras.ru ([83.149.199.45]:59078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCsw-0002c0-IG for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:30 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 30E8754006A; Wed, 24 Jul 2019 11:44:27 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:44:27 +0300 Message-ID: <156395786700.510.11133540400113889902.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 13/14] replay: rename step-related variables and functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk This patch renames replay_get_current_step() and related variables to make these names consistent with existing 'icount' command line option and future record/replay hmp/qmp commands. Signed-off-by: Pavel Dovgalyuk --- include/sysemu/replay.h | 2 +- replay/replay-events.c | 4 ++-- replay/replay-internal.c | 10 +++++----- replay/replay-internal.h | 10 +++++----- replay/replay-snapshot.c | 6 +++--- replay/replay-time.c | 2 +- replay/replay.c | 22 +++++++++++----------- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 503bb6258d..6ed4322447 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -77,7 +77,7 @@ const char *replay_get_filename(void); /* Processing the instructions */ =20 /*! Returns number of executed instructions. */ -uint64_t replay_get_current_step(void); +uint64_t replay_get_current_icount(void); /*! Returns number of instructions to execute in replay mode. */ int replay_get_instructions(void); /*! Updates instructions counter in replay mode. */ diff --git a/replay/replay-events.c b/replay/replay-events.c index e5bf1bc2e6..302b84043a 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -127,7 +127,7 @@ void replay_add_event(ReplayAsyncEventKind event_kind, void replay_bh_schedule_event(QEMUBH *bh) { if (events_enabled) { - uint64_t id =3D replay_get_current_step(); + uint64_t id =3D replay_get_current_icount(); replay_add_event(REPLAY_ASYNC_EVENT_BH, bh, NULL, id); } else { qemu_bh_schedule(bh); @@ -138,7 +138,7 @@ void replay_bh_schedule_oneshot_event(AioContext *ctx, QEMUBHFunc *cb, void *opaque) { if (events_enabled) { - uint64_t id =3D replay_get_current_step(); + uint64_t id =3D replay_get_current_icount(); replay_add_event(REPLAY_ASYNC_EVENT_BH_ONESHOT, cb, opaque, id); } else { aio_bh_schedule_oneshot(ctx, cb, opaque); diff --git a/replay/replay-internal.c b/replay/replay-internal.c index 979f3a0b39..ac6c9017fc 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -172,7 +172,7 @@ void replay_fetch_data_kind(void) if (!replay_state.has_unread_data) { replay_state.data_kind =3D replay_get_byte(); if (replay_state.data_kind =3D=3D EVENT_INSTRUCTION) { - replay_state.instructions_count =3D replay_get_dword(); + replay_state.instruction_count =3D replay_get_dword(); } replay_check_error(); replay_state.has_unread_data =3D 1; @@ -226,9 +226,9 @@ void replay_mutex_unlock(void) } } =20 -void replay_advance_current_step(uint64_t current_step) +void replay_advance_current_icount(uint64_t current_icount) { - int diff =3D (int)(current_step - replay_state.current_step); + int diff =3D (int)(current_icount - replay_state.current_icount); =20 /* Time can only go forward */ assert(diff >=3D 0); @@ -236,7 +236,7 @@ void replay_advance_current_step(uint64_t current_step) if (diff > 0) { replay_put_event(EVENT_INSTRUCTION); replay_put_dword(diff); - replay_state.current_step +=3D diff; + replay_state.current_icount +=3D diff; } } =20 @@ -245,6 +245,6 @@ void replay_save_instructions(void) { if (replay_file && replay_mode =3D=3D REPLAY_MODE_RECORD) { g_assert(replay_mutex_locked()); - replay_advance_current_step(replay_get_current_step()); + replay_advance_current_icount(replay_get_current_icount()); } } diff --git a/replay/replay-internal.h b/replay/replay-internal.h index f3cdcfd93e..55fca1ac6b 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -65,10 +65,10 @@ typedef enum ReplayAsyncEventKind ReplayAsyncEventKind; typedef struct ReplayState { /*! Cached clock values. */ int64_t cached_clock[REPLAY_CLOCK_COUNT]; - /*! Current step - number of processed instructions and timer events. = */ - uint64_t current_step; + /*! Current icount - number of processed instructions. */ + uint64_t current_icount; /*! Number of instructions to be executed before other events happen. = */ - int instructions_count; + int instruction_count; /*! Type of the currently executed event. */ unsigned int data_kind; /*! Flag which indicates that event is not processed yet. */ @@ -123,8 +123,8 @@ void replay_finish_event(void); data_kind variable. */ void replay_fetch_data_kind(void); =20 -/*! Advance replay_state.current_step to the specified value. */ -void replay_advance_current_step(uint64_t current_step); +/*! Advance replay_state.current_icount to the specified value. */ +void replay_advance_current_icount(uint64_t current_icount); /*! Saves queued events (like instructions and sound). */ void replay_save_instructions(void); =20 diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index 756f48bc02..97d026af30 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -41,7 +41,7 @@ static int replay_post_load(void *opaque, int version_id) } 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->instruction_count =3D 0; state->block_request_id =3D 0; } =20 @@ -56,8 +56,8 @@ static const VMStateDescription vmstate_replay =3D { .post_load =3D replay_post_load, .fields =3D (VMStateField[]) { VMSTATE_INT64_ARRAY(cached_clock, ReplayState, REPLAY_CLOCK_COUNT), - VMSTATE_UINT64(current_step, ReplayState), - VMSTATE_INT32(instructions_count, ReplayState), + VMSTATE_UINT64(current_icount, ReplayState), + VMSTATE_INT32(instruction_count, ReplayState), VMSTATE_UINT32(data_kind, ReplayState), VMSTATE_UINT32(has_unread_data, ReplayState), VMSTATE_UINT64(file_offset, ReplayState), diff --git a/replay/replay-time.c b/replay/replay-time.c index 49c9e5d8b2..43357c9f24 100644 --- a/replay/replay-time.c +++ b/replay/replay-time.c @@ -24,7 +24,7 @@ int64_t replay_save_clock(ReplayClockKind kind, int64_t c= lock, * Due to the caller's locking requirements we get the icount from it * instead of using replay_save_instructions(). */ - replay_advance_current_step(raw_icount); + replay_advance_current_icount(raw_icount); replay_put_event(EVENT_CLOCK + kind); replay_put_qword(clock); =20 diff --git a/replay/replay.c b/replay/replay.c index 73c5d4e207..14ee2c4144 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -39,7 +39,7 @@ bool replay_next_event_is(int event) bool res =3D false; =20 /* nothing to skip - not all instructions used */ - if (replay_state.instructions_count !=3D 0) { + if (replay_state.instruction_count !=3D 0) { assert(replay_state.data_kind =3D=3D EVENT_INSTRUCTION); return event =3D=3D EVENT_INSTRUCTION; } @@ -62,7 +62,7 @@ bool replay_next_event_is(int event) return res; } =20 -uint64_t replay_get_current_step(void) +uint64_t replay_get_current_icount(void) { return cpu_get_icount_raw(); } @@ -72,7 +72,7 @@ int replay_get_instructions(void) int res =3D 0; replay_mutex_lock(); if (replay_next_event_is(EVENT_INSTRUCTION)) { - res =3D replay_state.instructions_count; + res =3D replay_state.instruction_count; } replay_mutex_unlock(); return res; @@ -82,16 +82,16 @@ void replay_account_executed_instructions(void) { if (replay_mode =3D=3D REPLAY_MODE_PLAY) { g_assert(replay_mutex_locked()); - if (replay_state.instructions_count > 0) { - int count =3D (int)(replay_get_current_step() - - replay_state.current_step); + if (replay_state.instruction_count > 0) { + int count =3D (int)(replay_get_current_icount() + - replay_state.current_icount); =20 /* Time can only go forward */ assert(count >=3D 0); =20 - replay_state.instructions_count -=3D count; - replay_state.current_step +=3D count; - if (replay_state.instructions_count =3D=3D 0) { + replay_state.instruction_count -=3D count; + replay_state.current_icount +=3D count; + if (replay_state.instruction_count =3D=3D 0) { assert(replay_state.data_kind =3D=3D EVENT_INSTRUCTION); replay_finish_event(); /* Wake up iothread. This is required because @@ -273,8 +273,8 @@ static void replay_enable(const char *fname, int mode) replay_mutex_init(); =20 replay_state.data_kind =3D -1; - replay_state.instructions_count =3D 0; - replay_state.current_step =3D 0; + replay_state.instruction_count =3D 0; + replay_state.current_icount =3D 0; replay_state.has_unread_data =3D 0; =20 /* skip file header for RECORD and check it for PLAY */ From nobody Sun May 19 17:22:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1563957968; cv=none; d=zoho.com; s=zohoarc; b=RUUjo3iOZy6TPCHqAV8IyiYhqfLWdkYqYsAOlt2h1BXCJYCyy3Vm5RdIE7Cv9Ax870f14kBQLYePZsCkclL/fiiYKecq3EmmFHWwqa+/C6r300k829FmPzd6HlOph5P+nN24ReXv29rLsZ3aVX/JBRikrGt5lPkNI6yBO/ED61o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563957968; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3wSyhn6VgLEmAKJlVmkleU3Y0V/E3+dt+xWDBrkBXNk=; b=X0lCfEr2gtxg8t6rgisP/9xGGt4PThnLsq4IG+Yqyj7HEdSmOwtd1DEPsCVKCq7QF3Pb6cHfbATOvRHghot4UG+xUgD1QbiWwVBhgR6BrokYOwqeOHNehN5XVGT7szHyFoYarWzmrqPw5r/d55D+T6vX6ZF0M9pt+rhZ++ln2E0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563957968275883.0541876531387; Wed, 24 Jul 2019 01:46:08 -0700 (PDT) Received: from localhost ([::1]:49800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCuU-0003vq-TC for importer@patchew.org; Wed, 24 Jul 2019 04:46:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34448) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqCt8-0007Io-0B for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqCt2-0002he-7I for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:39 -0400 Received: from mail.ispras.ru ([83.149.199.45]:59108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hqCt1-0002fd-UD for qemu-devel@nongnu.org; Wed, 24 Jul 2019 04:44:36 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id D804154006A; Wed, 24 Jul 2019 11:44:32 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2019 11:44:32 +0300 Message-ID: <156395787270.510.3319575187228105326.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> References: <156395778867.510.17588721322993616668.stgit@pasha-Precision-3630-Tower> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Subject: [Qemu-devel] [PATCH for-4.2 14/14] icount: clean up cpu_can_io before jumping to the next block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, pavel.dovgaluk@ispras.ru, pbonzini@redhat.com, quintela@redhat.com, ciro.santilli@gmail.com, jasowang@redhat.com, crosthwaite.peter@gmail.com, armbru@redhat.com, mreitz@redhat.com, alex.bennee@linaro.org, maria.klimushenkova@ispras.ru, mst@redhat.com, kraxel@redhat.com, boost.lists@gmail.com, thomas.dullien@googlemail.com, dovgaluk@ispras.ru, artem.k.pisarenko@gmail.com, dgilbert@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk Most of IO instructions can be executed only at the end of the block in icount mode. Therefore translator can set cpu_can_io flag when translating the last instruction. But when the blocks are chained, then this flag is not reset and may remain set at the beginning of the next block. This patch resets the flag before "chaining" the translation blocks. Signed-off-by: Pavel Dovgalyuk --- accel/tcg/tcg-runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c index 8a1e408e31..fe6b83d0fc 100644 --- a/accel/tcg/tcg-runtime.c +++ b/accel/tcg/tcg-runtime.c @@ -151,6 +151,8 @@ void *HELPER(lookup_tb_ptr)(CPUArchState *env) target_ulong cs_base, pc; uint32_t flags; =20 + /* We are going to jump to the next block. can_do_io should be reset */ + cpu->can_do_io =3D !use_icount; tb =3D tb_lookup__cpu_state(cpu, &pc, &cs_base, &flags, curr_cflags()); if (tb =3D=3D NULL) { return tcg_ctx->code_gen_epilogue;