[Qemu-devel] [PATCH v8 00/20] Fixing record/replay and adding reverse debugging

Pavel Dovgalyuk posted 20 patches 5 years, 4 months ago
Test checkpatch failed
Test asan passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181218112056.11727.96529.stgit@pasha-VirtualBox
There is a newer version of this series
accel/tcg/translator.c    |    1
block/blkreplay.c         |    8 +
block/block-backend.c     |    5 -
block/io.c                |   22 +++
block/qapi.c              |   18 ++-
block/qcow2-snapshot.c    |    9 +
block/qcow2.h             |    2
blockdev.c                |   10 +
cpus.c                    |   19 ++-
docs/devel/replay.txt     |   45 ++++++
docs/interop/qcow2.txt    |    4 +
docs/replay.txt           |   45 ++++++
exec.c                    |    6 +
gdbstub.c                 |   50 +++++++
hmp-commands-info.hx      |   14 ++
hmp-commands.hx           |   44 ++++++
hmp.h                     |    4 +
include/block/snapshot.h  |    1
include/sysemu/replay.h   |   20 +++
migration/savevm.c        |    9 +
qapi/block-core.json      |    7 +
qapi/block.json           |    3
qapi/misc.json            |   82 ++++++++++++
replay/Makefile.objs      |    3
replay/replay-debugging.c |  319 +++++++++++++++++++++++++++++++++++++++++++++
replay/replay-events.c    |   16 ++
replay/replay-internal.c  |    2
replay/replay-internal.h  |    7 +
replay/replay-time.c      |   32 ++---
replay/replay.c           |   26 ++++
stubs/Makefile.objs       |    1
stubs/replay-user.c       |    9 +
stubs/replay.c            |   10 +
vl.c                      |   21 ++-
34 files changed, 826 insertions(+), 48 deletions(-)
create mode 100644 docs/devel/replay.txt
create mode 100644 replay/replay-debugging.c
create mode 100644 stubs/replay-user.c
[Qemu-devel] [PATCH v8 00/20] Fixing record/replay and adding reverse debugging
Posted by Pavel Dovgalyuk 5 years, 4 months ago
GDB remote protocol supports reverse debugging of the targets.
It includes 'reverse step' and 'reverse continue' operations.
The first one finds the previous step of the execution,
and the second one is intended to stop at the last breakpoint that
would happen when the program is executed normally.

Reverse debugging is possible in the replay mode, when at least
one snapshot was created at the record or replay phase.
QEMU can use these snapshots for travelling back in time with GDB.

Running the execution in replay mode allows using GDB reverse debugging
commands:
 - reverse-stepi (or rsi): Steps one instruction to the past.
   QEMU loads on of the prior snapshots and proceeds to the desired
   instruction forward. When that step is reaches, execution stops.
 - reverse-continue (or rc): Runs execution "backwards".
   QEMU tries to find breakpoint or watchpoint by loaded prior snapshot
   and replaying the execution. Then QEMU loads snapshots again and
   replays to the latest breakpoint. When there are no breakpoints in
   the examined section of the execution, QEMU finds one more snapshot
   and tries again. After the first snapshot is processed, execution
   stops at this snapshot.

The set of patches include the following modifications:
 - gdbstub update for reverse debugging support
 - functions that automatically perform reverse step and reverse
   continue operations
 - hmp/qmp commands for manipulating the replay process
 - improvement of the snapshotting for saving the execution step
   in the snapshot parameters
 - other record/replay fixes

The patches are available in the repository:
https://github.com/ispras/qemu/tree/rr-181218

v8 changes:
 - rebased to the new master
 - added missing fix for prior rr patch
 - updated 'since' version number in json-related patches

v7 changes:
 - rebased to the new master with upstreamed patches from the series
 - several improvements in hmp/qmp commands handling (suggested by Markus Armbruster)
 - fixed record/replay with '-rtc base' option enabled
 - added document with virtual hardware requirements

v6 changes:
 - rebased to the new version of master
 - fixed build of linux-user configurations
 - added new clock for slirp and vnc timers

v5 changes:
 - multiple fixes of record/replay bugs appeared after QEMU core update
 - changed reverse debugging to 'since 3.1'

