From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ld8iG-0005M6-QO for qemu-devel@nongnu.org; Fri, 27 Feb 2009 14:49:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ld8iE-0005JQ-Hr for qemu-devel@nongnu.org; Fri, 27 Feb 2009 14:49:35 -0500 Received: from [199.232.76.173] (port=33115 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ld8iE-0005JF-9J for qemu-devel@nongnu.org; Fri, 27 Feb 2009 14:49:34 -0500 Received: from e6.ny.us.ibm.com ([32.97.182.146]:35579) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ld8iD-00058u-TF for qemu-devel@nongnu.org; Fri, 27 Feb 2009 14:49:34 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e6.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n1RJoVrs032248 for ; Fri, 27 Feb 2009 14:50:31 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n1RJnWZv193186 for ; Fri, 27 Feb 2009 14:49:32 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n1RJnWhc023009 for ; Fri, 27 Feb 2009 14:49:32 -0500 Message-ID: <49A843CA.2050500@us.ibm.com> Date: Fri, 27 Feb 2009 13:49:30 -0600 From: Anthony Liguori MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] Fix freezing bug in curses console Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Matthew Bloch Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Matthew Bloch wrote: > Hi there, > > We are running lots of kvm processes in screen and found that about 1 in > 5 froze shortly after startup startup with a backtrace like this one: > > #0 0xf7c7fcd9 in pthread_exit () from /lib/tls/libc.so.6 > #1 0xf7cfbe62 in wresize () from /lib/libncurses.so.5 > #2 0xf7cfb7ab in is_term_resized () from /lib/libncurses.so.5 > #3 0xf7cfb877 in is_term_resized () from /lib/libncurses.so.5 > #4 0xf7cfba31 in resize_term () from /lib/libncurses.so.5 > #5 0x080d3dd9 in vga_init () > #6 > #7 0xf7c0da5b in free () from /lib/tls/libc.so.6 > #8 0xf7c0effe in calloc () from /lib/tls/libc.so.6 > #9 0xf7cf222e in newpad () from /lib/libncurses.so.5 > #10 0x080d3549 in vga_init () > > We're just using the lenny version of kvm from 2008-12-16. > > On casual inspection, the SIGWINCH signal handling looked ropey to me - > grandpa always told me not to do any real work in a signal handler, and > the backtrace suggested re-entrancy problems in curses, so I changed the > behaviour to set a flag and do the work in the main loop instead. Maybe > I'm reading the backtrace wrong. > > So far that means that when you resize the window, the display is > corrupt until the VM outputs some text, or the user hits a key. But I > think it has solved the freezing / crashing bug too - would appreciate > any comments on my analysis or proposed solution. > It's racy with select(). A better fix would be to create a pipe and write to that pipe in the SIGWINCH handler. You should then register an io callback using qemu_set_fd_handler2() that does the actions for SIGWINCH. Regards, Anthony Liguori