All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
	alex.bennee@linaro.org, mark.burton@greensocs.com,
	real@ispras.ru, batuzovk@ispras.ru,
	maria.klimushenkova@ispras.ru, pavel.dovgaluk@ispras.ru,
	pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com
Subject: [Qemu-devel] [RFC PATCH v9 21/23] replay: replay blockers for devices
Date: Wed, 18 Feb 2015 14:57:46 +0300	[thread overview]
Message-ID: <20150218115746.4176.19055.stgit@PASHA-ISP> (raw)
In-Reply-To: <20150218115534.4176.12578.stgit@PASHA-ISP>

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 <pavel.dovgaluk@ispras.ru>
---
 hw/bt/hci.c               |    7 +++++++
 include/qapi/qmp/qerror.h |    3 +++
 replay/replay.c           |   14 ++++++++++++++
 replay/replay.h           |    3 +++
 vl.c                      |    9 +++++++++
 5 files changed, 36 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 986260f..a9f5e24 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -136,4 +136,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 0c1f4f3..eb730a9 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. */
@@ -27,6 +28,8 @@ ReplayMode replay_mode = REPLAY_MODE_NONE;
 static char *replay_filename;
 ReplayState replay_state;
 
+static GSList *replay_blockers;
+
 bool skip_async_events(int stop_event)
 {
     bool res = false;
@@ -296,6 +299,12 @@ void replay_init_timer(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();
@@ -335,3 +344,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 88c6a60..f0ef494 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 */
@@ -49,6 +50,8 @@ void replay_configure(struct QemuOpts *opts);
 void replay_init_timer(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 a02e831..a5555fb 100644
--- a/vl.c
+++ b/vl.c
@@ -800,7 +800,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);
         }
@@ -1206,6 +1210,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)

  parent reply	other threads:[~2015-02-18 11:57 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 11:55 [Qemu-devel] [RFC PATCH v9 00/23] Deterministic replay core Pavel Dovgalyuk
2015-02-18 11:55 ` [Qemu-devel] [RFC PATCH v9 01/23] i386: partial revert of interrupt poll fix Pavel Dovgalyuk
2015-02-18 11:55 ` [Qemu-devel] [RFC PATCH v9 02/23] replay: global variables and function stubs Pavel Dovgalyuk
2015-02-18 11:55 ` [Qemu-devel] [RFC PATCH v9 03/23] sysemu: system functions for replay Pavel Dovgalyuk
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 04/23] replay: internal functions for replay log Pavel Dovgalyuk
2015-02-18 12:43   ` Paolo Bonzini
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 05/23] replay: introduce mutex to protect the " Pavel Dovgalyuk
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 06/23] replay: introduce icount event Pavel Dovgalyuk
2015-02-18 13:49   ` Paolo Bonzini
2015-02-18 14:14   ` Paolo Bonzini
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 07/23] cpu-exec: allow temporary disabling icount Pavel Dovgalyuk
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 08/23] cpu: replay instructions sequence Pavel Dovgalyuk
2015-02-18 12:50   ` Paolo Bonzini
2015-02-18 13:48   ` Paolo Bonzini
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 09/23] replay: interrupts and exceptions Pavel Dovgalyuk
2015-02-18 13:54   ` Paolo Bonzini
2015-02-18 14:14   ` Paolo Bonzini
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 10/23] replay: asynchronous events infrastructure Pavel Dovgalyuk
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 11/23] replay: recording and replaying clock ticks Pavel Dovgalyuk
2015-02-18 14:13   ` Paolo Bonzini
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 12/23] timer: replace time() with QEMU_CLOCK_HOST Pavel Dovgalyuk
2015-02-18 13:04   ` Paolo Bonzini
2015-02-18 11:56 ` [Qemu-devel] [RFC PATCH v9 13/23] replay: shutdown event Pavel Dovgalyuk
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 14/23] replay: checkpoints Pavel Dovgalyuk
2015-02-18 14:14   ` Paolo Bonzini
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 15/23] aio: replace stack of bottom halves with queue Pavel Dovgalyuk
2015-02-18 13:06   ` Paolo Bonzini
2015-02-18 13:10   ` Paolo Bonzini
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 16/23] replay: bottom halves Pavel Dovgalyuk
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 17/23] replay: replay aio requests Pavel Dovgalyuk
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 18/23] replay: thread pool Pavel Dovgalyuk
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 19/23] typedef: add typedef for QemuOpts Pavel Dovgalyuk
2015-02-18 13:11   ` Paolo Bonzini
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 20/23] replay: initialization and deinitialization Pavel Dovgalyuk
2015-02-18 13:14   ` Paolo Bonzini
2015-02-18 11:57 ` Pavel Dovgalyuk [this message]
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 22/23] replay: command line options Pavel Dovgalyuk
2015-02-18 13:18   ` Paolo Bonzini
2015-02-20  8:02     ` Pavel Dovgaluk
     [not found]     ` <23594.561199616$1424419399@news.gmane.org>
2015-02-20 10:28       ` Paolo Bonzini
2015-02-18 11:57 ` [Qemu-devel] [RFC PATCH v9 23/23] replay: recording of the user input Pavel Dovgalyuk
2015-02-18 14:19 ` [Qemu-devel] [RFC PATCH v9 00/23] Deterministic replay core Paolo Bonzini
2015-02-27  9:23   ` Pavel Dovgaluk
2015-02-27 13:07     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150218115746.4176.19055.stgit@PASHA-ISP \
    --to=pavel.dovgaluk@ispras.ru \
    --cc=afaerber@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=batuzovk@ispras.ru \
    --cc=fred.konrad@greensocs.com \
    --cc=maria.klimushenkova@ispras.ru \
    --cc=mark.burton@greensocs.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=real@ispras.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.