From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRPd5-0000ou-Ql for qemu-devel@nongnu.org; Fri, 27 Feb 2015 13:27:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YRPd4-00048h-M1 for qemu-devel@nongnu.org; Fri, 27 Feb 2015 13:27:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YRPd4-00048T-EX for qemu-devel@nongnu.org; Fri, 27 Feb 2015 13:27:14 -0500 Message-ID: <54F0B6F7.3090703@redhat.com> Date: Fri, 27 Feb 2015 19:27:03 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1424110682-14334-1-git-send-email-pbonzini@redhat.com> <1424110682-14334-9-git-send-email-pbonzini@redhat.com> <54EE0352.4020700@imgtec.com> <54EF0504.6070401@redhat.com> <54EF224A.8090609@imgtec.com> <54EF303D.6030402@redhat.com> <54EF30AD.9040302@redhat.com> <54EF425A.8010204@imgtec.com> <1644893486.26759341.1424978182441.JavaMail.zimbra@zmail13.collab.prod.int.phx2.redhat.com> <54F03A7D.90401@imgtec.com> <54F06E59.2080609@redhat.com> <54F07E28.6090004@imgtec.com> In-Reply-To: <54F07E28.6090004@imgtec.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PULL 08/21] rcu: run RCU callbacks under the BQL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leon Alrae , qemu-devel On 27/02/2015 15:24, Leon Alrae wrote: > On 27/02/2015 13:17, Paolo Bonzini wrote: >> Can you test this patch? (On top of the previous one). > > With this change the system doesn't boot at all I'm afraid. Hmm, it works for me and fixes the deadlock with Aurelien's images. Just to be clear, this is the patch I'm testing on top of origin/master: diff --git a/cpus.c b/cpus.c index 1cd9867..83c078e 100644 --- a/cpus.c +++ b/cpus.c @@ -778,7 +778,7 @@ static void qemu_tcg_init_cpu_signals(void) static QemuMutex qemu_global_mutex; static QemuCond qemu_io_proceeded_cond; -static bool iothread_requesting_mutex; +static unsigned iothread_requesting_mutex; static QemuThread io_thread; @@ -1115,15 +1115,15 @@ bool qemu_in_vcpu_thread(void) void qemu_mutex_lock_iothread(void) { - if (!tcg_enabled()) { + if (!tcg_enabled() || !first_cpu) { qemu_mutex_lock(&qemu_global_mutex); } else { - iothread_requesting_mutex = true; + atomic_inc(&iothread_requesting_mutex); if (qemu_mutex_trylock(&qemu_global_mutex)) { qemu_cpu_kick_thread(first_cpu); qemu_mutex_lock(&qemu_global_mutex); } - iothread_requesting_mutex = false; + atomic_dec(&iothread_requesting_mutex); qemu_cond_broadcast(&qemu_io_proceeded_cond); } } I couldn't reproduce it with stress, but a reboot loop finally triggered it on Aurelien's images. Interestingly, the bug has been there forever but was only triggered in relatively weird cases such as TCG+migration. My patch just made it much more visible. Paolo > > BTW I managed to reproduce the original problem using Aurel's Debian > images. Could you try and see if you can reproduce the problem as well? > > Images: > $ wget https://people.debian.org/~aurel32/qemu/mips/vmlinux-3.2.0-4-4kc-malta > $ wget https://people.debian.org/~aurel32/qemu/mips/debian_squeeze_mips_standard.qcow2 > > Run: > $ qemu-system-mips -M malta -kernel vmlinux-3.2.0-4-4kc-malta -hda > debian_squeeze_mips_standard.qcow2 -append "root=/dev/sda1 > console=ttyS0" -snapshot -nographic > > debian-mips login: root > password: root > root@debian-mips:~# apt-get install stress > > (and now try to stress a few times, usually after 2 or 3 times QEMU freezes) > > root@debian-mips:~# stress --timeout 15s --cpu 4 --io 2 --vm 2 --vm-bytes 1M