qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
Cc: kwolf@redhat.com, wrampazz@redhat.com, ehabkost@redhat.com,
	mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com,
	stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com,
	mreitz@redhat.com, philmd@redhat.com, zhiwei_liu@c-sky.com,
	rth@twiddle.net
Subject: Re: [PATCH v6 03/14] qcow2: introduce icount field for snapshots
Date: Thu, 01 Oct 2020 13:53:39 +0100	[thread overview]
Message-ID: <87d022nm3w.fsf@linaro.org> (raw)
In-Reply-To: <160137728185.31007.9248844824207037822.stgit@pasha-ThinkPad-X280>


Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru> writes:

> From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
>
> This patch introduces the icount field for saving within the snapshot.
> It is required for navigation between the snapshots in record/replay mode.
>
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
> Acked-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/qcow2-snapshot.c |    7 +++++++
>  block/qcow2.h          |    3 +++
>  docs/interop/qcow2.txt |    5 +++++
>  3 files changed, 15 insertions(+)
>
> diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
> index 9b68690f56..d68b25e0c5 100644
> --- a/block/qcow2-snapshot.c
> +++ b/block/qcow2-snapshot.c
> @@ -164,6 +164,12 @@ static int qcow2_do_read_snapshots(BlockDriverState *bs, bool repair,
>              sn->disk_size = bs->total_sectors * BDRV_SECTOR_SIZE;
>          }
>  
> +        if (sn->extra_data_size >= endof(QCowSnapshotExtraData, icount)) {
> +            sn->icount = be64_to_cpu(extra.icount);
> +        } else {
> +            sn->icount = -1ULL;
> +        }
> +
>          if (sn->extra_data_size > sizeof(extra)) {
>              uint64_t extra_data_end;
>              size_t unknown_extra_data_size;
> @@ -333,6 +339,7 @@ int qcow2_write_snapshots(BlockDriverState *bs)
>          memset(&extra, 0, sizeof(extra));
>          extra.vm_state_size_large = cpu_to_be64(sn->vm_state_size);
>          extra.disk_size = cpu_to_be64(sn->disk_size);
> +        extra.icount = cpu_to_be64(sn->icount);
>  
>          id_str_size = strlen(sn->id_str);
>          name_size = strlen(sn->name);
> diff --git a/block/qcow2.h b/block/qcow2.h
> index b71e444fca..125ea9679b 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -206,6 +206,7 @@ typedef struct QEMU_PACKED QCowSnapshotHeader {
>  typedef struct QEMU_PACKED QCowSnapshotExtraData {
>      uint64_t vm_state_size_large;
>      uint64_t disk_size;
> +    uint64_t icount;
>  } QCowSnapshotExtraData;
>  
>  
> @@ -219,6 +220,8 @@ typedef struct QCowSnapshot {
>      uint32_t date_sec;
>      uint32_t date_nsec;
>      uint64_t vm_clock_nsec;
> +    /* icount value for the moment when snapshot was taken */
> +    uint64_t icount;
>      /* Size of all extra data, including QCowSnapshotExtraData if available */
>      uint32_t extra_data_size;
>      /* Data beyond QCowSnapshotExtraData, if any */
> diff --git a/docs/interop/qcow2.txt b/docs/interop/qcow2.txt
> index 7da0d81df8..0463f761ef 100644
> --- a/docs/interop/qcow2.txt
> +++ b/docs/interop/qcow2.txt
> @@ -707,6 +707,11 @@ Snapshot table entry:
>  
>                      Byte 48 - 55:   Virtual disk size of the snapshot in bytes
>  
> +                    Byte 56 - 63:   icount value which corresponds to
> +                                    the record/replay instruction count
> +                                    when the snapshot was taken. Set to -1
> +                                    if icount was disabled
> +
>                      Version 3 images must include extra data at least up to
>                      byte 55.
>  

Hmm is this why I'm seeing some of the iotests fail on the CI:

261      fail       [11:34:17] [11:34:44]                    output mismatch (see 261.out.bad)
--- /builds/stsquad/qemu/tests/qemu-iotests/261.out	2020-10-01 11:16:22.000000000 +0000
+++ /builds/stsquad/qemu/build/tests/qemu-iotests/261.out.bad	2020-10-01 11:34:44.000000000 +0000
@@ -29,9 +29,10 @@
   [0]
     ID: 1
     Name: sn0
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
   [1]
     ID: 2
     Name: sn1
@@ -42,9 +43,10 @@
   [2]
     ID: 3
     Name: sn2
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
 
 === Repair botched v3 ===
 
@@ -61,9 +63,10 @@
   [0]
     ID: 1
     Name: sn0
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
   [1]
     ID: 2
     Name: sn1
@@ -74,9 +77,10 @@
   [2]
     ID: 3
     Name: sn2
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
 
 === Add new snapshot ===
 
@@ -85,9 +89,10 @@
   [0]
     ID: 1
     Name: sn0
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
   [1]
     ID: 2
     Name: sn1
@@ -98,15 +103,17 @@
   [2]
     ID: 3
     Name: sn2
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
   [3]
     ID: 4
     Name: sn3
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: 
 
 === Remove different snapshots ===
 
@@ -123,9 +130,10 @@
   [1]
     ID: 3
     Name: sn2
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
 
 --- sn1 ---
 No errors were found on the image.
@@ -133,15 +141,17 @@
   [0]
     ID: 1
     Name: sn0
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
   [1]
     ID: 3
     Name: sn2
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
 
 --- sn2 ---
 No errors were found on the image.
@@ -149,9 +159,10 @@
   [0]
     ID: 1
     Name: sn0
-    Extra data size: 16
+    Extra data size: 24
     VM state size: 0
     Disk size: 67108864
+    Unknown extra data: ��������
   [1]
     ID: 2
     Name: sn1
@@ -210,7 +221,7 @@
 No errors were found on the image.
 
 507 snapshots should remain:
-  qemu-img info reports 507 snapshots
+  qemu-img info reports 0 snapshots
   Image header reports 507 snapshots
 
 === Snapshot table too big with one entry with too much extra data ===
@@ -341,6 +352,6 @@
 No errors were found on the image.
 
 65536 snapshots should remain:
-  qemu-img info reports 65536 snapshots
+  qemu-img info reports 0 snapshots
   Image header reports 65536 snapshots
 *** done


-- 
Alex Bennée


  reply	other threads:[~2020-10-01 12:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 11:01 [PATCH v6 00/14] Reverse debugging Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 01/14] replay: don't record interrupt poll Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 02/14] replay: provide an accessor for rr filename Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 03/14] qcow2: introduce icount field for snapshots Pavel Dovgalyuk
2020-10-01 12:53   ` Alex Bennée [this message]
2020-09-29 11:01 ` [PATCH v6 04/14] migration: " Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 05/14] qapi: introduce replay.json for record/replay-related stuff Pavel Dovgalyuk
2020-10-01 11:00   ` Alex Bennée
2020-09-29 11:01 ` [PATCH v6 06/14] replay: introduce info hmp/qmp command Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 07/14] replay: introduce breakpoint at the specified step Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 08/14] replay: implement replay-seek command Pavel Dovgalyuk
2020-09-29 11:01 ` [PATCH v6 09/14] replay: flush rr queue before loading the vmstate Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 10/14] gdbstub: add reverse step support in replay mode Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 11/14] gdbstub: add reverse continue " Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 12/14] replay: describe reverse debugging in docs/replay.txt Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 13/14] replay: create temporary snapshot at debugger connection Pavel Dovgalyuk
2020-09-29 11:02 ` [PATCH v6 14/14] tests/acceptance: add reverse debugging test Pavel Dovgalyuk
2020-09-29 22:15   ` Willian Rampazzo
2020-09-29 15:51 ` [PATCH v6 00/14] Reverse debugging no-reply
2020-10-02 15:39 ` Paolo Bonzini
2020-10-02 16:01   ` Pavel Dovgalyuk
2020-10-02 16:25   ` Pavel Dovgalyuk
2020-10-03 17:19   ` Pavel Dovgalyuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d022nm3w.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pavel.dovgalyuk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=wrampazz@redhat.com \
    --cc=zhiwei_liu@c-sky.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).