From: Anthony Liguori <aliguori@us.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
Hans de Goede <hdegoede@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 03/12] char: introduce tx queue to enable Unix style flow control
Date: Thu, 04 Aug 2011 11:31:33 -0500 [thread overview]
Message-ID: <4E3AC965.3020600@us.ibm.com> (raw)
In-Reply-To: <4E3AC2F5.7050805@redhat.com>
On 08/04/2011 11:04 AM, Avi Kivity wrote:
> On 08/01/2011 05:23 PM, Anthony Liguori wrote:
>> The char layer tries very hard to avoid using an intermediate buffer. The
>> implication of this is that when the backend does a write(), the data
>> for that
>> write must be immediately passed to the front end.
>>
>> Flow control is needed to handle the likely event that the front end
>> is not
>> able to handle the data at this point in time. We implement flow control
>> today by allowing the front ends to register a polling function. The
>> polling
>> function returns non-zero when it is able to receive data.
>>
>> This works okay because most backends are tied to some sort of file
>> descriptor
>> and our main loop allows polling to be included with file descriptor
>> registration.
>>
>> This falls completely apart when dealing with the front end writing to
>> the
>> back end though because the front end (devices) don't have an obvious
>> place to
>> integrate polling.
>>
>> Short summary: we're broken by design. A way to fix this is to eliminate
>> polling entirely and use a Unix style flow control mechanism. This
>> involves
>> using an intermediate buffer and allowing registration of
>> notifications when
>> the buffer either has data in it (readability) or is not full
>> (writability).
>>
>
> If you don't have an obvious place to integrate polling, how do you poll
> for writability?
You poll by trying to write. If write fails, you can set a callback for
notification for when it becomes writable.
> Although, providing a reasonably sized buffer and blocking the vcpu when
> it's full is a lot better than what we have now.
This series won't block the vcpu. The devices can (and will) register
callbacks for when the pipe is writable again.
Regards,
Anthony Liguori
>
next prev parent reply other threads:[~2011-08-04 16:31 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 14:22 [Qemu-devel] [PATCH 00/12][RFC] char: add flow control and fix guest_[open|close] Anthony Liguori
2011-08-01 14:22 ` [Qemu-devel] [PATCH 01/12] char: rename qemu_chr_write() to qemu_chr_fe_write() Anthony Liguori
2011-08-04 16:00 ` Avi Kivity
2011-08-04 16:11 ` Anthony Liguori
2011-08-04 16:14 ` Avi Kivity
2011-08-04 16:17 ` Avi Kivity
2011-08-04 16:22 ` Anthony Liguori
2011-08-04 16:21 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 02/12] char: rename qemu_chr_[can_]read() to qemu_chr_be_[can_]write() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 03/12] char: introduce tx queue to enable Unix style flow control Anthony Liguori
2011-08-04 16:04 ` Avi Kivity
2011-08-04 16:31 ` Anthony Liguori [this message]
2011-08-01 14:23 ` [Qemu-devel] [PATCH 04/12] char: introduce backend tx queue Anthony Liguori
2011-08-01 15:33 ` Stefan Hajnoczi
2011-08-01 15:37 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 05/12] char: add read functions for backend and frontend Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 06/12] char: add an edge event API for the front ends Anthony Liguori
2011-08-01 15:39 ` Stefan Hajnoczi
2011-08-01 15:40 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 07/12] char: add backend edge notification interface Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 08/12] char: make monitor use new style interface Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 09/12] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 10/12] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 11/12] char: make all devices do qemu_chr_fe_open() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 12/12] char: enforce the use of qemu_chr_guest_open() Anthony Liguori
2011-08-01 15:38 ` Alon Levy
2011-08-01 15:39 ` Anthony Liguori
2011-08-01 16:04 ` [Qemu-devel] [PATCH 00/12][RFC] char: add flow control and fix guest_[open|close] Alon Levy
2011-08-01 16:13 ` Anthony Liguori
2011-08-01 17:42 ` Hans de Goede
2011-08-01 21:54 ` Blue Swirl
2011-08-01 22:47 ` Anthony Liguori
2011-08-04 6:45 ` Amit Shah
2011-08-04 13:11 ` Anthony Liguori
2011-08-04 14:46 ` 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=4E3AC965.3020600@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=avi@redhat.com \
--cc=hdegoede@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).