From: Markus Armbruster <armbru@redhat.com>
To: "Dr. David Alan Gilbert" <dave@treblig.org>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Stefan Hajnoczi" <stefanha@gmail.com>,
qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>,
"Helge Deller" <deller@gmx.de>,
"Oliver Steffen" <osteffen@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Matias Ezequiel Vara Larsen" <mvaralar@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"German Maglione" <gmaglione@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Alex Bennee" <alex.bennee@linaro.org>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: Re: Modern HMP
Date: Wed, 04 Feb 2026 09:08:49 +0100 [thread overview]
Message-ID: <875x8d0w32.fsf@pond.sub.org> (raw)
In-Reply-To: <aX-boauFX2Ju7x8Z@gallifrey> (David Alan Gilbert's message of "Sun, 1 Feb 2026 18:29:53 +0000")
"Dr. David Alan Gilbert" <dave@treblig.org> writes:
> * Daniel P. Berrangé (berrange@redhat.com) wrote:
>> On Thu, Jan 22, 2026 at 12:47:47PM -0300, Fabiano Rosas wrote:
>> > One question I have is what exactly gets (eventually) removed from QEMU
>> > and what benefits we expect from it. Is it the entire "manual"
>> > interaction that's undesirable? Or just that to maintain HMP there is a
>> > certain amount of duplication? Or even the less-than-perfect
>> > readline/completion aspects?
>>
>> Over time we've been gradually separating our human targetted code from
>> our machine targetted code, whether that's command line argument parsing,
>> or monitor parsing. Maintaining two ways todo the same thing is always
>> going to be a maint burden, and in QEMU it has been especially burdensome
>> as they were parallel impls in many cases, rather than one being exclusively
>> built on top of the other.
>>
>> Even today we still get contributors sending patches which only impl
>> HMP code and not QMP code. Separating HMP fully from QMP so that it
>> was mandatory to create QMP first gets contributors going down the
>> right path, and should reduce the burden on maint.
>
> Having a separate HMP isn't a bad idea - but it does need some idea of
> how to make it easy for contributors to add stuff that's just for debug
> or for the dev. For HMP the bar is very low; if it's useful to the
> dev, why not (unless it's copying something that's already in the QMP interface
> in a different way); but although the x- stuff in theory lets
> you add something via QMP, in practice it's quite hard to get it through
> review without a lot of QMP design bikeshedding.
I think this description has become less accurate than it used to be :)
A long time ago, we started with "QMP is a stable, structured interface
for machines, HMP is a plain text interface for humans, and layered on
top of QMP." Layered on top means HMP commands wrap around QMP
commands. Ensures that QMP is obviously complete. Without such a
layering, we'd have to verify completeness by inspection. Impractical
given the size and complexity of the interfaces involved.
Trouble is there are things in HMP that make no sense in QMP. For
instance, HMP command 'cpu' sets the monitor's default CPU, which
certain HMP commands use. To wrap 'cpu' around a QMP command, we'd have
to drag the concept "default CPU" into QMP where it's not wanted.
So we retreated from "all", and permitted exceptions for commands that
make no sense in QMP.
We then found out the hard & expensive way that designing a QMP command
with its stable, structured interface is often a lot harder than
cobbling together an HMP command. It's not just avoidable social
problems ("bikeshedding"); designing stable interfaces is just hard.
Sometimes the extra effort is worthwhile. Sometimes it's not, e.g. when
all we really want is print something to aid a human with debugging.
So we retreated from "all" some more, and permitted exceptions for
commands meant exclusively for human use, typically debugging and
development aids.
This effectifely redefined the meaning of "complete": instead of "QMP
can do everything HMP can do and more", it's now "... except for certain
development and debugging aids and maybe other stuff".
To keep "maybe other stuff" under control, we required (and still
require) an *argument* for adding functionality just to HMP.
This turned out to be differently bothersome. Having to review HMP
changes for QMP bypasses is bothersome, and bound to miss things at
least occasionally. Having to ask for an argument is bothersome.
Constructing one is bothersome.
To reduce the bother, we retreated from another QMP ideal: the
structured interface. Permit QMP commands to return just text when the
command is meant just for humans. Such commands must be unstable.
Possible because we had retreated from "all of QMP is stable" meanwhile.
How does this work? Instead of adding an HMP-only command, add a QMP
command that returns QAPI type HumanReadableText, and a trivial HMP
command that wraps around it. Slightly more work, but no interface
design.
The QMP command addition is much more visible to the QAPI/QMP
maintainers than an HMP-only command would be. This helps avoid missing
things.
We still want an argument why a structured interface isn't needed. But
we can be much more lenient there: if it turns out to be needed, we can
just add it, and drop the unstructured interface. Remember, it's
unstable.
Hope this helps.
next prev parent reply other threads:[~2026-02-04 8:08 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 21:47 Call for GSoC internship project ideas Stefan Hajnoczi
2026-01-13 15:29 ` Peter Xu
2026-01-13 16:16 ` Stefan Hajnoczi
2026-01-13 16:30 ` Peter Xu
[not found] ` <CAMxuvaz8hm1dc6XdsbK99Ng5sOBNxwWg_-UJdBhyptwgUYjcrw@mail.gmail.com>
2026-01-14 19:26 ` Stefan Hajnoczi
2026-01-20 21:42 ` Stefan Hajnoczi
2026-01-20 21:50 ` Daniel P. Berrangé
2026-01-22 10:49 ` Thomas Huth
2026-01-22 10:14 ` Daniel P. Berrangé
2026-01-22 10:22 ` Marc-André Lureau
2026-01-22 10:39 ` Daniel P. Berrangé
2026-01-22 10:54 ` Peter Maydell
2026-01-22 10:57 ` Daniel P. Berrangé
2026-01-22 11:28 ` Marc-André Lureau
2026-01-22 11:40 ` Daniel P. Berrangé
2026-01-22 12:02 ` Alex Bennée
2026-01-22 15:46 ` Pierrick Bouvier
2026-01-23 8:44 ` Marc-André Lureau
2026-01-23 15:56 ` Pierrick Bouvier
2026-01-26 22:29 ` Stefan Hajnoczi
2026-01-27 8:34 ` Stefano Garzarella
2026-01-27 14:19 ` Stefan Hajnoczi
2026-01-22 10:43 ` Thomas Huth
2026-01-22 10:48 ` Daniel P. Berrangé
2026-01-22 11:05 ` Thomas Huth
2026-01-22 11:24 ` Daniel P. Berrangé
2026-01-22 11:58 ` Alex Bennée
2026-01-22 19:14 ` Stefan Hajnoczi
2026-01-22 11:55 ` Alex Bennée
2026-01-20 22:00 ` John Levon
2026-01-20 21:44 ` Stefan Hajnoczi
2026-01-22 9:38 ` Modern HMP (was: Call for GSoC internship project ideas) Markus Armbruster
2026-01-22 10:00 ` Daniel P. Berrangé
2026-01-22 12:07 ` Modern HMP Markus Armbruster
2026-01-22 12:21 ` Daniel P. Berrangé
2026-01-22 13:07 ` Markus Armbruster
2026-01-22 14:03 ` Daniel P. Berrangé
2026-01-22 15:47 ` Fabiano Rosas
2026-01-22 16:00 ` Daniel P. Berrangé
2026-01-27 11:17 ` Kevin Wolf
2026-02-01 18:29 ` Dr. David Alan Gilbert
2026-02-04 8:08 ` Markus Armbruster [this message]
2026-02-04 9:07 ` Daniel P. Berrangé
2026-02-04 9:44 ` Markus Armbruster
2026-02-05 1:15 ` Dr. David Alan Gilbert
2026-02-05 6:52 ` Markus Armbruster
2026-02-05 12:50 ` Dr. David Alan Gilbert
2026-01-27 9:27 ` Call for GSoC internship project ideas Matias Ezequiel Vara Larsen
2026-01-27 14:15 ` Stefan Hajnoczi
2026-01-29 10:46 ` COCONUT-SVSM project ideas for GSoC 2026 Jörg Rödel
2026-01-29 14:18 ` Stefan Hajnoczi
2026-02-04 13:24 ` Jörg Rödel
2026-02-04 16:12 ` Stefan Hajnoczi
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=875x8d0w32.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=dave@treblig.org \
--cc=deller@gmx.de \
--cc=farosas@suse.de \
--cc=gmaglione@redhat.com \
--cc=hreitz@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mvaralar@redhat.com \
--cc=osteffen@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=stefanha@gmail.com \
--cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox