[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/3] util/main-loop: Introduce the main loop into QOM
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v3 2/3] util/main-loop: Introduce the main loop into QOM |
Date: |
Wed, 16 Mar 2022 15:28:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Nicolas Saenz Julienne <nsaenzju@redhat.com> writes:
> 'event-loop-base' provides basic property handling for all 'AioContext'
> based event loops. So let's define a new 'MainLoopClass' that inherits
> from it. This will permit tweaking the main loop's properties through
> qapi as well as through the command line using the '-object' keyword[1].
> Only one instance of 'MainLoopClass' might be created at any time.
>
> 'EventLoopBaseClass' learns a new callback, 'can_be_deleted()' so as to
> mark 'MainLoop' as non-deletable.
>
> [1] For example:
> -object main-loop,id=main-loop,aio-max-batch=<value>
>
> Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[...]
> diff --git a/qapi/qom.json b/qapi/qom.json
> index eeb5395ff3..10800166e8 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -528,6 +528,19 @@
> '*poll-shrink': 'int',
> '*aio-max-batch': 'int' } }
>
> +##
> +# @MainLoopProperties:
> +#
> +# Properties for the main-loop object.
> +#
> +# @aio-max-batch: maximum number of requests in a batch for the AIO engine,
> +# 0 means that the engine will use its default (default:0)
> +#
> +# Since: 7.1
> +##
> +{ 'struct': 'MainLoopProperties',
> + 'data': { '*aio-max-batch': 'int' } }
> +
IothreadProperties has the same member, with the same documentation.
Do main loop and iothreads have a common ancestor, conceptually?
If yes, it might make sense for MainLoopProperties and
IothreadProperties to have a common base type, and put @aio-max-batch
there. This is not a demand.
> ##
> # @MemoryBackendProperties:
> #
> @@ -818,6 +831,7 @@
> { 'name': 'input-linux',
> 'if': 'CONFIG_LINUX' },
> 'iothread',
> + 'main-loop',
> { 'name': 'memory-backend-epc',
> 'if': 'CONFIG_LINUX' },
> 'memory-backend-file',
> @@ -883,6 +897,7 @@
> 'input-linux': { 'type': 'InputLinuxProperties',
> 'if': 'CONFIG_LINUX' },
> 'iothread': 'IothreadProperties',
> + 'main-loop': 'MainLoopProperties',
> 'memory-backend-epc': { 'type': 'MemoryBackendEpcProperties',
> 'if': 'CONFIG_LINUX' },
> 'memory-backend-file': 'MemoryBackendFileProperties',
QAPI schema
Acked-by: Markus Armbruster <armbru@redhat.com>