public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: "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>,
	danpb@redhat.com,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Alex Bennee" <alex.bennee@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>
Subject: Modern HMP (was: Call for GSoC internship project ideas)
Date: Thu, 22 Jan 2026 10:38:28 +0100	[thread overview]
Message-ID: <871pjigf6z.fsf_-_@pond.sub.org> (raw)
In-Reply-To: <CAMxuvaz8hm1dc6XdsbK99Ng5sOBNxwWg_-UJdBhyptwgUYjcrw@mail.gmail.com> ("Marc-André Lureau"'s message of "Wed, 14 Jan 2026 22:00:57 +0400")

Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Hi
>
> On Tue, Jan 6, 2026 at 1:47 AM Stefan Hajnoczi <stefanha@gmail.com> wrote:
>
>> Dear QEMU and KVM communities,
>> QEMU will apply for the Google Summer of Code internship
>> program again this year. Regular contributors can submit project
>> ideas that they'd like to mentor by replying to this email by
>> January 30th.

[...]

>> How to propose your idea
>> ------------------------------
>> Reply to this email with the following project idea template filled in:
>>
>
> Rather than replying to this mail, I sketched some ideas of things I have
> in mind on the wiki directly:

[...]

> https://wiki.qemu.org/Internships/ProjectIdeas/ModernHMP

[...]

Let's start the discussion with your nicely written Wiki page:

    === External HMP Implementation via QMP ===

    '''Summary:''' Implement a standalone HMP-compatible monitor as an
    external binary (Python or Rust) that communicates with QEMU
    exclusively through QMP, enabling future decoupling of the built-in
    HMP from QEMU core.

    QEMU provides two monitor interfaces:
    * '''QMP''' (QEMU Machine Protocol): A JSON-based machine-readable
      protocol for programmatic control
    * '''HMP''' (Human Monitor Protocol): A text-based interactive
      interface for human operators

    Currently, HMP is tightly integrated into QEMU, with commands
    defined in `hmp-commands.hx` and `hmp-commands-info.hx`. Most HMP
    commands already delegate to QMP internally (e.g., `hmp_quit()`
    calls `qmp_quit()`), but HMP parsing, formatting, and command
    dispatch are compiled into the QEMU binary.

Also line editing and completion.

Most HMP commands cleanly wrap around QMP command handlers such as
qmp_quit().  Wrapping them around QMP commands instead is a
straightforward problem.  I'm more concerned about HMP stuff that uses
other internal interfaces.  Replacing them may require new QMP
interfaces, or maybe a careful culling of inessential HMP features.
Known such stuff: completion does not wrap around QMP command handlers.
It is provided by the HMP core.

Risk: this can easily become the 10% that take the other 90% of the
time, or even the 5% that sink the project.

Risk: serious code duplication until we can get rid of built-in HMP.
Fine if the goal is to explore and learn by building a prototype, and we
simply throw away the prototype afterwards.

    This project aims to externalize HMP functionality, providing a
    standalone tool that offers the same user experience while
    communicating with QEMU purely through QMP.

Potential for a better editing experience, because our readline
reimplementation is lacking compared to the real thing.

    '''Add `CONFIG_HMP` build option''':
    * Create a new Meson configuration option to disable built-in HMP
    * Allow QEMU to be built without HMP
    * Facilitate testing of external HMP as a replacement

    '''Create an external HMP implementation''' in Python or Rust that:
    * Connects to QEMU via QMP socket
    * Parses HMP command syntax and translates to QMP calls
    * Formats QMP responses as human-readable HMP output
    * Supports command completion and help text

    '''Use `hmp-commands.hx` for code generation''':
    * Parse the existing `.hx` files to extract command definitions
    * Generate boilerplate code (command tables, argument parsing, help
      text)
    * Produce a report of implemented vs. unimplemented commands
    * Enable tracking of HMP/QMP parity

.hx is C source code with ReST snippets.  scripts/hxtool strips out the
ReST.  docs/sphinx/hxtool.py ignores the C source code, and processes
the ReST.  It works.  Not a fan.

If we succeed in replacing built-in HMP by an external one, and the
external one isn't written in C, then having C source code in .hx no
longer makes sense.  Parsing it will be wasted effort.  It may still
make sense initially.

    '''Identify and address QMP gaps''':
    * Audit all HMP commands for QMP equivalents

Also audit the HMP core.  Known problem: completion.

    * For critical missing commands, propose QAPI schema additions
    * Document commands that cannot be externalized
    * Provide patches or RFCs for missing QMP functionality

    '''Future Work''' (out of scope):

    * Seamless replacement of built-in HMP

    '''Links:'''
    * https://wiki.qemu.org/Documentation/QMP - QMP documentation
    * https://wiki.qemu.org/Features/QAPI - QAPI schema system
    * https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html - QMP
      reference
    * https://www.qemu.org/docs/master/system/monitor.html - HMP
      documentation

    '''Details:'''
    * Skill level: intermediate
    * Language: Python or Rust (student choice), with C for QMP gap
      patches
    
    * Mentor: Marc-André Lureau <marcandre.lureau@redhat.com> (elmarco
      on IRC)
    * Markus?

Makes sense.

    * Suggested by: Marc-André Lureau


  parent reply	other threads:[~2026-01-22  9:38 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   ` Markus Armbruster [this message]
2026-01-22 10:00     ` Modern HMP (was: Call for GSoC internship project ideas) 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
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=871pjigf6z.fsf_-_@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=danpb@redhat.com \
    --cc=deller@gmx.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