From nobody Fri May 17 17:36:58 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=1564381818; cv=none; d=zoho.com; s=zohoarc; b=JE786ZL69LKMmHD/HIecwMvvL2JxDEBGuhqpTK0dVPMGz133AzrmZ6RkPqKcKG1pqrHmgiBe3nqfpHixw3ZjPMEWp/WN0MNOBQSM/do4ANWti2dNpvAnLF2tlC5G2M805iSS6PV9JfbW3H9WD3Zj2fuDyU2PV8fZ7hYZy3umgRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564381818; 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=C88X3kbZ8ADcXsLfvlLigp9MJm3GIL/FEILtvcpcIWErUamW5GdivF5KQwfSzGFt1mh2iy5EetR57eq6JK2mDdWjyy9ci8dIS5lSOiIOQWiLmBCfT7W19SZ8sXB5IG9J4thg8ae9hNS+T8blXGDNPMh+JovzdyOXCAY992sbxN0= 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 1564381818945232.53204383932837; Sun, 28 Jul 2019 23:30:18 -0700 (PDT) Received: from localhost ([::1]:49798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAo-0002Vd-0t for importer@patchew.org; Mon, 29 Jul 2019 02:30:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53600) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzA5-0001GF-KV for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrzA4-0007AN-FQ for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:33 -0400 Received: from mail.ispras.ru ([83.149.199.45]:36656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hrzA4-00079g-86 for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:32 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 6854E54006A; Mon, 29 Jul 2019 09:29:31 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 09:29:31 +0300 Message-ID: <156438177124.22071.8809966409278401240.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156438176555.22071.10523120047318890136.stgit@pasha-Precision-3630-Tower> References: <156438176555.22071.10523120047318890136.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] [for-4.2 PATCH 1/6] 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 Fri May 17 17:36:58 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=1564381824; cv=none; d=zoho.com; s=zohoarc; b=SQU9+V7xVoBT1BFkSttqs/1OVTDr5POIdI0HzvRfnEk+aqY07AyK+a/NnuXXjzDRKhh+as5wgB03eULHbuJ3DpTOaCws/VEYNfBNjZIeyipBIlYmBQmYivSsUFrmJRO94/zDgQ6w/roJb9k3LRRLMTjtbQUG3/4iOSpJa7yzc4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564381824; 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=oDL5wVWHO7EonoqUgEfMHvff+0aD88bGSdtO3mUqfGbgyeE2IxgPJloKd3gAW3TozDjMTlHgKQeiqAQKDNRPTh0Zb0HVxxDfGfaKtIQ3VcjxFrT4Zq+KJsAZyWiHP0Kq1fX+Olnxz4rDO52Qg1dAxlUQhMG/sXUyE941xjgdyl0= 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 1564381824634552.8908650405111; Sun, 28 Jul 2019 23:30:24 -0700 (PDT) Received: from localhost ([::1]:49800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAt-0002jS-LB for importer@patchew.org; Mon, 29 Jul 2019 02:30:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53612) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAB-0001Of-3S for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrzAA-0007H4-54 for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:39 -0400 Received: from mail.ispras.ru ([83.149.199.45]:36670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hrzA9-0007GW-TM for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:38 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 0591054006A; Mon, 29 Jul 2019 09:29:37 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 09:29:36 +0300 Message-ID: <156438177681.22071.13848945113587170379.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156438176555.22071.10523120047318890136.stgit@pasha-Precision-3630-Tower> References: <156438176555.22071.10523120047318890136.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] [for-4.2 PATCH 2/6] 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 Fri May 17 17:36:58 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=1564381883; cv=none; d=zoho.com; s=zohoarc; b=YYiyFfrNULB/eMTOitJhEInozDv1eJ4QfoDh4h6Qa7yiC8IDrYVbhR8fyJ+zJCX3j86hzsSH3mvtdp6JNMhN0J9Q9rjxg4zWkC0ymXjhIoxtYo0KxmPsUcK0IOf6pw6YVt9DUcbcUSapg004yuJ99XuiD7BvltR0tRXSM4tC8kI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564381883; 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=WXLOv41zt5yLma4uZfAuYt9D7py0+F6MPMnmVGu8Ydm6ElKaq/XC2neO3IAT58jquKfCNXP03XwNyyo2ByAEeiWGbrPpiCH/pfRMIiOtE9so18PqUAtvClCBY/LB6QQM620KHpWiyu/3/fQ0F8+p+UFIgMCoX1NmV5zUzp1rJEE= 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 15643818831681019.2149258506469; Sun, 28 Jul 2019 23:31:23 -0700 (PDT) Received: from localhost ([::1]:49814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzBo-0004bt-41 for importer@patchew.org; Mon, 29 Jul 2019 02:31:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53632) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAG-0001dY-UV for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrzAF-0007Nv-Pj for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:44 -0400 Received: from mail.ispras.ru ([83.149.199.45]:36688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hrzAF-0007NE-IL for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:43 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id A3AE854006A; Mon, 29 Jul 2019 09:29:42 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 09:29:42 +0300 Message-ID: <156438178246.22071.15709962942179007484.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156438176555.22071.10523120047318890136.stgit@pasha-Precision-3630-Tower> References: <156438176555.22071.10523120047318890136.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] [for-4.2 PATCH 3/6] 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 Fri May 17 17:36:58 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=1564382081; cv=none; d=zoho.com; s=zohoarc; b=jjSt7gHzcjyhFUP8EuLo8qH+IIWWfalSSZKYysW8BYWLuqDSFlBoRNXTJrBKGPJRsLI2T6ghNgpjnRwnftAs+djisHvel7wdN7WY820BUuxWUznOa7ySAjy3rxtWpXlGe1DVFhSukJWiBG9RYNSLYbIcTQnMiVwgGLDzJhRmENU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564382081; 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=X4MsD5Azwyn3ZwYEIK7L7+uPuPbwe8LAt8fBlxIfMtA=; b=FGJEKBRjGHDD+5+dwyrkD4GsgDyiQFcuEYHVOKdXyt4qqDlBcsvf4cqwQBYdkKK+ArLdT2uIHJohXI0uUcVhT74GKIt9pGYfA6+9mTx/aIcVg5s+tiUh5BQj9mNoYBYq3GQ+SVZ0VsNsIJUSCS6kztmxp+BdD1ItF187BboutKs= 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 15643820815200.835020565203763; Sun, 28 Jul 2019 23:34:41 -0700 (PDT) Received: from localhost ([::1]:49838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzF2-0007U5-In for importer@patchew.org; Mon, 29 Jul 2019 02:34:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53651) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAM-0001tC-He for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrzAL-0007UC-Gz for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:50 -0400 Received: from mail.ispras.ru ([83.149.199.45]:36714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hrzAL-0007TQ-5b for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:49 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id 4F8E354006A; Mon, 29 Jul 2019 09:29:48 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 09:29:48 +0300 Message-ID: <156438178814.22071.2963664041481007694.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156438176555.22071.10523120047318890136.stgit@pasha-Precision-3630-Tower> References: <156438176555.22071.10523120047318890136.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] [for-4.2 PATCH 4/6] 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 a7120ffbd5..f6b7252fdb 100644 --- a/cpus.c +++ b/cpus.c @@ -1083,7 +1083,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; @@ -2169,7 +2168,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 Fri May 17 17:36:58 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=1564381910; cv=none; d=zoho.com; s=zohoarc; b=lYQ5DA5WNujdDuPfh4X3s2brRUuneh1dqULjpY2S24jO31w51NZ4JoxEdCLC627w09iJKLmOx1loKt4FKD4D4d+RlnQwYJreMfk7nlHeoKxTITAWNjQ/gQ+iGQ192Hsn2o4YNzvDhQEijHw44XBQOtiCeUytWb5sGAYvsaTarZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564381910; 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=Vqkm8vn8TEM79rH6E106syEw50Fqw8KtBnA/5LLPYBM=; b=TL6NOX59Gbq4rMQTLb38eNTjSoYqsah652yfssFWaLwUr415F5eqv0+p6PX18M+iGDbRS0e7m8UA6RIvWH9f4pDxMew9Sm1hj0+vJ51JGNipY73jN5meXenxUrUXxwdQTgHosm/Qv/BUtmVdPFJeWfFfjnmFb5118vvhrjVl2sY= 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 1564381910338987.5062376555364; Sun, 28 Jul 2019 23:31:50 -0700 (PDT) Received: from localhost ([::1]:49817 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzCH-0004mK-AP for importer@patchew.org; Mon, 29 Jul 2019 02:31:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53679) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAS-00027g-1w for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrzAR-0007as-3k for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:55 -0400 Received: from mail.ispras.ru ([83.149.199.45]:36736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hrzAQ-0007aC-Sr for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:29:55 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id E59AE54006A; Mon, 29 Jul 2019 09:29:53 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 09:29:53 +0300 Message-ID: <156438179371.22071.7134093736590754203.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156438176555.22071.10523120047318890136.stgit@pasha-Precision-3630-Tower> References: <156438176555.22071.10523120047318890136.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] [for-4.2 PATCH 5/6] 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 6a62ec3811..71c4e6b777 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 Fri May 17 17:36:58 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=1564382092; cv=none; d=zoho.com; s=zohoarc; b=jpa1nXryv+g1VAT1s5010B5Cb2Aop1DiBqGr0JPjHQEDhEQ1MLF+itlaN6iBXrpQFag3vQzfVxvpRUDxCpzRQjYnFVOnJ6Ag9dXKeYMYCkFTcpR3jx2RVpODUgbf43QJiEF0vAREcN7TSbPpQRzr27Q9AebrXgflMIPV90+vJoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564382092; 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=SB8+/QUYZfdwsUzUVT6l2kqrzpKzJv9Hl5z6k7sjGwc=; b=TSd9/QxWHr9nkVhSDxO/DBNDS4CPnLJSmV5w+nHfU140D5wJ2q2R6H95/V7AkxyAJT5jBMML6usBZBx7OwrU1rvrf9zb3xuXcqk/AnbFogAyKc3aY2k1U8FBZ/HY5Wbh7lCRrvEeQE1D7mLRZLRp91/jfFoEIJs2gweZ1K1vcjk= 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 1564382092530293.3283455260714; Sun, 28 Jul 2019 23:34:52 -0700 (PDT) Received: from localhost ([::1]:49840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzFD-0007qs-Hl for importer@patchew.org; Mon, 29 Jul 2019 02:34:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53692) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrzAY-0002PO-SF for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:30:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrzAX-0007i3-1P for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:30:02 -0400 Received: from mail.ispras.ru ([83.149.199.45]:36754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hrzAW-0007hF-Gr for qemu-devel@nongnu.org; Mon, 29 Jul 2019 02:30:00 -0400 Received: from [127.0.1.1] (unknown [85.142.117.226]) by mail.ispras.ru (Postfix) with ESMTPSA id A3D0F54006A; Mon, 29 Jul 2019 09:29:59 +0300 (MSK) From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Mon, 29 Jul 2019 09:29:59 +0300 Message-ID: <156438179945.22071.2373604847832316840.stgit@pasha-Precision-3630-Tower> In-Reply-To: <156438176555.22071.10523120047318890136.stgit@pasha-Precision-3630-Tower> References: <156438176555.22071.10523120047318890136.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] [for-4.2 PATCH 6/6] 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 --- 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 28ce19e919..1476ab533e 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -140,6 +140,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 008e80f636..302b84043a 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_icount(); + 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 afba9a3e0c..55fca1ac6b 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 71c4e6b777..242d36a858 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); +}