aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qapi/misc.json18
-rw-r--r--qmp.c16
2 files changed, 34 insertions, 0 deletions
diff --git a/qapi/misc.json b/qapi/misc.json
index 1545e41620..c31fc983f3 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -3427,3 +3427,21 @@
##
{ 'event': 'COMMAND_DROPPED' ,
'data': { 'id': 'any', 'reason': 'CommandDropReason' } }
+
+##
+# @x-oob-test:
+#
+# Test OOB functionality. When sending this command with lock=true,
+# it'll try to hang the dispatcher. When sending it with lock=false,
+# it'll try to notify the locked thread to continue. Note: it should
+# only be used by QMP test program rather than anything else.
+#
+# Since: 2.12
+#
+# Example:
+#
+# { "execute": "x-oob-test",
+# "arguments": { "lock": true } }
+##
+{ 'command': 'x-oob-test', 'data' : { 'lock': 'bool' },
+ 'allow-oob': true }
diff --git a/qmp.c b/qmp.c
index 7e606d8486..ea3760acb1 100644
--- a/qmp.c
+++ b/qmp.c
@@ -770,3 +770,19 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
return mem_info;
}
+
+static QemuSemaphore x_oob_test_sem;
+
+static void __attribute__((constructor)) x_oob_test_init(void)
+{
+ qemu_sem_init(&x_oob_test_sem, 0);
+}
+
+void qmp_x_oob_test(bool lock, Error **errp)
+{
+ if (lock) {
+ qemu_sem_wait(&x_oob_test_sem);
+ } else {
+ qemu_sem_post(&x_oob_test_sem);
+ }
+}