qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 03/12] char: introduce tx queue to enable Unix s


From: Anthony Liguori
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
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]