qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH v6 00/14] Reverse execution.
@ 2014-07-03 14:33 fred.konrad
  2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 01/14] icount: put icount variables into TimerState fred.konrad
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: fred.konrad @ 2014-07-03 14:33 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, quintela, mark.burton, dgilbert, Pavel.Dovgaluk,
	amit.shah, pbonzini, sebastian.tanase, vilanova, fred.konrad

From: KONRAD Frederic <fred.konrad@greensocs.com>

Hi everybody,

This is the sixth version of this RFC (see the changes below).

Those are the two first patch-set we have been worked on for reverse execution.

The first part is fully reviewed except the "icount: introduce icount timer"
patch maybe we can merge them?

The first series:
  icount: put icount variables into TimerState.
  migration: migrate icount fields.
  migration: make qemu_savevm_state public.
  icount: introduce icount timer.
  icount: check for icount clock deadline when cpu loop exits.
  icount: make icount extra computed on icount clock as well.
  timer: add cpu_icount_to_ns function.

are various preparation patches for reverse execution.

The last patches:
  trace-events: add reverse-execution events.
  introduce reverse execution mechanism.
  gdbstub: allow reverse execution in gdb stub.
  cpu-exec: trigger a debug request when rexec stops.
  rexec: synchronize icount on the next event.
  rexec: allow to enable reverse execution.

are reverse execution introduction.

They can be clone at: git://git.greensocs.com/qemu_cexe.git:cexe_2_3_v6

The third series will be sent as soon as possible and have some issues with
QEMU's thread as it use fork.

This implementation of reverse execution works with instruction counting:

A new clock is implemented which is icount clock. It grows each time an
instruction is executed and is totally independant of host clock.

Snapshots are taken regularly (based on icount clock) with help of migration
code and written on the disk.

When user wants to use reverse-stepi:
 * Last snapshot is reloaded.
 * A stop callback is created to be triggered at the previous instruction.

This stop callback generates a debug exception so QEMU stops in debug mode.

Command line:
 * rexec suboption is added to icount to enable reverse execution, it needs
   icount=N and doesn't support auto mode.

About non determinism in QEMU:
 * This implementation doesn't take IO in account so any IO will cause non
   determinism and break reverse execution.

 * The icount warp mechanism have been disabled when reverse execution is
   enabled so the time grow differently inside the VM.

Testing:
 * It has been tested on ARM without any IO such as network or asynchronous file
   access to keep the deterministic behaviour of icount.

Known issues:
 * On ARM stepi seems to do some additional steps which are added to icount
   counter so reverse-stepi just after stepi is broken.

 * The IO replay explained above.

Changes:
 v5 -> v6:
  * Boolize some variable (As suggested by Li Guang).
  * s/snap_timer/snapshot_timer/g (As suggested by Li Guang).
  * Choice a better name for the snapshot file. (As suggested by Li Guang).
  * Boolize stepping_back, etc.. (As suggested by Li Guang).
  * Cherry-pick icount: Add QemuOpts for icount. (As suggested by Paolo).
  * Making reverse execution option using QEMUOpts (As sugested by Paolo).
  * s/cexe/rexec/g (As nobody like cexe :)).
 
 v4 -> v5:
  * Fix a coding style issue (As suggested by Juan).

 v3 -> v4:
  * Fix icount_state_needed (As suggested by Amit).
  * Rebase.

 v2 -> v3:
  * Use trace instead of debug printfs (As suggested by Lluis).

 v1 -> v2:
  * Use subsection for icount migration (As suggested by Paolo).

  * Use with_bias parameters to get_icount instead of get_icount_wo_bias
    function (As suggested by Paolo).

KONRAD Frederic (13):
  icount: put icount variables into TimerState.
  migration: migrate icount fields.
  migration: make qemu_savevm_state public.
  icount: introduce icount timer.
  icount: check for icount clock deadline when cpu loop exits.
  icount: make icount extra computed on icount clock as well.
  timer: add cpu_icount_to_ns function.
  trace-events: add reverse-execution events.
  introduce reverse execution mechanism.
  gdbstub: allow reverse execution in gdb stub.
  cpu-exec: trigger a debug request when rexec stops.
  rexec: synchronize icount on the next event.
  rexec: allow to enable reverse execution.

Sebastian Tanase (1):
  icount: Add QemuOpts for icount

 Makefile.target                |   1 +
 cpu-exec.c                     |  13 ++
 cpus.c                         | 141 ++++++++++++++++---
 gdbstub.c                      |  31 ++++-
 include/qemu-common.h          |   3 +-
 include/qemu/timer.h           |  18 ++-
 include/reverse-execution.h    |  43 ++++++
 include/sysemu/sysemu.h        |   1 +
 main-loop.c                    |  10 ++
 qemu-options.hx                |   8 +-
 qemu-timer.c                   |   8 +-
 qtest.c                        |  13 +-
 reverse-execution.c            | 308 +++++++++++++++++++++++++++++++++++++++++
 savevm.c                       |   2 +-
 stubs/Makefile.objs            |   1 +
 stubs/cpu-get-icount.c         |  10 +-
 stubs/reverse-execution-stub.c |  32 +++++
 trace-events                   |   6 +
 vl.c                           |  48 +++++--
 19 files changed, 658 insertions(+), 39 deletions(-)
 create mode 100644 include/reverse-execution.h
 create mode 100644 reverse-execution.c
 create mode 100644 stubs/reverse-execution-stub.c

-- 
1.9.0

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2014-09-10 12:30 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-03 14:33 [Qemu-devel] [RFC PATCH v6 00/14] Reverse execution fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 01/14] icount: put icount variables into TimerState fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 02/14] migration: migrate icount fields fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 03/14] migration: make qemu_savevm_state public fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 04/14] icount: introduce icount timer fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 05/14] icount: check for icount clock deadline when cpu loop exits fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 06/14] icount: make icount extra computed on icount clock as well fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 07/14] timer: add cpu_icount_to_ns function fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 08/14] icount: Add QemuOpts for icount fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 09/14] trace-events: add reverse-execution events fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 10/14] introduce reverse execution mechanism fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 11/14] gdbstub: allow reverse execution in gdb stub fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 12/14] cpu-exec: trigger a debug request when rexec stops fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 13/14] rexec: synchronize icount on the next event fred.konrad
2014-07-03 14:33 ` [Qemu-devel] [RFC PATCH v6 14/14] rexec: allow to enable reverse execution fred.konrad
2014-09-01 16:22 ` [Qemu-devel] [RFC PATCH v6 00/14] Reverse execution Paolo Bonzini
2014-09-08  7:57   ` Frederic Konrad
2014-09-08  8:09     ` Frederic Konrad
2014-09-08  8:29       ` Paolo Bonzini
2014-09-08  8:43         ` Frederic Konrad
2014-09-09  6:30           ` Pavel Dovgaluk
2014-09-10 12:29             ` Frederic Konrad

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).