From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1w4A-0001Wu-Sl for qemu-devel@nongnu.org; Tue, 01 Jul 2014 07:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1w43-0007A2-I0 for qemu-devel@nongnu.org; Tue, 01 Jul 2014 07:17:38 -0400 Received: from mail.ispras.ru ([83.149.199.45]:33057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1w43-000796-6f for qemu-devel@nongnu.org; Tue, 01 Jul 2014 07:17:31 -0400 From: "Pavel Dovgaluk" Date: Tue, 1 Jul 2014 15:17:30 +0400 Message-ID: <007401cf951e$0c5bbd10$25133730$@Dovgaluk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: [Qemu-devel] [RFC PATCH 00/22] Reverse execution and deterministic replay List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'QEMU Developers' Cc: 'Peter Maydell' , 'Paolo Bonzini' , 'Peter Crosthwaite' , 'Mark Burton' , 'Frederic Konrad' Hi, This set of patches is related to the reverse execution and deterministic replay of qemu execution Our implementation of replay can be used for deterministic and reverse debugging of guest code through gdb remote interface. Execution recording writes non-deterministic events log, which can be later used for replaying the execution anywhere and for unlimited number of times. It also supports checkpointing for faster rewinding during reverse debugging. Execution replaying reads the log and replays all non-deterministic events including external input, hardware clocks, and interrupts. Reverse execution has the following features: * Deterministically replays whole system execution and all contents of the memory, state of the hadrware devices, clocks, and screen of the VM. * Writes execution log into the file for latter replaying for multiple times on different machines. * Supports i386, x86_64, and ARM hardware platforms. * Performs deterministic replay of all operations with keyboard, mouse, network adapters, audio devices, serial interfaces, and physical USB devices connected to the emulator. * Provides support for gdb reverse debugging commands like reverse-step and reverse-continue. * Supports auto-checkpointing for convenient reverse debugging. * Allows "going to the live execution" from the replay mode. Usage of the record/replay: * First, record the execution, by adding '-record fname=replay.bin' to the command line. * Then you can replay it for the multiple times by using another command line option: '-replay fname=replay.bin' * Virtual machine should have at least one virtual disk, which is used to store checkpoints. If you want to enable automatic checkpointing, simply add ',period=XX' to record options, where XX is the checkpointing period in seconds. * Using of the network adapters in record/replay mode is possible with the following command-line options: - '-net user' (or another host adapter) in record mode - '-net replay' in replay mode. Every host network adapter should be replaced by 'replay' when replaying the execution. * Reverse debugging can be used through gdb remote interface. reverse-stepi and reverse-continue commands are supported. Other reverse commands should also work, because they reuse these ones. * Monitor is extended by the following commands: - replay_info - prints information about replay mode and current step (number of instructions executed) - replay_break - sets "breakpoint" at the specified instructions count. - replay_seek - rewinds (using the checkpoints, if possible) to the specified step of replay log. - replay_events - prints list of the external events like network packet input, or keyboard and mouse input. Paper with short description of deterministic replay implementation: http://www.computer.org/csdl/proceedings/csmr/2012/4666/00/4666a553-abs.html Makefile.target | 3 + arch_init.c | 9 + async.c | 50 +- audio/audio.c | 10 +- audio/winwaveaudio.c | 171 +++- block.c | 139 +++- block/blkdebug.c | 2 +- block/blkverify.c | 4 +- block/cow.c | 2 +- block/qcow.c | 2 +- block/qcow2.c | 13 +- block/qed.c | 2 +- block/raw-posix.c | 5 +- block/raw-win32.c | 8 +- block/vmdk.c | 8 +- block/vvfat.c | 3 +- block/win32-aio.c | 2 + blockdev.c | 23 +- cpu-exec.c | 73 ++- cpus.c | 151 +++- dma-helpers.c | 15 +- exec.c | 19 + gdbstub.c | 79 ++- hmp-commands.hx | 101 +++ hw/acpi/core.c | 7 +- hw/arm/integratorcp.c | 38 +- hw/audio/pcspk.c | 19 +- hw/block/fdc.c | 11 +- hw/block/virtio-blk.c | 8 +- hw/char/parallel.c | 22 + hw/char/serial.c | 132 ++- hw/display/vga.c | 6 +- hw/i386/kvmvapic.c | 30 +- hw/ide/ahci.c | 10 +- hw/ide/atapi.c | 5 +- hw/ide/core.c | 19 +- hw/ide/pci.c | 10 + hw/input/pckbd.c | 3 +- hw/intc/apic_common.c | 5 +- hw/net/rtl8139.c | 5 +- hw/pci-host/piix.c | 22 +- hw/timer/arm_timer.c | 2 +- hw/timer/hpet.c | 9 +- hw/timer/mc146818rtc.c | 17 +- hw/timer/pl031.c | 32 +- hw/usb/core.c | 6 +- hw/usb/hcd-uhci.c | 2 +- hw/usb/host-libusb.c | 518 ++++++++---- include/block/aio.h | 9 + include/block/block.h | 21 +- include/block/thread-pool.h | 60 ++- include/exec/cpu-defs.h | 1 + include/exec/cpu_ldst_template.h | 28 +- include/exec/exec-all.h | 38 +- include/exec/gen-icount.h | 7 + include/hw/char/serial.h | 2 +- include/hw/host-libusb.h | 103 +++ include/hw/usb.h | 3 + include/migration/vmstate.h | 13 + include/monitor/monitor.h | 1 + include/qemu-common.h | 3 + include/qemu/main-loop.h | 1 + include/qemu/timer.h | 54 ++- include/qom/cpu.h | 4 + include/sysemu/char.h | 4 + include/sysemu/cpus.h | 3 + include/sysemu/sysemu.h | 2 + include/ui/input.h | 2 + main-loop.c | 13 + monitor.c | 139 +++ net/Makefile.objs | 2 +- net/clients.h | 4 + net/dump.c | 6 + net/hub.c | 1 + net/net-replay.c | 56 ++ net/net.c | 9 +- net/slirp.c | 14 +- net/socket.c | 40 +- net/tap-win32.c | 19 +- net/tap.c | 24 +- net/vde.c | 14 +- qapi-schema.json | 10 + qemu-char.c | 103 ++- qemu-img.c | 6 +- qemu-io-cmds.c | 2 +- qemu-io.c | 4 +- qemu-nbd.c | 2 +- qemu-options.hx | 32 + qemu-timer.c | 49 +- replay/Makefile.objs | 1 + replay/replay-audio.c | 238 ++++++ replay/replay-char.c | 119 +++ replay/replay-debug.c | 152 ++++ replay/replay-events.c | 463 ++++++++++ replay/replay-icount.c | 112 +++ replay/replay-input.c | 152 ++++ replay/replay-internal.c | 176 ++++ replay/replay-internal.h | 192 +++++ replay/replay-net.c | 367 ++++++++ replay/replay-usb.c | 241 ++++++ replay/replay.c | 1604 +++++++++++++++++++++++++++++++++++ replay/replay.h | 249 ++++++ roms/openbios | 2 +- roms/qemu-palcode | 2 +- roms/seabios | 2 +- roms/vgabios | 2 +- savevm.c | 31 +- slirp/slirp.c | 7 +- softmmu_template.h | 18 + stubs/Makefile.objs | 1 + stubs/replay.c | 72 ++ stubs/vmstate.c | 3 + target-arm/helper.h | 4 + target-arm/machine.c | 4 + target-arm/op_helper.c | 55 ++ target-arm/translate.c | 109 +++- target-i386/Makefile.objs | 2 +- target-i386/cpu.c | 1 + target-i386/cpu.h | 10 + target-i386/fpu_helper.c | 31 +- target-i386/helper.c | 2 + target-i386/helper.h | 8 + target-i386/machine.c | 5 + target-i386/misc_helper.c | 13 +- target-i386/replay_helper.c | 81 ++ target-i386/seg_helper.c | 1 + target-i386/shift_helper_template.h | 14 +- target-i386/translate.c | 152 +++- tests/test-thread-pool.c | 6 +- thread-pool.c | 101 +-- translate-all.c | 28 +- ui/input.c | 77 ++- util/iov.c | 4 + vl.c | 159 ++++- vmstate.c | 6 + 136 files changed, 7168 insertions(+), 651 deletions(-) Pavel Dovgalyuk