qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH v7 4/6] char: Add qemu_chr_write_nb() for nonblo


From: Gerd Hoffmann
Subject: [Qemu-devel] Re: [PATCH v7 4/6] char: Add qemu_chr_write_nb() for nonblocking writes
Date: Wed, 05 May 2010 20:40:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4

+ return s->chr_write_nb(s, buf, len);
+}

I really dislike the idea of adding another function for this.

Having a explicit function for non-blocking mode IMHO is much better. It makes things more clear when reading the code.

Previous approach was to check for O_NONBLOCK (extra syscall) and behave differently depending on whenever it is set or not (too much hidden magic).

Can you
explain why you need this functionality for virtio-console and why this
functionality isn't needed for everything else?

virtio-console is just the first user. 16550 emulation can use that too. With the blocking interface you'll stall the guest (sitting in the blocking write syscall) in case the outgoing pipe is full. With the non-blocking interface you can simply delay the "you can send more data" signal (update status register + raise IRQ) until you can actually accept more data. Meanwhile the guest can continue to run and do something else. Basically it allows to implement sane flow control.

cheers,
  Gerd





reply via email to

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