All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Nicolas Saenz Julienne <nsaenzju@redhat.com>
Cc: kwolf@redhat.com, fam@euphon.net, berrange@redhat.com,
	qemu-block@nongnu.org, michael.roth@amd.com, mtosatti@redhat.com,
	qemu-devel@nongnu.org, eduardo@habkost.net, hreitz@redhat.com,
	stefanha@redhat.com, pbonzini@redhat.com, eblake@redhat.com
Subject: Re: [PATCH v4 2/3] util/main-loop: Introduce the main loop into QOM
Date: Fri, 22 Apr 2022 13:13:37 +0200	[thread overview]
Message-ID: <87r15pz7z2.fsf@pond.sub.org> (raw)
In-Reply-To: <20220401093523.873508-3-nsaenzju@redhat.com> (Nicolas Saenz Julienne's message of "Fri, 1 Apr 2022 11:35:22 +0200")

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..e5f31c4469 100644
> --- a/qapi/qom.json
> +++ b/qapi/qom.json
> @@ -499,6 +499,17 @@
>              '*repeat': 'bool',
>              '*grab-toggle': 'GrabToggleKeys' } }
>  
> +##
> +# @EventLoopBaseProperties:
> +#
> +# Common properties for objects derived from EventLoopBase

This makes sense as internal documentation: QAPI type
EventLoopBaseProperties is associated with C type EventLoopBase.  Doc
comments are *external* documentation: they go into the QEMU QMP
Reference Manual.

What about "Common properties for event loops"?

> +#
> +# @aio-max-batch: maximum number of requests in a batch for the AIO engine,
> +#                 0 means that the engine will use its default.

Missing:

   # Since: 7.1

Permit me a short digression.  We add these unthinkingly, because
thinking is expensive.  Even when the type isn't really part of the
external interface.  The deeper problem is that we're trying to generate
documentation of the external interface from doc comments that are
written as documentation of the internal QAPI data structures.  Here,
for example, we document EventLoopBaseProperties even though it is a
purely internal thing: whether we factor out common members into a base
type or not is not visible in QMP.

> +##
> +{ 'struct': 'EventLoopBaseProperties',
> +  'data': { '*aio-max-batch': 'int' } }
> +
>  ##
>  # @IothreadProperties:
>  #
> @@ -516,17 +527,26 @@
>  #               algorithm detects it is spending too long polling without
>  #               encountering events. 0 selects a default behaviour (default: 0)
>  #
> -# @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 6.1)
> +# The @aio-max-batch option is available since 6.1.

This separates the member's "since" information from its defintion.
Can't be helped, because its defined in the base type, but the since
only applies here.  Okay.

>  #
>  # Since: 2.0
>  ##
>  { 'struct': 'IothreadProperties',
> +  'base': 'EventLoopBaseProperties',
>    'data': { '*poll-max-ns': 'int',
>              '*poll-grow': 'int',
> -            '*poll-shrink': 'int',
> -            '*aio-max-batch': 'int' } }
> +            '*poll-shrink': 'int' } }
> +
> +##
> +# @MainLoopProperties:
> +#
> +# Properties for the main-loop object.
> +#
> +# Since: 7.1
> +##
> +{ 'struct': 'MainLoopProperties',
> +  'base': 'EventLoopBaseProperties',
> +  'data': {} }

The patch does two things:

1. Factor EventLoopBaseProperties out of IothreadProperties.

2. Create MainLoopProperties.

I'd split it.  This is not a demand.

>  
>  ##
>  # @MemoryBackendProperties:
> @@ -818,6 +838,7 @@
>      { 'name': 'input-linux',
>        'if': 'CONFIG_LINUX' },
>      'iothread',
> +    'main-loop',
>      { 'name': 'memory-backend-epc',
>        'if': 'CONFIG_LINUX' },
>      'memory-backend-file',
> @@ -883,6 +904,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',

[...]



  reply	other threads:[~2022-04-22 12:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01  9:35 [PATCH v4 0/4] util/thread-pool: Expose minimun and maximum size Nicolas Saenz Julienne
2022-04-01  9:35 ` [PATCH v4 1/3] Introduce event-loop-base abstract class Nicolas Saenz Julienne
2022-04-01  9:35 ` [PATCH v4 2/3] util/main-loop: Introduce the main loop into QOM Nicolas Saenz Julienne
2022-04-22 11:13   ` Markus Armbruster [this message]
2022-04-22 11:40     ` Nicolas Saenz Julienne
2022-04-22 11:55       ` Nicolas Saenz Julienne
2022-04-01  9:35 ` [PATCH v4 3/3] util/event-loop-base: Introduce options to set the thread pool size Nicolas Saenz Julienne
2022-04-22 11:15   ` Markus Armbruster
2022-04-22 11:51     ` Nicolas Saenz Julienne
2022-04-22 12:45       ` Markus Armbruster
2022-04-04  8:42 ` [PATCH v4 0/4] util/thread-pool: Expose minimun and maximum size Nicolas Saenz Julienne
2022-04-04  9:29 ` Stefan Hajnoczi
2022-04-19 10:12   ` Nicolas Saenz Julienne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r15pz7z2.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=mtosatti@redhat.com \
    --cc=nsaenzju@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.