From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US1z3-0006OB-Fx for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:15:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US1yy-0006dv-6P for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:15:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US1yx-0006dm-U0 for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:15:20 -0400 Message-ID: <516D16A4.2030105@redhat.com> Date: Tue, 16 Apr 2013 11:15:16 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1365600207-21685-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1365600207-21685-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-char: another io_add_watch_poll fix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: amit.shah@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org On 04/10/13 15:23, Paolo Bonzini wrote: > After attaching the source, we have to remove the reference we hold > to it, because we do not hold anymore a pointer to the source. > > If we do not do this, removing the source will not finalize it and > will not drop the "real" I/O watch source. > > This showed up when backporting the new flow control patches to older > versions of QEMU that still used select. The whole select then failed > with EBADF (poll instead will reporting POLLNVAL on a single pollfd) > and QEMU froze. I get freezes now in master, bisecting points to this patch. Reproducer: "qemu -serial pty". qemu is pretty much unusable with libvirt now as libvirt uses pty chardevs by default for serial & monitor ... (gdb) bt #0 __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136 #1 0x00007f4141ce7388 in _L_lock_854 () from /lib64/libpthread.so.0 #2 0x00007f4141ce7257 in __pthread_mutex_lock (mutex=0x7f4145639128) at pthread_mutex_lock.c:61 #3 0x00007f4142f41c37 in ?? () from /lib64/libglib-2.0.so.0 #4 0x00007f41439ff1b1 in io_watch_poll_finalize (source=) at /home/kraxel/projects/qemu/qemu-char.c:647 #5 0x00007f4142f4182a in ?? () from /lib64/libglib-2.0.so.0 #6 0x00007f4142f41b85 in ?? () from /lib64/libglib-2.0.so.0 #7 0x00007f4142f4416e in g_source_remove () from /lib64/libglib-2.0.so.0 #8 0x00007f4143a02f38 in pty_chr_state (chr=0x7f4145644b70, connected=) at /home/kraxel/projects/qemu/qemu-char.c:1151 #9 0x00007f4143a0303c in pty_chr_read (chan=, cond=, opaque=0x7f4145644b70) at /home/kraxel/projects/qemu/qemu-char.c:1116 #10 0x00007f4142f41f0e in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #11 0x00007f41439d8259 in glib_pollfds_poll (nonblocking=) at /home/kraxel/projects/qemu/main-loop.c:187 #12 os_host_main_loop_wait (nonblocking=) at /home/kraxel/projects/qemu/main-loop.c:232 #13 main_loop_wait (nonblocking=) at /home/kraxel/projects/qemu/main-loop.c:468 #14 0x00007f4143a4f055 in main_loop (argc=, argv=, envp=) at /home/kraxel/projects/qemu/vl.c:2039 #15 main (argc=, argv=, envp=) at /home/kraxel/projects/qemu/vl.c:4432 cheers, Gerd