v4 changes:
 - changed 'since 2.13' to 'since 3.0' in json (as suggested by Eric Blake)

v3 changes:
 - Fixed PS/2 bug with save/load vm, which caused failures of the replay.
 - Rebased to the new code base.
 - Minor fixes.

v2 changes:
 - documented reverse debugging
 - fixed start vmstate loading in record mode
 - documented qcow2 changes (as suggested by Eric Blake)
 - made icount SnapshotInfo field optional (as suggested by Eric Blake)
 - renamed qmp commands (as suggested by Eric Blake)
 - minor changes

---

Pavel Dovgalyuk (19):
      block: implement bdrv_snapshot_goto for blkreplay
      replay: disable default snapshot for record/replay
      replay: update docs for record/replay with block devices
      replay: don't drain/flush bdrv queue while RR is working
      replay: finish record/replay before closing the disks
      qcow2: introduce icount field for snapshots
      migration: introduce icount field for snapshots
      replay: provide and accessor for rr filename
      replay: introduce info hmp/qmp command
      replay: introduce breakpoint at the specified step
      replay: implement replay-seek command to proceed to the desired step
      replay: refine replay-time module
      replay: flush rr queue before loading the vmstate
      gdbstub: add reverse step support in replay mode
      gdbstub: add reverse continue support in replay mode
      replay: describe reverse debugging in docs/replay.txt
      replay: add BH oneshot event for block layer
      replay: init rtc after enabling the replay
      replay: document development rules

pbonzini@redhat.com (1):
      replay: add missing fix for internal function


 accel/tcg/translator.c    |    1 
 block/blkreplay.c         |    8 +
 block/block-backend.c     |    5 -
 block/io.c                |   22 +++
 block/qapi.c              |   18 ++-
 block/qcow2-snapshot.c    |    9 +
 block/qcow2.h             |    2 
 blockdev.c                |   10 +
 cpus.c                    |   19 ++-
 docs/devel/replay.txt     |   45 ++++++
 docs/interop/qcow2.txt    |    4 +
 docs/replay.txt           |   45 ++++++
 exec.c                    |    6 +
 gdbstub.c                 |   50 +++++++
 hmp-commands-info.hx      |   14 ++
 hmp-commands.hx           |   44 ++++++
 hmp.h                     |    4 +
 include/block/snapshot.h  |    1 
 include/sysemu/replay.h   |   20 +++
 migration/savevm.c        |    9 +
 qapi/block-core.json      |    7 +
 qapi/block.json           |    3 
 qapi/misc.json            |   82 ++++++++++++
 replay/Makefile.objs      |    3 
 replay/replay-debugging.c |  319 +++++++++++++++++++++++++++++++++++++++++++++
 replay/replay-events.c    |   16 ++
 replay/replay-internal.c  |    2 
 replay/replay-internal.h  |    7 +
 replay/replay-time.c      |   32 ++---
 replay/replay.c           |   26 ++++
 stubs/Makefile.objs       |    1 
 stubs/replay-user.c       |    9 +
 stubs/replay.c            |   10 +
 vl.c                      |   21 ++-
 34 files changed, 826 insertions(+), 48 deletions(-)
 create mode 100644 docs/devel/replay.txt
 create mode 100644 replay/replay-debugging.c
 create mode 100644 stubs/replay-user.c

-- 
Pavel Dovgalyuk

Re: [Qemu-devel] [PATCH v8 00/20] Fixing record/replay and adding reverse debugging
Posted by no-reply@patchew.org 5 years, 4 months ago
Patchew URL: https://patchew.org/QEMU/20181218112056.11727.96529.stgit@pasha-VirtualBox/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20181218112056.11727.96529.stgit@pasha-VirtualBox
Type: series
Subject: [Qemu-devel] [PATCH v8 00/20] Fixing record/replay and adding reverse debugging

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
015b13e replay: document development rules
3c71cd8 replay: init rtc after enabling the replay
f14a566 replay: add BH oneshot event for block layer
b8ac538 replay: describe reverse debugging in docs/replay.txt
d4b2daf gdbstub: add reverse continue support in replay mode
66f30a1 gdbstub: add reverse step support in replay mode
999fda4 replay: flush rr queue before loading the vmstate
980a4b5 replay: refine replay-time module
bcd6666 replay: implement replay-seek command to proceed to the desired step
682d014 replay: introduce breakpoint at the specified step
8b30c17 replay: introduce info hmp/qmp command
8d0888e replay: provide and accessor for rr filename
6b36a8a migration: introduce icount field for snapshots
91f8963 qcow2: introduce icount field for snapshots
b293bcc replay: finish record/replay before closing the disks
956d817 replay: don't drain/flush bdrv queue while RR is working
ca51ab0 replay: update docs for record/replay with block devices
77124bb replay: disable default snapshot for record/replay
11d0373 block: implement bdrv_snapshot_goto for blkreplay
38d86bc replay: add missing fix for internal function

