Received: from eggs.gnu.org ([2001:4830:134:3::10]:40108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5Wnf-0006uK-Tb for qemu-devel@nongnu.org; Fri, 11 Jul 2014 05:07:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5WnY-0006GA-Vw for qemu-devel@nongnu.org; Fri, 11 Jul 2014 05:07:27 -0400 Received: from oxygen.pond.sub.org ([144.76.244.19]:39324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5WnY-00069q-Px for qemu-devel@nongnu.org; Fri, 11 Jul 2014 05:07:20 -0400 From: Markus Armbruster References: <1405054738-18522-1-git-send-email-liangx.z.li@intel.com> Date: Fri, 11 Jul 2014 11:07:15 +0200 In-Reply-To: <1405054738-18522-1-git-send-email-liangx.z.li@intel.com> (Liliang's message of "Fri, 11 Jul 2014 12:58:58 +0800") Message-ID: <87oawwclh8.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] qemu-char: Fixed the bug lead to dead lock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liliang Cc: Paolo Bonzini , Fam Zheng , qemu-devel@nongnu.org, aliguori@amazon.com, Luiz Capitulino Cc'ing folks involved in the flawed commit. Liliang writes: > From: Li Liang > > This bug was introduced in the commit 9005b2a7589540a3733b3abdcfbccfe7746cd1a1, > it will cause deadlock when create a vm with the parameter "-monitor pty" and > then try to read from /dev/pts/x. > > Signed-off-by: Li Liang Long lines in commit message, and the subject isn't as informative as it could be. Suggest something like: qemu-char: Fix deadlock in pty character device To reproduce, run with "-monitor pty", then try to read from the slave /dev/pts/FOO created for it. Broken in commit 9005b2a. > --- > qemu-char.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/qemu-char.c b/qemu-char.c > index 55e372c..55cdded 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -1103,9 +1103,11 @@ static gboolean pty_chr_timer(gpointer opaque) > s->timer_tag = 0; > if (!s->connected) { > /* Next poll ... */ > + qemu_mutex_unlock(&chr->chr_write_lock); > pty_chr_update_read_handler_locked(chr); > + } else { > + qemu_mutex_unlock(&chr->chr_write_lock); > } > - qemu_mutex_unlock(&chr->chr_write_lock); > return FALSE; > }