From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQDL7-0001yN-F9 for qemu-devel@nongnu.org; Thu, 11 Apr 2013 04:58:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQDL6-0005Ph-Df for qemu-devel@nongnu.org; Thu, 11 Apr 2013 04:58:41 -0400 Received: from mail-qc0-x235.google.com ([2607:f8b0:400d:c01::235]:64511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQDL6-0005PW-9z for qemu-devel@nongnu.org; Thu, 11 Apr 2013 04:58:40 -0400 Received: by mail-qc0-f181.google.com with SMTP id a22so591274qcs.40 for ; Thu, 11 Apr 2013 01:58:39 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51667B36.9020107@redhat.com> Date: Thu, 11 Apr 2013 10:58:30 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1365600207-21685-1-git-send-email-pbonzini@redhat.com> <20130410175934.GA5213@amit.redhat.com> In-Reply-To: <20130410175934.GA5213@amit.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: Amit Shah Cc: Hans de Goede , aliguori@us.ibm.com, qemu-devel@nongnu.org Il 10/04/2013 19:59, Amit Shah ha scritto: > On (Wed) 10 Apr 2013 [15:23:27], 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. > > This patch doesn't apply directly to master, applies with some fuzz. > However, this patch causes qemu freeze. My testcase is: > > Open chardev on host > Write something to a virtserialport in guest > Close chardev on host > Keep writing to virtserialport in guest > > When I apply the patch to the old qemu version with select, that > starts working fine with the testcase above. I cannot replicate the freeze. The patch works on both old and new versions of QEMU. My testcases are: 1) on host, nc -l -p 12345 on host, start qemu in guest, cat > /dev/vport0p1 in guest, write something on host, close nc in guest, write something in guest, ^D and poweroff 2) on host, nc -l -p 12345 on host, start qemu in guest, echo abc > /dev/vport0p1 on host, close nc in guest, echo abc > /dev/vport0p1 in guest, poweroff > There's a slight difference in my old qemu tree, I have Hans's > "virtio-console: Remove any pending watches on close" patch applied, > which makes use of the tag obtained on adding the watch. That patch > hasn't found its way to master yet, but it should go in soon. I don't have that patch in my (new) tree. It's vanilla upstream QEMU. Paolo