=== OUTPUT BEGIN ===
Checking PATCH 1/20: replay: add missing fix for internal function...
Checking PATCH 2/20: block: implement bdrv_snapshot_goto for blkreplay...
Checking PATCH 3/20: replay: disable default snapshot for record/replay...
Checking PATCH 4/20: replay: update docs for record/replay with block devices...
Checking PATCH 5/20: replay: don't drain/flush bdrv queue while RR is working...
WARNING: Block comments use a leading /* on a separate line
#33: FILE: block/io.c:542:
+    /* bdrv queue is managed by record/replay,

WARNING: Block comments use * on subsequent lines
#34: FILE: block/io.c:543:
+    /* bdrv queue is managed by record/replay,
+       waiting for finishing the I/O requests may

WARNING: Block comments use a trailing */ on a separate line
#35: FILE: block/io.c:544:
+       be infinite */

WARNING: Block comments use a leading /* on a separate line
#47: FILE: block/io.c:577:
+    /* bdrv queue is managed by record/replay,

WARNING: Block comments use * on subsequent lines
#48: FILE: block/io.c:578:
+    /* bdrv queue is managed by record/replay,
+       waiting for finishing the I/O requests may

WARNING: Block comments use a trailing */ on a separate line
#49: FILE: block/io.c:579:
+       be endless */

WARNING: Block comments use a leading /* on a separate line
#61: FILE: block/io.c:2015:
+    /* bdrv queue is managed by record/replay,

WARNING: Block comments use * on subsequent lines
#62: FILE: block/io.c:2016:
+    /* bdrv queue is managed by record/replay,
+       creating new flush request for stopping

WARNING: Block comments use a trailing */ on a separate line
#63: FILE: block/io.c:2017:
+       the VM may break the determinism */

total: 0 errors, 9 warnings, 60 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 6/20: replay: finish record/replay before closing the disks...
Checking PATCH 7/20: qcow2: introduce icount field for snapshots...
Checking PATCH 8/20: migration: introduce icount field for snapshots...
Checking PATCH 9/20: replay: provide and accessor for rr filename...
Checking PATCH 10/20: replay: introduce info hmp/qmp command...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#119: 
new file mode 100644

total: 0 errors, 1 warnings, 116 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 11/20: replay: introduce breakpoint at the specified step...
WARNING: line over 80 characters
#150: FILE: replay/replay-debugging.c:58:
+        replay_break_timer = timer_new_ns(QEMU_CLOCK_REALTIME, callback, opaque);

total: 0 errors, 1 warnings, 217 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 12/20: replay: implement replay-seek command to proceed to the desired step...
Checking PATCH 13/20: replay: refine replay-time module...
WARNING: line over 80 characters
#31: FILE: replay/replay-time.c:23:
+    /* Due to the caller's locking requirements we get the icount from it instead

WARNING: Block comments use a leading /* on a separate line
#31: FILE: replay/replay-time.c:23:
+    /* Due to the caller's locking requirements we get the icount from it instead

total: 0 errors, 2 warnings, 49 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 14/20: replay: flush rr queue before loading the vmstate...
WARNING: Block comments use a leading /* on a separate line
#36: FILE: migration/savevm.c:2704:
+    /* Flush the record/replay queue. Now the VM state is going

WARNING: Block comments use * on subsequent lines
#37: FILE: migration/savevm.c:2705:
+    /* Flush the record/replay queue. Now the VM state is going
+       to change. Therefore we don't need to preserve its consistency */

