aboutsummaryrefslogtreecommitdiff
path: root/replay
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-10-02 18:27:18 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-10-02 18:27:18 +0100
commitdafd95053611aa14dda40266857608d12ddce658 (patch)
treeb414d9e2871c2a701ed3c42a15cfd7d289a9db7e /replay
parent3892f1f1a963e59dfe012cd9d461d33b2986fa3b (diff)
parent97866508669c4a75f531bfa94f8267900fcbb5dc (diff)
downloadqemu-dafd95053611aa14dda40266857608d12ddce658.zip
qemu-dafd95053611aa14dda40266857608d12ddce658.tar.gz
qemu-dafd95053611aa14dda40266857608d12ddce658.tar.bz2
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* configure fix for environment variables (Daniel) * fix memory leaks (Alex) * x86_64 MTTCG fixes (Emilio) * introduce atomic64 (Emilio) * Fix for virtio hang (Fam, myself) * SH serial port fix (Geert) * Deprecate rotation_rate for scsi-block (Fam) * Extend memory-backend-file availability to all POSIX hosts (Hikaru) * Memory API cleanups and fixes (Igor, Li Qiang, Peter, Philippe) * MSI/IOMMU fix (Jan) * Socket reconnection fixes (Marc-André) * icount fixes (Emilio, myself) * QSP fixes for Coverity (myself) * Some record/replay improovements (Pavel) * Packed struct fixes (Peter) * Windows dump fixes and elf2dmp (Viktor) * kbmclock fix (Yongji) # gpg: Signature made Tue 02 Oct 2018 18:13:12 BST # gpg: using RSA key BFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (80 commits) hw/scsi/mptendian: Avoid taking address of fields in packed structs cpus: fix TCG kick timer leak docs/devel/memory.txt: Document _with_attrs accessors hw/nvram/fw_cfg: Use memberwise copy of MemoryRegionOps struct memory: Remove old_mmio accessors memory: Fix access_with_adjusted_size(small size) on big-endian memory regions memory: Refactor common shifting code from accessors memory: Use MAKE_64BIT_MASK() virtio: do not take address of packed members replay: replay BH for IDE trim operation hostmem-file: make available memory-backend-file on POSIX-based hosts target/i386: fix translation for icount mode hvf: drop unused variable qom/object: add some interface asserts accel/tcg: Remove dead code lsi53c895a: convert to trace-events scsi-block: Deprecate rotation_rate kvmclock: run KVM_KVMCLOCK_CTRL ioctl in vcpu thread MAINTAINERS: add myself as elf2dmp maintainer contrib: add elf2dmp tool ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'replay')
-rw-r--r--replay/replay-events.c14
-rw-r--r--replay/replay-internal.h2
-rw-r--r--replay/replay-snapshot.c17
-rw-r--r--replay/replay.c12
4 files changed, 25 insertions, 20 deletions
diff --git a/replay/replay-events.c b/replay/replay-events.c
index 707de38..0964a82 100644
--- a/replay/replay-events.c
+++ b/replay/replay-events.c
@@ -94,18 +94,6 @@ void replay_disable_events(void)
}
}
-void replay_clear_events(void)
-{
- g_assert(replay_mutex_locked());
-
- while (!QTAILQ_EMPTY(&events_list)) {
- Event *event = QTAILQ_FIRST(&events_list);
- QTAILQ_REMOVE(&events_list, event, events);
-
- g_free(event);
- }
-}
-
/*! Adds specified async event to the queue */
void replay_add_event(ReplayAsyncEventKind event_kind,
void *opaque,
@@ -308,7 +296,7 @@ void replay_init_events(void)
void replay_finish_events(void)
{
events_enabled = false;
- replay_clear_events();
+ replay_flush_events();
}
bool replay_events_enabled(void)
diff --git a/replay/replay-internal.h b/replay/replay-internal.h
index ac4b27b..9b0fd91 100644
--- a/replay/replay-internal.h
+++ b/replay/replay-internal.h
@@ -142,8 +142,6 @@ void replay_init_events(void);
void replay_finish_events(void);
/*! Flushes events queue */
void replay_flush_events(void);
-/*! Clears events list before loading new VM state */
-void replay_clear_events(void);
/*! Returns true if there are any unsaved events in the queue */
bool replay_has_events(void);
/*! Saves events from queue into the file */
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index 2ab85cf..16bacc9 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -33,11 +33,18 @@ static int replay_pre_save(void *opaque)
static int replay_post_load(void *opaque, int version_id)
{
ReplayState *state = opaque;
- fseek(replay_file, state->file_offset, SEEK_SET);
- qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last);
- /* If this was a vmstate, saved in recording mode,
- we need to initialize replay data fields. */
- replay_fetch_data_kind();
+ if (replay_mode == REPLAY_MODE_PLAY) {
+ fseek(replay_file, state->file_offset, SEEK_SET);
+ qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last);
+ /* If this was a vmstate, saved in recording mode,
+ we need to initialize replay data fields. */
+ replay_fetch_data_kind();
+ } else if (replay_mode == REPLAY_MODE_RECORD) {
+ /* This is only useful for loading the initial state.
+ Therefore reset all the counters. */
+ state->instructions_count = 0;
+ state->block_request_id = 0;
+ }
return 0;
}
diff --git a/replay/replay.c b/replay/replay.c
index 8228261..379b51a 100644
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -224,6 +224,18 @@ out:
return res;
}
+bool replay_has_checkpoint(void)
+{
+ bool res = false;
+ if (replay_mode == REPLAY_MODE_PLAY) {
+ g_assert(replay_mutex_locked());
+ replay_account_executed_instructions();
+ res = EVENT_CHECKPOINT <= replay_state.data_kind
+ && replay_state.data_kind <= EVENT_CHECKPOINT_LAST;
+ }
+ return res;
+}
+
static void replay_enable(const char *fname, int mode)
{
const char *fmode = NULL;