Linux EDAC development
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org, "Ani Sinha" <anisinha@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Eric Blake" <eblake@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@mailo.com>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	linux-edac@vger.kernel.org, "Cleber Rosa" <crosa@redhat.com>
Subject: Re: [PATCH v3 09/16] qapi/docs: adjust stub member insertion algorithm
Date: Wed, 03 Jun 2026 13:27:32 +0200	[thread overview]
Message-ID: <87ecinkgnv.fsf@pond.sub.org> (raw)
In-Reply-To: <20260603032201.993015-10-jsnow@redhat.com> (John Snow's message of "Tue, 2 Jun 2026 23:21:54 -0400")

Quick first pass...

John Snow <jsnow@redhat.com> writes:

> A forthcoming patch removes the implicit PLAIN section that always
> starts a QAPIDoc section list. Further future changes begin converting
> "PLAIN" sections to "INTRO" sections. To accommodate this, the
> insertion algorithm that places stub and dummy members must be
> adjusted to cope with not only the finished state, but temporary
> intermediate states while the series is merged.

Perhaps:

  A forthcoming patch removes the implicit PLAIN section that always
  starts a QAPIDoc section list. Further future changes begin converting
  "PLAIN" sections to "INTRO" sections.

  This will affect the code that inserts "Not documented" descriptions
  for undocumented members ("stub sections") and the dummy section that
  marks the spot for "The members of ..." references.

  Adjust the algorithm to cope with not only the finished state, but
  temporary intermediate states while the series is merged.

> This algorithm can handle zero-or-more PLAIN *or* INTRO sections at
> the beginning of a QAPIDoc object, in contrast to the previous
> algorithm which assumed and relied upon there being always one PLAIN
> section at the beginning of every QAPIDoc section list.
>
> In other words: (PLAIN | INTRO)* <EverythingElse>
>
> This does not impact what the parser itself will actually produce. As
> of this patch, the parser will still always generate QAPIDoc section
> lists that start with precisely one PLAIN section (whether or not it
> is empty), followed by the remaining sections. Those remaining
> sections may or may not include additional PLAIN sections, but never
> two such sections contiguously as the parser will always treat that
> layout as one PLAIN section consisting of multiple paragraph(s).
>
> In other other words: This insertion algorithm is more lenient than
> the parser, but this is on purpose for flexibility mid-stream as we
> convert QAPI to using explicit introductory sections. The allowed
> order of sections will eventually become strictly enforced in the
> parser, which will in turn allow dramatic simplifications to the
> insertion algorithm. This only exists as transitory code until we are
> able to enforce that order.
>
> Fear not: the intermediate rest output before and after this patch

"ReST output"?

> are byte identical, so failing all else, we at least know it doesn't
> make anything worse.
>
> Lastly, because we have three places in the code that need to insert
> stub/dummy sections, we take the opportunity to consolidate this code
> to handle all three cases with one function. This winds up
> necessitating the qapidoc.py generator actually modify the section
> list to insert a "dummy" member that acts as a placeholder for "The
> members of ..." text. While it looks like a code smell to modify the
> caller's argument, it is ultimately safe because the QAPI Schema
> object is re-parsed and re-constructed in memory for each individual
> process that needs to operate on it. In other words, the Sphinx
> document generator already does have "its own copy" of the section
> lists, so it is "safe" to modify here without regards to other
> consumers of the QAPIDoc objects. It only *looks* like it smells
> bad. Ultimately, this code will also be removed once the inliner is
> merged, so it is only a temporary aesthetic issue regardless.

Such trickery, even when safe, risks making attentive readers go
"WAT?!?"  I find it tolerable only because we plan to replace it fairly
soon.

The code finding the spot to insert stub/dummy sections is more
complicated than it has any right to be, both before and after your
patch.  It reconstructs information the doc parser has, but doesn't pass
on in usable form.  Passing that info on would likely be simpler and
cleaner.  However, you tell me your inliner patches also simplify
things, and they already exist.  So let's go with those.

> That's my story and I'm sticking to it.
>
> Signed-off-by: John Snow <jsnow@redhat.com>


  reply	other threads:[~2026-06-03 11:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  3:21 [PATCH v3 00/16] qapi: add formal "intro" section John Snow
2026-06-03  3:21 ` [PATCH v3 01/16] python: temporarily restrict max mypy version John Snow
2026-06-03  3:21 ` [PATCH v3 02/16] tests/qapi: generate output in source order John Snow
2026-06-03  3:21 ` [PATCH v3 03/16] qapi/docs: remove unused QAPIDoc subsection members John Snow
2026-06-03  3:21 ` [PATCH v3 04/16] qapi/docs: add has_features property John Snow
2026-06-03  3:21 ` [PATCH v3 05/16] qapi/docs: make remaining subsection members "private" John Snow
2026-06-03  3:21 ` [PATCH v3 06/16] qapi/docs: fix comment phrasing John Snow
2026-06-03  3:21 ` [PATCH v3 07/16] qapi/docs: add "Intro" section John Snow
2026-06-03  3:21 ` [PATCH v3 08/16] qapi/parser: move _insert_near_kind() method John Snow
2026-06-03  3:21 ` [PATCH v3 09/16] qapi/docs: adjust stub member insertion algorithm John Snow
2026-06-03 11:27   ` Markus Armbruster [this message]
2026-06-03  3:21 ` [PATCH v3 10/16] qapi/docs: remove implicit Plain section John Snow
2026-06-03  3:21 ` [PATCH v3 11/16] qapi/docs: add rendering for INTRO sections John Snow
2026-06-03  3:21 ` [PATCH v3 12/16] qapi/docs: add "Intro" section parsing John Snow
2026-06-03  3:21 ` [PATCH v3 13/16] qapi: convert intro sections for accelerator.json John Snow
2026-06-03  3:21 ` [PATCH v3 14/16] qapi: convert intro sections for acpi-hest.json John Snow
2026-06-03  3:22 ` [PATCH v3 15/16] qapi: convert intro sections for acpi.json John Snow
2026-06-03  3:22 ` [PATCH v3 16/16] qapi: convert intro sections for audio.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=87ecinkgnv.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=crosa@redhat.com \
    --cc=eblake@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=philmd@mailo.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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