[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v13 19/21] replay: replay blockers for devices
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH v13 19/21] replay: replay blockers for devices |
Date: |
Wed, 06 May 2015 17:04:32 +0300 |
User-agent: |
StGit/0.16 |
Some devices are not supported by record/replay subsystem.
This patch introduces replay blocker which denies starting record/replay
if such devices are included into the configuration.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
hw/bt/hci.c | 7 +++++++
include/qapi/qmp/qerror.h | 3 +++
replay/replay.c | 13 +++++++++++++
replay/replay.h | 3 +++
vl.c | 9 +++++++++
5 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/hw/bt/hci.c b/hw/bt/hci.c
index 7ea3dc6..9be30e1 100644
--- a/hw/bt/hci.c
+++ b/hw/bt/hci.c
@@ -23,6 +23,8 @@
#include "hw/usb.h"
#include "sysemu/bt.h"
#include "hw/bt.h"
+#include "qapi/qmp/qerror.h"
+#include "replay/replay.h"
struct bt_hci_s {
uint8_t *(*evt_packet)(void *opaque);
@@ -72,6 +74,8 @@ struct bt_hci_s {
struct HCIInfo info;
struct bt_device_s device;
+
+ Error *replay_blocker;
};
#define DEFAULT_RSSI_DBM 20
@@ -2191,6 +2195,9 @@ struct HCIInfo *bt_new_hci(struct bt_scatternet_s *net)
s->device.handle_destroy = bt_hci_destroy;
+ error_set(&s->replay_blocker, QERR_REPLAY_NOT_SUPPORTED, "bt hci");
+ replay_add_blocker(s->replay_blocker);
+
return &s->info;
}
diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index e567339..93d13df 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -130,4 +130,7 @@ void qerror_report_err(Error *err);
#define QERR_UNSUPPORTED \
ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently
supported"
+#define QERR_REPLAY_NOT_SUPPORTED \
+ ERROR_CLASS_GENERIC_ERROR, "Record/replay feature is not supported for
'%s'"
+
#endif /* QERROR_H */
diff --git a/replay/replay.c b/replay/replay.c
index 776dc77..9e0fceb 100755
--- a/replay/replay.c
+++ b/replay/replay.c
@@ -14,6 +14,7 @@
#include "replay-internal.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
+#include "qemu/error-report.h"
/* Current version of the replay mechanism.
Increase it when file format changes. */
@@ -26,6 +27,7 @@ ReplayMode replay_mode = REPLAY_MODE_NONE;
/* Name of replay file */
static char *replay_filename;
ReplayState replay_state;
+static GSList *replay_blockers;
bool replay_next_event_is(int event)
{
@@ -287,6 +289,12 @@ void replay_start(void)
return;
}
+ if (replay_blockers) {
+ error_report("Record/replay: %s",
+ error_get_pretty(replay_blockers->data));
+ exit(1);
+ }
+
/* Timer for snapshotting will be set up here. */
replay_enable_events();
@@ -326,3 +334,8 @@ void replay_finish(void)
replay_finish_events();
replay_mutex_destroy();
}
+
+void replay_add_blocker(Error *reason)
+{
+ replay_blockers = g_slist_prepend(replay_blockers, reason);
+}
diff --git a/replay/replay.h b/replay/replay.h
index a8ccedc..9f6f288 100755
--- a/replay/replay.h
+++ b/replay/replay.h
@@ -15,6 +15,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "qapi-types.h"
+#include "qapi/error.h"
#include "qemu/typedefs.h"
/* replay clock kinds */
@@ -50,6 +51,8 @@ void replay_configure(struct QemuOpts *opts);
void replay_start(void);
/*! Closes replay log file and frees other resources. */
void replay_finish(void);
+/*! Adds replay blocker with the specified error description */
+void replay_add_blocker(Error *reason);
/* Processing the instructions */
diff --git a/vl.c b/vl.c
index 316b0f1..e8c526b 100644
--- a/vl.c
+++ b/vl.c
@@ -799,7 +799,11 @@ static void configure_rtc(QemuOpts *opts)
if (!strcmp(value, "utc")) {
rtc_utc = 1;
} else if (!strcmp(value, "localtime")) {
+ Error *blocker = NULL;
rtc_utc = 0;
+ error_set(&blocker, QERR_REPLAY_NOT_SUPPORTED,
+ "-rtc base=localtime");
+ replay_add_blocker(blocker);
} else {
configure_rtc_date_offset(value, 0);
}
@@ -1207,6 +1211,11 @@ static void smp_parse(QemuOpts *opts)
exit(1);
}
+ if (smp_cpus > 1 || smp_cores > 1 || smp_threads > 1) {
+ Error *blocker = NULL;
+ error_set(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp");
+ replay_add_blocker(blocker);
+ }
}
static void realtime_init(void)
- [Qemu-devel] [RFC PATCH v13 11/21] replay: asynchronous events infrastructure, (continued)
- [Qemu-devel] [RFC PATCH v13 11/21] replay: asynchronous events infrastructure, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 12/21] replay: recording and replaying clock ticks, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 13/21] replay: shutdown event, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 14/21] replay: checkpoints, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 16/21] replay: ptimer, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 15/21] bottom halves: introduce bh call function, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 17/21] typedef: add typedef for QemuOpts, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 18/21] replay: initialization and deinitialization, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 19/21] replay: replay blockers for devices,
Pavel Dovgalyuk <=
- [Qemu-devel] [RFC PATCH v13 20/21] replay: command line options, Pavel Dovgalyuk, 2015/05/06
- [Qemu-devel] [RFC PATCH v13 21/21] replay: recording of the user input, Pavel Dovgalyuk, 2015/05/06
- Re: [Qemu-devel] [RFC PATCH v13 00/21] Deterministic replay core, Pavel Dovgaluk, 2015/05/19