[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v6 11/20] replay/replay-internal.c: track holdin
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH v6 11/20] replay/replay-internal.c: track holding of replay_lock |
Date: |
Wed, 07 Feb 2018 15:04:55 +0300 |
User-agent: |
StGit/0.17.1-dirty |
From: Alex Bennée <address@hidden>
This is modelled after the iothread mutex lock. We keep a TLS flag to
indicate when that thread has acquired the lock and assert we don't
double-lock or release when we shouldn't have.
Signed-off-by: Alex Bennée <address@hidden>
Tested-by: Pavel Dovgalyuk <address@hidden>
---
replay/replay-internal.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/replay/replay-internal.c b/replay/replay-internal.c
index fca8514..0d7e1d6 100644
--- a/replay/replay-internal.c
+++ b/replay/replay-internal.c
@@ -169,6 +169,8 @@ void replay_finish_event(void)
replay_fetch_data_kind();
}
+static __thread bool replay_locked;
+
void replay_mutex_init(void)
{
qemu_mutex_init(&lock);
@@ -179,13 +181,22 @@ void replay_mutex_destroy(void)
qemu_mutex_destroy(&lock);
}
+static bool replay_mutex_locked(void)
+{
+ return replay_locked;
+}
+
void replay_mutex_lock(void)
{
+ g_assert(!replay_mutex_locked());
qemu_mutex_lock(&lock);
+ replay_locked = true;
}
void replay_mutex_unlock(void)
{
+ g_assert(replay_mutex_locked());
+ replay_locked = false;
qemu_mutex_unlock(&lock);
}
- [Qemu-devel] [RFC PATCH v6 01/20] cpu-exec: fix exception_index handling, (continued)
- [Qemu-devel] [RFC PATCH v6 01/20] cpu-exec: fix exception_index handling, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 02/20] block: implement bdrv_snapshot_goto for blkreplay, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 03/20] blkreplay: create temporary overlay for underlaying devices, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 04/20] replay: disable default snapshot for record/replay, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 05/20] replay: fix processing async events, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 06/20] replay: fixed replay_enable_events, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 07/20] replay: fix save/load vm for non-empty queue, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 08/20] replay: added replay log format description, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 09/20] replay: save prior value of the host clock, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 10/20] replay/replay.c: bump REPLAY_VERSION again, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 11/20] replay/replay-internal.c: track holding of replay_lock,
Pavel Dovgalyuk <=
- [Qemu-devel] [RFC PATCH v6 12/20] replay: make locking visible outside replay code, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 13/20] replay: push replay_mutex_lock up the call tree, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 14/20] replay: don't destroy mutex at exit, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 15/20] replay: check return values of fwrite, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 16/20] replay: avoid recursive call of checkpoints, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 18/20] replay: don't process async events when warping the clock, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 19/20] replay: save vmstate of the asynchronous events, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 17/20] scripts/replay-dump.py: replay log dumper, Pavel Dovgalyuk, 2018/02/07
- [Qemu-devel] [RFC PATCH v6 20/20] replay: don't drain/flush bdrv queue while RR is working, Pavel Dovgalyuk, 2018/02/07
- Re: [Qemu-devel] [RFC PATCH v6 00/20] replay additions, Ciro Santilli, 2018/02/07