[Top][All Lists]

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

Re: [Qemu-devel] [PATCH 2/3] Always use nonblocking mode for qemu_chr_op

From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 2/3] Always use nonblocking mode for qemu_chr_open_fd.
Date: Fri, 25 Jul 2008 09:15:15 +0200
User-agent: Thunderbird (X11/20080501)

Paul Brook wrote:
> On Wednesday 23 July 2008, Gerd Hoffmann wrote:
>> Anthony Liguori wrote:
>>> Gerd Hoffmann wrote:
>>>> Comments on this one?
>>> Checking every 100ms for every pty device really makes me cringe.
>> Only when unconnected, and the interval can be changed.
>> And I'm certainly open for better ideas ...
> Anything that requires periodic polling is almost certainly wrong.
> If it's unconnected then why do we need to poll at all? If we're discarding 
> data then we aren't going to retry, so it should be sufficient to check 
> whenever we send data.

Fundamental problem is there is no easy way to figure whenever we are
connected or not.  Well, detecting the "connected -> disconnected"
transition is easy, as read() starts giving us -EIO then.  The
problematic case is the "(initial state | disconnected) ->
(re-)connected" transition.  We have to try read() now and then to check
whenever we still get -EIO or not.

Doing the read() check in the write path is an good idea.  Alone it
still doesn't solve the problem because we would depend on the guest
writing stuff to the serial line to detect a (re-)connect then.  But it
 makes large poll intervalls suck less.  I'll go send an updated patch
later today.



reply via email to

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