WARNING: Block comments use a trailing */ on a separate line
#37: FILE: migration/savevm.c:2705:
+       to change. Therefore we don't need to preserve its consistency */

total: 0 errors, 3 warnings, 26 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 15/20: gdbstub: add reverse step support in replay mode...
WARNING: Block comments use a leading /* on a separate line
#66: FILE: exec.c:2743:
+                /* Don't process the watchpoints when we are

WARNING: Block comments use * on subsequent lines
#67: FILE: exec.c:2744:
+                /* Don't process the watchpoints when we are
+                   in a reverse debugging operation. */

WARNING: Block comments use a trailing */ on a separate line
#67: FILE: exec.c:2744:
+                   in a reverse debugging operation. */

WARNING: Block comments use a leading /* on a separate line
#92: FILE: gdbstub.c:340:
+    /* In replay mode all events written into the log should be replayed.

WARNING: Block comments use a leading /* on a separate line
#171: FILE: include/sysemu/replay.h:76:
+/* Start making one step in backward direction.

WARNING: Block comments use * on subsequent lines
#172: FILE: include/sysemu/replay.h:77:
+/* Start making one step in backward direction.
+   Used by gdbstub for backwards debugging.

WARNING: Block comments use a trailing */ on a separate line
#173: FILE: include/sysemu/replay.h:78:
+   Returns true on success. */

WARNING: Block comments use a leading /* on a separate line
#175: FILE: include/sysemu/replay.h:80:
+/* Returns true if replay module is processing

WARNING: Block comments use * on subsequent lines
#176: FILE: include/sysemu/replay.h:81:
+/* Returns true if replay module is processing
+   reverse_continue or reverse_step request */

WARNING: Block comments use a trailing */ on a separate line
#176: FILE: include/sysemu/replay.h:81:
+   reverse_continue or reverse_step request */

total: 0 errors, 10 warnings, 181 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 16/20: gdbstub: add reverse continue support in replay mode...
WARNING: Block comments use a leading /* on a separate line
#27: FILE: cpus.c:1113:
+            /* Report about the breakpoint and

WARNING: Block comments use * on subsequent lines
#28: FILE: cpus.c:1114:
+            /* Report about the breakpoint and
+               make a single step to skip it */

WARNING: Block comments use a trailing */ on a separate line
#28: FILE: cpus.c:1114:
+               make a single step to skip it */

WARNING: Block comments use a leading /* on a separate line
#81: FILE: include/sysemu/replay.h:80:
+/* Start searching the last breakpoint/watchpoint.

WARNING: Block comments use * on subsequent lines
#82: FILE: include/sysemu/replay.h:81:
+/* Start searching the last breakpoint/watchpoint.
+   Used by gdbstub for backwards debugging.

WARNING: Block comments use a trailing */ on a separate line
#83: FILE: include/sysemu/replay.h:82:
+   Returns true if the process successfully started. */

WARNING: Block comments use a leading /* on a separate line
#129: FILE: replay/replay-debugging.c:272:
+    /* No breakpoints since the last snapshot.

WARNING: Block comments use * on subsequent lines
#130: FILE: replay/replay-debugging.c:273:
+    /* No breakpoints since the last snapshot.
+       Find previous snapshot and try again. */

WARNING: Block comments use a trailing */ on a separate line
#130: FILE: replay/replay-debugging.c:273:
+       Find previous snapshot and try again. */

total: 0 errors, 9 warnings, 139 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 17/20: replay: describe reverse debugging in docs/replay.txt...
Checking PATCH 18/20: replay: add BH oneshot event for block layer...
ERROR: "(foo*)" should be "(foo *)"
#66: FILE: replay/replay-events.c:41:
+        ((QEMUBHFunc*)event->opaque)(event->opaque2);

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#143: 
new file mode 100644

total: 1 errors, 1 warnings, 97 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 19/20: replay: init rtc after enabling the replay...
Checking PATCH 20/20: replay: document development rules...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#13: 
new file mode 100644

total: 0 errors, 1 warnings, 45 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20181218112056.11727.96529.stgit@pasha-VirtualBox/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com