From patchwork Wed Jul 1 11:53:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 490107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C28C01402A6 for ; Wed, 1 Jul 2015 22:04:27 +1000 (AEST) Received: from localhost ([::1]:57516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAGkb-0007vZ-Ls for incoming@patchwork.ozlabs.org; Wed, 01 Jul 2015 08:04:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAGZv-0006P6-2D for qemu-devel@nongnu.org; Wed, 01 Jul 2015 07:53:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAGZt-0008HX-4W for qemu-devel@nongnu.org; Wed, 01 Jul 2015 07:53:23 -0400 Received: from mail.ispras.ru ([83.149.199.45]:54379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAGZs-0008HG-PL for qemu-devel@nongnu.org; Wed, 01 Jul 2015 07:53:21 -0400 Received: from [10.10.150.7] (unknown [85.142.117.224]) by mail.ispras.ru (Postfix) with ESMTPSA id CF15C54016E; Wed, 1 Jul 2015 14:53:19 +0300 (MSK) To: qemu-devel@nongnu.org From: Pavel Dovgalyuk Date: Wed, 01 Jul 2015 14:53:23 +0300 Message-ID: <20150701115323.9832.78859.stgit@PASHA-ISP> In-Reply-To: <20150701115132.9832.12257.stgit@PASHA-ISP> References: <20150701115132.9832.12257.stgit@PASHA-ISP> User-Agent: StGit/0.16 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 83.149.199.45 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, igor.rubinov@gmail.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, hines@cert.org, fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH v15 19/21] replay: replay blockers for devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/bt/hci.c | 7 +++++++ include/qapi/qmp/qerror.h | 3 +++ replay/replay.c | 13 +++++++++++++ replay/replay.h | 3 +++ vl.c | 10 ++++++++++ 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 842b27a..0781a7f 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -106,4 +106,7 @@ #define QERR_UNSUPPORTED \ "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 04eadbc..101a49c 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) { @@ -288,6 +290,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(); @@ -327,3 +335,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 #include #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 5b476be..ee1196e 100644 --- a/vl.c +++ b/vl.c @@ -122,6 +122,7 @@ int main(int argc, char **argv) #include "qapi-event.h" #include "exec/semihost.h" #include "replay/replay.h" +#include "qapi/qmp/qerror.h" #define MAX_VIRTIO_CONSOLES 1 #define MAX_SCLP_CONSOLES 1 @@ -824,7 +825,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); } @@ -1227,6 +1232,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)