]> Git Repo - qemu.git/commitdiff
qmp: add command "x-oob-test"
authorPeter Xu <[email protected]>
Fri, 9 Mar 2018 09:00:04 +0000 (17:00 +0800)
committerEric Blake <[email protected]>
Mon, 19 Mar 2018 19:58:37 +0000 (14:58 -0500)
This command is only used to test OOB functionality.  It should not be
used for any other purposes.

Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <20180309090006[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: grammar tweak]
Signed-off-by: Eric Blake <[email protected]>
qapi/misc.json
qmp.c

index 1545e416203616bab634e2f70e464fd2017122c3..c31fc983f326e3cc05da6c22b33045b3b28c04cd 100644 (file)
 ##
 { '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 7e606d848677b40488029aa439c8dac04cc21d7d..ea3760acb12b201e2bcc7f0900dc4461331a8675 100644 (file)
--- 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);
+    }
+}
This page took 0.033061 seconds and 4 git commands to generate.