From: Anthony Liguori <aliguori@us.ibm.com>
To: Lei Li <lilei@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>, stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [RFC PATCH 0/4] char: expose MemoryCharDriver to users and provide QMP interface
Date: Wed, 01 Aug 2012 16:39:28 -0500 [thread overview]
Message-ID: <87ipd2thpr.fsf@codemonkey.ws> (raw)
In-Reply-To: <1343814538-27591-1-git-send-email-lilei@linux.vnet.ibm.com>
Lei Li <lilei@linux.vnet.ibm.com> writes:
> This RFC series attempts to convert the MemCharDriver to use a circular
> buffer for input and output, expose it to users by introducing QMP commands
> memchar_write and memchar_read and via the command line like the other
> CharDriverStates.
>
> Serial ports in qemu always use CharDriverStates as there backends,
> Right now, all of our backends always try to write the data from the
> guest to a socket or file. The concern from OpenStack is that this could
> lead to unbounded disk space usage since they log the serial output.
> For more detail of the background info:
> https://bugs.launchpad.net/nova/+bug/832507
The other neat feature this could allow is an HMP "console" command that
allows you to temporarily connect to the serial console from within the
monitor. This could provide a cleaner approach to how we currently do
chardev muxing.
It also means you can interact with multiple chardevs via a single
monitor socket (or via the GDB monitor interface).
> So we want to use a circular buffer in QEMU instead, and then OpenStack
> can periodically read the buffer in QEMU and log it.
>
> The QMP commands introduced like:
>
> { 'command': 'memchar_write',
> 'data': {'chardev': 'str', 'size': 'int', 'data': 'str'} }
>
> { 'command': 'memchar_read',
> 'data': {'chardev': 'str', 'size': 'int'},
> 'returns': 'str' }
>
> Expose MemCharDriver via the command line like:
>
> qemu -chardev memchr,max-capacity=640k,id=foo -serial chardev:foo
>
> Note:
> This series is just a incomplete sketch and not completely tested which
> I am still struggling with, but I want to get this out ealier to have
> your suggestion. Please comment and let me know if this seems like the
> direction we should be headed, thanks!
>
> TODO:
> 1) Expose the MemCharDriver via the command line like the other
> CharDriverStates.
> 2) Wherther to add locking or notification mechanism.
Notification is an interesting topic. I thought a lot about it and I
believe that we should simply avoid notification for now.
When we introduce async commands, we could make the read command block
which I think is a lot nicer.
BTW, we should introduce options for the read and write command that
specifies behavior when the queue is full/empty. For instance,
..., '*control': 'CongestionControl' }
{ 'enum': 'CongestionControl', 'data': [ 'drop', 'block' ] }
We would default to control=drop which would result in reads returning
empty strings and writes dropping queued data.
OTOH, when we get sync commands, we would add the 'block' enum option
and then we could make the session block until data was available or the
queue had space available.
Regards,
Anthony Liguori
>
>
> Lei Li (4):
> qemu-char: Convert MemCharDriver to circular buffer
> monitor: Adjust qmp_human_monitor_command to new MemCharDriver
> QAPI: Introduce memchar_write QMP command
> QAPI: Introduce memchar_read QMP command
>
> monitor.c | 2 +-
> qapi-schema.json | 40 +++++++++++++++++
> qemu-char.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++--------
> qemu-char.h | 2 +-
> qmp-commands.hx | 60 ++++++++++++++++++++++++-
> 5 files changed, 212 insertions(+), 22 deletions(-)
prev parent reply other threads:[~2012-08-01 21:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-01 9:48 [Qemu-devel] [RFC PATCH 0/4] char: expose MemoryCharDriver to users and provide QMP interface Lei Li
2012-08-01 9:48 ` [Qemu-devel] [RFC PATCH 1/4] qemu-char: Convert MemCharDriver to circular buffer Lei Li
2012-08-01 21:30 ` Anthony Liguori
2012-08-06 10:57 ` Lei Li
2012-08-01 9:48 ` [Qemu-devel] [RFC PATCH 2/4] monitor: Adjust qmp_human_monitor_command to new MemCharDriver Lei Li
2012-08-01 9:48 ` [Qemu-devel] [RFC PATCH 3/4] qmp: Introduce memchar_write QMP command Lei Li
2012-08-01 15:50 ` Eric Blake
2012-08-01 21:33 ` Anthony Liguori
2012-08-01 9:48 ` [Qemu-devel] [RFC PATCH 4/4] qmp: Introduce memchar_read " Lei Li
2012-08-01 15:51 ` Eric Blake
2012-08-01 21:39 ` Anthony Liguori [this message]
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=87ipd2thpr.fsf@codemonkey.ws \
--to=aliguori@us.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=lilei@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).