qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Avi Kivity <avi@redhat.com>, Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] RFC: Monitor high-level design
Date: Tue, 21 Sep 2010 15:46:46 -0300	[thread overview]
Message-ID: <20100921154646.76ad2626@doriath> (raw)

Hi there,

I was working on a detailed writeup about monitor's internals so that I could
get some guidance regarding monitor's internal design, but after today's call
I realized that we should discuss the general design first.

I think we have two options: the first (and better known) is to make HMP
(the human monitor) a QMP client. The other option would be to make QMP and
HMP monitor implementations.

Below I try to introduce both ideas, showing advantages and potential problems.
I've also tried drawing some nice diagrams. Please, be polite and appreciate
them whether you agree or not :-)

 1. HMP as a QMP client

    Very briefly, QMP would export a function called qmp_command(), which would
    be called by HMP handlers. This has been proposed by Anthony and a
    detailed description can be found at:

        http://wiki.qemu.org/Features/QMP_0.14#Potential_Solutions

    When fully implemented, I think it would look like this:

                    |-----|
                    | HMP |
                    |-----|
                      /  \
                     /    \
                 |-----|   \
                 | QMP |    \
                 |-----|     \
                    |         \
                    |          \
               |---------|  |---------|
               | chardev |  | chardev |
               |---------|  |---------|

     HMP will need to handle its own chardev, so that it's able to output
     data to the user (and I guess command completion needs it too).

     However, it's important to notice that HMP won't be using QMP's chardev
     in any way. It's only there to show that QMP and HMP will handle their
     own chardevs.

    Advantages:

       - QMP's interface is also used (and thus tested) internally
       - In theory HMP can be moved outside of QEMU

    Disadvantages/problems:

       - What to do with handlers that make no sense in QMP, like print,
         sum, etc?
       - Having QMP and HMP using different chardevs, probably means that we
         won't be share coding as much as possible
       - Isn't HMP pasthrough via QMP going to break this design? I think it
         will, because QMP will have to make a sort of HMP call too

 2. QMP and HMP as monitor implementations

    In this design we have to define an internal monitor API, something like
    struct monitor_ops. Which is implemented by both, QMP and HMP. Common
    monitor code is moved behind this API, making QMP and HMP implementation
    simpler. Also allows to have new kinds of Monitors.

    Drawing:

              |-----|    |-----|
              | QMP |    | HMP |
              |-----|    |-----|
                \           /
                 \         /
                  \       /
                   \     /
              |----------------|
              | monitor common |
              |----------------|
                      |
                      |
                      |
              |---------------|
              | char devices  |
              |---------------|

   There's a small lie there: HMP will have to make QMP calls with qmp_command()
   which doesn't make those modules totally isolated. But I believe this could
   be done via monitor common someway.

   Advantages:

       - We can take coding sharing to the limit, even allowing the creation
         of new, idepedent monitors
       - We can have HMP-only handlers (like print, sum, etc)

   Disadvantages:

       - HMP calls to QMP will break a bit the design
       - HMP passthrough makes things ugly again, because we'll have each
         module talking to each other
       - HMP can't be moved outside of QEMU, if we want that we'd have to
         write a new Monitor client (potentially in a different language,
         which is actually good)
       - Not sure if HMP features like command completion will perfectly fit

             reply	other threads:[~2010-09-21 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 18:46 Luiz Capitulino [this message]
2010-09-21 19:08 ` [Qemu-devel] Re: RFC: Monitor high-level design Anthony Liguori
2010-09-22 12:32 ` [Qemu-devel] " Markus Armbruster
2010-09-22 13:18   ` Anthony Liguori
2010-09-22 15:03     ` Luiz Capitulino
2010-09-22 15:39       ` Anthony Liguori

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=20100921154646.76ad2626@doriath \
    --to=lcapitulino@redhat.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).