[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v6 24/27] qmp: add command "x-oob-test"
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [RFC v6 24/27] qmp: add command "x-oob-test" |
Date: |
Thu, 21 Dec 2017 20:58:46 +0800 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Tue, 12/19 16:45, Peter Xu wrote:
> This command is only used to test OOB functionality. It should not be
> used for any other purposes.
>
> Reviewed-by: Stefan Hajnoczi <address@hidden>
> Signed-off-by: Peter Xu <address@hidden>
> ---
> qapi-schema.json | 18 ++++++++++++++++++
> qmp.c | 16 ++++++++++++++++
> 2 files changed, 34 insertions(+)
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 447ab25572..a63cd42cdd 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -3259,3 +3259,21 @@
> ##
> { 'event': 'COMMAND_DROPPED' ,
> 'data': { 'id': 'any', 'reason': 'CommandDropReason' } }
> +
> +##
> +# @x-oob-test:
> +#
> +# Test OOB functionality. When send this command with lock=true,
> +# it'll try to hang the dispatcher. When send 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 e8c303116a..ca2968aad2 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -722,3 +722,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);
> + }
> +}
> --
> 2.14.3
>
Reviewed-by: Fam Zheng <address@hidden>
- Re: [Qemu-devel] [RFC v6 19/27] qapi: introduce new cmd option "allow-oob", (continued)
- [Qemu-devel] [RFC v6 20/27] qmp: export qmp_dispatch_check_obj and allow "id", Peter Xu, 2017/12/19
- [Qemu-devel] [RFC v6 21/27] qmp: support out-of-band (oob) execution, Peter Xu, 2017/12/19
- [Qemu-devel] [RFC v6 22/27] qmp: isolate responses into io thread, Peter Xu, 2017/12/19
- [Qemu-devel] [RFC v6 23/27] monitor: enable IO thread for (qmp & !mux) typed, Peter Xu, 2017/12/19
- [Qemu-devel] [RFC v6 24/27] qmp: add command "x-oob-test", Peter Xu, 2017/12/19
- Re: [Qemu-devel] [RFC v6 24/27] qmp: add command "x-oob-test",
Fam Zheng <=
- [Qemu-devel] [RFC v6 25/27] docs: update QMP documents for OOB commands, Peter Xu, 2017/12/19
- [Qemu-devel] [RFC v6 26/27] tests: qmp-test: verify command batching, Peter Xu, 2017/12/19
- [Qemu-devel] [RFC v6 27/27] tests: qmp-test: add oob test, Peter Xu, 2017/12/19