qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 2/4] char: Add ability to provide a callback


From: Amit Shah
Subject: Re: [Qemu-devel] [PATCH v3 2/4] char: Add ability to provide a callback when write won't return -EAGAIN
Date: Tue, 20 Apr 2010 17:14:20 +0530
User-agent: Mutt/1.5.19 (2009-01-05)

On (Tue) Apr 20 2010 [13:32:18], Gerd Hoffmann wrote:
>>   static void tcp_chr_connect(void *opaque)
>>   {
>
>> +    chr->write_blocked = false;
>>       s->connected = 1;
>>       qemu_set_fd_handler2(s->fd, tcp_chr_read_poll,
>> -                         tcp_chr_read, NULL, chr);
>> +                         tcp_chr_read, tcp_chr_write_unblocked, chr);
>
> This is wrong.  You want register tcp_chr_write_unblocked only for the  
> chr->write_blocked == true (i.e. output buffers are full) case.  
> Otherwise qemu will burn cpu calling tcp_chr_write_unblocked.
>
> Yes, you'll have to call qemu_set_fd_handler2 each time write_blocked  
> changes state.

Agreed. That's coming in the next round when I make it generic enough
for all the backends to call the common code.

> Also implementing the whole logic at the individual chardev drivers  
> level feels somewhat wrong as it will identical for most (all?) unix  
> chardev drivers.

Yes, both these come together, I guess.

I sent out this series as a "feeler" to see if the approach was
acceptable.

Paul didn't reply to my reply addressing his concern, so I take that as
he's OK with the approach as well :-)

                Amit




reply via email to

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