[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v6 14/14] rexec: allow to enable reverse executi
From: |
fred . konrad |
Subject: |
[Qemu-devel] [RFC PATCH v6 14/14] rexec: allow to enable reverse execution. |
Date: |
Thu, 3 Jul 2014 16:33:45 +0200 |
From: KONRAD Frederic <address@hidden>
This creates QEMU options for reverse execution.
Signed-off-by: KONRAD Frederic <address@hidden>
---
cpus.c | 15 +++++++++++++++
qemu-options.hx | 6 +++++-
vl.c | 6 ++++++
3 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 740c6e5..ba5f8f5 100644
--- a/cpus.c
+++ b/cpus.c
@@ -498,6 +498,7 @@ static const VMStateDescription vmstate_timers = {
void configure_icount(QemuOpts *opts, Error **errp)
{
const char *option;
+ bool enable_rexec;
seqlock_init(&timers_state.vm_clock_seqlock, NULL);
vmstate_register(NULL, 0, &vmstate_timers, &timers_state);
@@ -513,12 +514,26 @@ void configure_icount(QemuOpts *opts, Error **errp)
icount_warp_timer = timer_new_ns(QEMU_CLOCK_REALTIME,
icount_warp_rt, NULL);
+
+ enable_rexec = qemu_opt_get_bool(opts, "rexec", false);
+
if (strcmp(option, "auto") != 0) {
icount_time_shift = strtol(option, NULL, 0);
use_icount = 1;
+
+ if (enable_rexec) {
+ rexec_setup();
+ }
return;
}
+ /*
+ * We don't allow to run reverse execution with use_icount != 1.
+ */
+ if (enable_rexec) {
+ error_setg(errp, "Reverse execution requires icount in fixed mode.");
+ }
+
use_icount = 2;
/* 125MIPS seems a reasonable initial guess at the guest speed.
diff --git a/qemu-options.hx b/qemu-options.hx
index 143def4..ee1fdf4 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3011,7 +3011,7 @@ re-inject them.
ETEXI
DEF("icount", HAS_ARG, QEMU_OPTION_icount, \
- "-icount [shift=N|auto]\n" \
+ "-icount [shift=N|auto][,rexec=on|off]\n" \
" enable virtual instruction counter with 2^N clock ticks
per\n" \
" instruction\n", QEMU_ARCH_ALL)
STEXI
@@ -3026,6 +3026,10 @@ Note that while this option can give deterministic
behavior, it does not
provide cycle accurate emulation. Modern CPUs contain superscalar out of
order cores with complex cache hierarchies. The number of instructions
executed often has little or no correlation with actual performance.
+
address@hidden will enable reverse execution. A snapshot is taken regularly
+and will allow to replay the execution when gdb reverse-step or reverse-cont
+command are used. This requires shift!=auto.
ETEXI
DEF("watchdog", HAS_ARG, QEMU_OPTION_watchdog, \
diff --git a/vl.c b/vl.c
index 18df07c..69924cd 100644
--- a/vl.c
+++ b/vl.c
@@ -548,6 +548,9 @@ static QemuOptsList qemu_icount_opts = {
{
.name = "shift",
.type = QEMU_OPT_STRING,
+ }, {
+ .name = "rexec",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
@@ -4561,5 +4564,8 @@ int main(int argc, char **argv, char **envp)
tpm_cleanup();
#endif
+ if (rexec_is_enabled()) {
+ rexec_cleanup();
+ }
return 0;
}
--
1.9.0
- [Qemu-devel] [RFC PATCH v6 05/14] icount: check for icount clock deadline when cpu loop exits., (continued)
- [Qemu-devel] [RFC PATCH v6 05/14] icount: check for icount clock deadline when cpu loop exits., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 03/14] migration: make qemu_savevm_state public., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 09/14] trace-events: add reverse-execution events., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 04/14] icount: introduce icount timer., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 10/14] introduce reverse execution mechanism., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 07/14] timer: add cpu_icount_to_ns function., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 11/14] gdbstub: allow reverse execution in gdb stub., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 12/14] cpu-exec: trigger a debug request when rexec stops., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 13/14] rexec: synchronize icount on the next event., fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 08/14] icount: Add QemuOpts for icount, fred . konrad, 2014/07/03
- [Qemu-devel] [RFC PATCH v6 14/14] rexec: allow to enable reverse execution.,
fred . konrad <=
- [Qemu-devel] [RFC PATCH v6 01/14] icount: put icount variables into TimerState., fred . konrad, 2014/07/03