[Libvir] [PATCH] lxc: loop in tty forwarding process

Dave Leskovec dlesko at linux.vnet.ibm.com
Tue May 6 07:51:08 UTC 2008


This patch changes the lxc tty forwarding process to use epoll instead of poll.
 This is done to avoid a cpu consuming loop when a user disconnects from the
container console.

During some testing, we found that when the slave end of a tty is closed, calls
to poll() on the master end will return immediately with POLLHUP until the slave
end is opened again.  The result of this is that if you connect to the container
console using virsh and then ctrl-] out of it, the container tty process will
chew up the processor handling POLLHUP.  This event can't be disabled regardless
of what is set in the events field.

This can be avoided by using epoll.  When used in edge triggered mode, you see
the initial EPOLLHUP but will not see another one until someone connects and
then disconnects from the console again.  This also drove some changes into how
the regular input data is handled.  Once an EPOLLIN is seen from an fd, another
one will not be surfaced until all data has been read from the file (EAGAIN is
returned by read).

-- 
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lxc_pollhup.patch
Type: text/x-patch
Size: 7639 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080506/14243be4/attachment-0001.bin>


More information about the libvir-list mailing list