From: Anthony Liguori <anthony@codemonkey.ws>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu list <qemu-devel@nongnu.org>,
Luiz Capitulino <lcapitulino@redhat.com>,
agl@us.ibm.com, Amit Shah <amit.shah@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] Re: Should QMP be RPC to internal C interfaces?
Date: Mon, 30 Aug 2010 10:28:25 -0500 [thread overview]
Message-ID: <4C7BCE19.30206@codemonkey.ws> (raw)
In-Reply-To: <m3eidg2lwi.fsf_-_@blackfin.pond.sub.org>
On 08/30/2010 09:52 AM, Markus Armbruster wrote:
>> Because it's too easy to get it wrong in QEMU. Here's the rationale.
>>
>> If I can't trivially call a QMP function in C, then I'm not going to
>> use QMP functions within QEMU. I'm not going to create an embedded
>> JSON string just to call a function with three integer arguments.
>>
> Yes, an internal interface is better done in idiomatic C, not with JSON
> strings.
>
>
>> Yes, if we need to do that, we can create a C API that both the QMP
>> interface uses and we also use internally but why? All that does is
>> introduce the chance that the C API will have more features than the
>> QMP interface.
>>
> Why is that bad?
>
> Internal and external interfaces have very different tradeoffs.
>
> An internal interface should eschew backward compatibility and embrace
> change.
>
> An external interface needs to be stable, yet extensible.
>
Nope.
The internal interface should be the external interface.
Otherwise, the external interface is going to rot.
> It's therefore advisable to separate the two. Otherwise the internal
> interface gets bogged down with undue compatibility considerations
> (backward& forward), or the external interface suffers unnecessary
> churn.
>
> When we designed QMP, we took special care to make it support compatible
> evolution. We consciously made it a proper protocol, not RPC to
> internal C interfaces. Are you proposing we go back to square one and
> reargue the basics of QMP?
>
All the pretty JSON interfaces don't matter if we're not exposing a
useful API.
We're trying to do too much. We've been more or less completing
ignoring the problem of creating a useful API for users to consume.
We need to simplify. We simplify by reducing scope. Of the things that
are important, a useful API is more important than whether it maps to
your favorite dynamic language in an elegant way.
> No, the problem we suffer today is that we didn't design the external
> interface properly above the level of basic protocol. We took a
> shortcut and converted existing monitor commands. We've since
> discovered we don't like that approach.
>
> Instead of giving up on protocol design without even trying and just
> expose whatever internal interfaces strike us as useful via RPC, let's
> design the external interface properly.
>
What does that even mean? How do you describe the external interface
properly?
It's a hell of a lot simpler to design the external interface as a C
API, and then to implement the external interface as a C API. Why make
life harder than that?
>> I think it's a vitally important requirement that all future QMP
>> functions have direct mappings to a C interface.
>>
> Why?
>
So that we can consume those APIs within QEMU.
>> The long term goal
>> should be for that interface to be used by all of the command line
>> arguments, SDL, and the human monitor. If those things only relied on
>> a single API and we exposed that API via QMP, than we would have an
>> extremely useful interface.
>>
> Yes, command line, human monitor and QMP should use internal interfaces
> to do the real work, thus separate the real work neatly from
> interface-specific stuff like parsing text.
>
> No, that doesn't mean we should expose internal interfaces via RPC.
>
Having two interfaces guarantees failure. What's the separation between
internal and external? Is qdev internal or external?
Regards,
Anthony Liguori
next prev parent reply other threads:[~2010-08-30 15:28 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 5:27 [Qemu-devel] [PATCH v3 0/3] virtio-balloon: Don't wait indefinitely for guest response Amit Shah
2010-08-27 5:27 ` [Qemu-devel] [PATCH v3 1/3] balloon: Don't try fetching info if guest is unresponsive Amit Shah
2010-08-27 5:27 ` [Qemu-devel] [PATCH v3 2/3] qerror: Add a new MACHINE_STOPPED error message Amit Shah
2010-08-27 9:29 ` [Qemu-devel] " Daniel P. Berrange
2010-08-27 12:39 ` Anthony Liguori
2010-08-27 12:58 ` Daniel P. Berrange
2010-08-27 13:59 ` Markus Armbruster
2010-08-27 14:15 ` Luiz Capitulino
2010-08-27 14:59 ` Anthony Liguori
2010-08-27 15:33 ` Daniel P. Berrange
2010-08-27 15:45 ` Anthony Liguori
2010-08-27 16:08 ` Luiz Capitulino
2010-08-27 19:02 ` Anthony Liguori
2010-08-27 19:24 ` Luiz Capitulino
2010-08-27 19:37 ` Anthony Liguori
2010-08-27 20:58 ` Luiz Capitulino
2010-08-30 14:52 ` Should QMP be RPC to internal C interfaces? (was: [Qemu-devel] Re: [PATCH v3 2/3] qerror: Add a new MACHINE_STOPPED error message) Markus Armbruster
2010-08-30 15:28 ` Anthony Liguori [this message]
2010-08-30 15:38 ` [Qemu-devel] Re: Should QMP be RPC to internal C interfaces? Anthony Liguori
2010-08-30 16:16 ` Luiz Capitulino
2010-08-30 16:26 ` Anthony Liguori
2010-08-31 12:48 ` Markus Armbruster
2010-08-31 12:58 ` Luiz Capitulino
2010-08-31 13:05 ` Anthony Liguori
2010-08-31 8:47 ` Markus Armbruster
2010-08-31 13:03 ` Anthony Liguori
2010-08-28 0:52 ` [Qemu-devel] Re: [PATCH v3 2/3] qerror: Add a new MACHINE_STOPPED error message Amit Shah
2010-08-30 8:30 ` Markus Armbruster
2010-08-30 13:06 ` Anthony Liguori
2010-08-30 15:01 ` Markus Armbruster
2010-08-30 19:17 ` [Qemu-devel] [PATCH] Disable virtio-balloon memory stats interface Adam Litke
2010-08-31 3:42 ` [Qemu-devel] " Amit Shah
2010-09-08 10:57 ` Amit Shah
2010-08-27 5:27 ` [Qemu-devel] [PATCH v3 3/3] balloon: Don't try fetching info if machine is stopped Amit Shah
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=4C7BCE19.30206@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=agl@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@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).