From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAJuO-0007jA-KI for qemu-devel@nongnu.org; Tue, 07 Jun 2016 12:31:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAJuM-0006Xe-Fo for qemu-devel@nongnu.org; Tue, 07 Jun 2016 12:31:15 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAJuM-0006UU-8k for qemu-devel@nongnu.org; Tue, 07 Jun 2016 12:31:14 -0400 From: Peter Maydell Date: Tue, 7 Jun 2016 17:31:04 +0100 Message-Id: <1465317064-26781-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] linux-user: In fork_end(), remove correct CPUs from CPU list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Laurent Vivier In fork_end(), we must fix the list of current CPUs to match the fact that the child of the fork has only one thread. Unfortunately we were removing the wrong CPUs from the list, which meant that if the child subsequently did an exclusive operation it would deadlock in start_exclusive() waiting for a sibling CPU which didn't exist. In particular this could cause hangs doing git submodule init operations, as reported in https://bugs.launchpad.net/qemu/+bug/955379 comment #47. Signed-off-by: Peter Maydell --- linux-user/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index b6da0ba..150a356 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -130,7 +130,7 @@ void fork_end(int child) Discard information about the parent threads. */ CPU_FOREACH_SAFE(cpu, next_cpu) { if (cpu != thread_cpu) { - QTAILQ_REMOVE(&cpus, thread_cpu, node); + QTAILQ_REMOVE(&cpus, cpu, node); } } pending_cpus = 0; -- 1.9.1