From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "John Snow" <jsnow@redhat.com>,
qemu-devel@nongnu.org, "Alex Williamson" <alex@shazbot.org>,
linux-cxl@vger.kernel.org, "Michael Tokarev" <mjt@tls.msk.ru>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
"Peter Xu" <peterx@redhat.com>, "Eric Blake" <eblake@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"zhenwei pi" <zhenwei.pi@linux.dev>,
qemu-trivial@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
"Kevin Wolf" <kwolf@redhat.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Jiri Pirko" <jiri@resnulli.us>,
qemu-block@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
linux-edac@vger.kernel.org,
"Gonglei (Arei)" <arei.gonglei@huawei.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Jason Wang" <jasowangio@gmail.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Ani Sinha" <anisinha@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Lukas Straub" <lukasstraub2@web.de>,
"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH v3 01/43] qapi: convert trivial intro sections for error.json
Date: Thu, 27 Aug 2026 15:09:35 +0200 [thread overview]
Message-ID: <87jypb90c0.fsf@pond.sub.org> (raw)
In-Reply-To: <ao_-_38raHK0rWkX@redhat.com> ("Daniel P. Berrangé"'s message of "Thu, 27 Aug 2026 10:10:23 +0100")
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Wed, Aug 26, 2026 at 03:37:58PM -0400, John Snow wrote:
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>> qapi/error.json | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/qapi/error.json b/qapi/error.json
>> index 54cb02fb880..a53b13e55c9 100644
>> --- a/qapi/error.json
>> +++ b/qapi/error.json
>> @@ -9,8 +9,7 @@
>>
>> ##
>> # @QapiErrorClass:
>> -#
>> -# QEMU error classes
>> +# QEMU error classes
>
> Where is this need for indent coming from ? From the POV of someone
> writing comments, the need to indent the introductory text like this
> feels very counter-intuitive, an exception from any other inline
> docs syntax I've typically used. Is there any way we can avoid this ?
The cover letter explains the need:
This is being done primarily for the benefit of the forthcoming
"inliner", a feature for the rendered HTML QMP documentation that
seeks to "inline" QMP command argument documentation into the argument
list for each command.
There are two main motives here:
(1) We want the split between the "introduction" and "details"
sections to be mechanically obvious, so that auto-generated or
inlined documentation has a well-defined, obvious spot to go.
(2) We do not want to inline irrelevant, introductory text describing
structures to be copied into command documentation.
But the need actually exists already, the inliner merely grows it.
Let me elaborate using an example: query-memory-size-summary
Its doc comment:
##
# @query-memory-size-summary:
#
# Return the amount of initially allocated and present hotpluggable
# (if enabled) memory in bytes.
#
# TODO: This line is a hack to separate the example from the body
#
# .. qmp-example::
#
# -> { "execute": "query-memory-size-summary" }
# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
#
# Since: 2.11
##
Looks like this in the generated QEMU QMP Reference Manual:
Command query-memory-size-summary (Since: 2.11)
Return the amount of initially allocated and present hotpluggable
(if enabled) memory in bytes.
Return:
"MemoryInfo"
Example::
-> { "execute": "query-memory-size-summary" }
<- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
The "Return:" part is inserted by the generator. Where? The order we
want is roughly
Intro (a brief description)
Members / Arguments
Returns
Errors
Features
Details (additional information, examples, ...)
Since
Members / Arguments, Returns, Errors, and Features are all optional.
They are in fact all absent in query-memory-size-summary. This makes
Intro and Details bleed together.
The TODO line keeps them separate, because it's a section (the doc
comment syntax is a sequence of sections, in this case Intro, TODO,
Details). Not only is abusing TODO an ugly hack, it's also easy to
forget. If we did forget it here, Return would be inserted in at the
very end:
Command query-memory-size-summary (Since: 2.11)
Return the amount of initially allocated and present hotpluggable
(if enabled) memory in bytes.
Example::
-> { "execute": "query-memory-size-summary" }
<- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
Return:
"MemoryInfo"
Fortunately, the problem is uncommon: we have just five such TODOs right
now.
Unfortunately, the (still not merged) inliner makes it a lot more
common, and also more serious.
A preparatory series from John added 59 such markers, i.e. about one in
twenty doc comments needed one. "Such markers" because he didn't abuse
TODO, but created proper syntax for it, namely a Details: line.
Why more serious? Have a look at netdev_add. Looks like this in the
generated QEMU QMP Reference Manual:
Command netdev_add (Since: 0.14)
Add a network backend.
Additional arguments depend on the type.
Arguments:
* The members of "Netdev".
[...]
To actually see the arguments, you need to follow the link to type
Netdev. This is bad UX. We want the arguments right there, so the
inliner inlines Netdev documentation:
Object Netdev (Since: 1.2)
Captures the configuration of a network device.
Members:
* **id** ("string") -- identifier for monitor commands.
* **type** ("NetClientDriver") -- Specify the driver used for
interpreting remaining arguments.
* When "type" is "nic": The members of "NetLegacyNicOptions".
[...]
into netdev_add documentation like this:
Command netdev_add (Since: 0.14)
Add a network backend.
Additional arguments depend on the type.
Arguments:
* **id** ("string") -- identifier for monitor commands.
* **type** ("NetClientDriver") -- Specify the driver used for
interpreting remaining arguments.
* When "type" is "nic": The members of "NetLegacyNicOptions".
[...]
Note that the inliner elided Netdev's Intro "Captures the configuration
of a network device."
However, when Intro and Details bleed together, the inliner elides more
than it should. I consider that a fairly serious issue.
I'm afraid forgetting to mark the end of Intro with "Details:" would be
a common mistake, easy to miss in review. So I explored possible
alternatives:
Subject: Re: [PATCH v2 00/10] qapi: enforce section ordering
Date: Wed, 15 Apr 2026 11:43:45 +0200
Message-ID: <87zf341ru6.fsf@pond.sub.org>
https://lore.kernel.org/qemu-devel/87zf341ru6.fsf@pond.sub.org/
John is working towards "3. Make the end of intro syntactically obvious"
always, specifically "3c. Indent intro like descriptions and tagged
sections" with the ultimate goal to reject unindented Intro. That way,
we cannot write an Intro with an unclear end. John, correct me if I'm
accidentally misrepresenting your work.
Questions? Better ideas?
[...]
next prev parent reply other threads:[~2026-08-27 13:11 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 19:37 [PATCH v3 00/43] qapi: convert (very) trivial intro sections John Snow
2026-08-26 19:37 ` [PATCH v3 01/43] qapi: convert trivial intro sections for error.json John Snow
2026-08-27 8:43 ` Philippe Mathieu-Daudé
2026-08-27 9:10 ` Daniel P. Berrangé
2026-08-27 13:09 ` Markus Armbruster [this message]
2026-08-27 13:39 ` Daniel P. Berrangé
2026-08-26 19:37 ` [PATCH v3 02/43] qapi: convert trivial intro sections for acpi-hest.json John Snow
2026-08-26 19:38 ` [PATCH v3 03/43] qapi: convert trivial intro sections for ebpf.json John Snow
2026-08-26 19:38 ` [PATCH v3 04/43] qapi: convert trivial intro sections for compat.json John Snow
2026-08-26 19:38 ` [PATCH v3 05/43] qapi: convert trivial intro sections for vfio.json John Snow
2026-08-26 19:38 ` [PATCH v3 06/43] qapi: convert trivial intro sections for trace.json John Snow
2026-08-26 19:38 ` [PATCH v3 07/43] qapi: convert trivial intro sections for misc-arm.json John Snow
2026-08-26 19:38 ` [PATCH v3 08/43] qapi: convert trivial intro sections for cryptodev.json John Snow
2026-08-26 19:38 ` [PATCH v3 09/43] qapi: convert trivial intro sections for machine-common.json John Snow
2026-08-26 19:38 ` [PATCH v3 10/43] qapi: convert trivial intro sections for accelerator.json John Snow
2026-08-27 8:39 ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 11/43] qapi: convert trivial intro sections for authz.json John Snow
2026-08-26 19:38 ` [PATCH v3 12/43] qapi: convert trivial intro sections for yank.json John Snow
2026-08-26 19:38 ` [PATCH v3 13/43] qapi: convert trivial intro sections for replay.json John Snow
2026-08-26 19:38 ` [PATCH v3 14/43] qapi: convert trivial intro sections for machine-s390x.json John Snow
2026-08-26 19:38 ` [PATCH v3 15/43] qapi: convert trivial intro sections for acpi.json John Snow
2026-08-26 19:38 ` [PATCH v3 16/43] qapi: convert trivial intro sections for tpm.json John Snow
2026-08-26 19:38 ` [PATCH v3 17/43] qapi: convert trivial intro sections for qdev.json John Snow
2026-08-27 8:39 ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 18/43] qapi: convert trivial intro sections for control.json John Snow
2026-08-26 19:38 ` [PATCH v3 19/43] qapi: convert trivial intro sections for dump.json John Snow
2026-08-26 19:38 ` [PATCH v3 20/43] qapi: convert trivial intro sections for common.json John Snow
2026-08-26 19:38 ` [PATCH v3 21/43] qapi: convert trivial intro sections for sockets.json John Snow
2026-08-26 19:38 ` [PATCH v3 22/43] qapi: convert trivial intro sections for transaction.json John Snow
2026-08-26 19:38 ` [PATCH v3 23/43] qapi: convert trivial intro sections for stats.json John Snow
2026-08-26 19:38 ` [PATCH v3 24/43] qapi: convert trivial intro sections for job.json John Snow
2026-08-26 19:38 ` [PATCH v3 25/43] qapi: convert trivial intro sections for pci.json John Snow
2026-08-27 8:40 ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 26/43] qapi: convert trivial intro sections for introspect.json John Snow
2026-08-26 19:38 ` [PATCH v3 27/43] qapi: convert trivial intro sections for rocker.json John Snow
2026-08-26 19:38 ` [PATCH v3 28/43] qapi: convert trivial intro sections for misc-i386.json John Snow
2026-08-26 19:38 ` [PATCH v3 29/43] qapi: convert trivial intro sections for block-export.json John Snow
2026-08-26 19:38 ` [PATCH v3 30/43] qapi: convert trivial intro sections for audio.json John Snow
2026-08-26 19:38 ` [PATCH v3 31/43] qapi: convert trivial intro sections for block.json John Snow
2026-08-26 19:38 ` [PATCH v3 32/43] qapi: convert trivial intro sections for misc.json John Snow
2026-08-26 19:38 ` [PATCH v3 33/43] qapi: convert trivial intro sections for crypto.json John Snow
2026-08-26 19:38 ` [PATCH v3 34/43] qapi: convert trivial intro sections for cxl.json John Snow
2026-08-26 19:38 ` [PATCH v3 35/43] qapi: convert trivial intro sections for run-state.json John Snow
2026-08-27 8:41 ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 36/43] qapi: convert trivial intro sections for char.json John Snow
2026-08-26 19:38 ` [PATCH v3 37/43] qapi: convert trivial intro sections for virtio.json John Snow
2026-08-26 19:38 ` [PATCH v3 38/43] qapi: convert trivial intro sections for net.json John Snow
2026-08-26 19:38 ` [PATCH v3 39/43] qapi: convert trivial intro sections for qom.json John Snow
2026-08-27 8:42 ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 40/43] qapi: convert trivial intro sections for ui.json John Snow
2026-08-26 19:38 ` [PATCH v3 41/43] qapi: convert trivial intro sections for migration.json John Snow
2026-08-26 19:38 ` [PATCH v3 42/43] qapi: convert trivial intro sections for machine.json John Snow
2026-08-27 8:42 ` Philippe Mathieu-Daudé
2026-08-26 19:38 ` [PATCH v3 43/43] qapi: convert trivial intro sections for block-core.json John Snow
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=87jypb90c0.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=alex@shazbot.org \
--cc=anisinha@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=berrange@redhat.com \
--cc=clg@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=imammedo@redhat.com \
--cc=jasowangio@gmail.com \
--cc=jic23@kernel.org \
--cc=jiri@resnulli.us \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=laurent@vivier.eu \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=lukasstraub2@web.de \
--cc=marcandre.lureau@redhat.com \
--cc=mchehab+huawei@kernel.org \
--cc=mjt@tls.msk.ru \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
--cc=vsementsov@yandex-team.ru \
--cc=zhao1.liu@intel.com \
--cc=zhenwei.pi@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox