From patchwork Wed Jun 8 13:30:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 632276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rPqg12Yjxz9t3n for ; Wed, 8 Jun 2016 23:54:21 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b=J6hegTPX; dkim-atps=neutral Received: from localhost ([::1]:57130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdw3-0001A3-81 for incoming@patchwork.ozlabs.org; Wed, 08 Jun 2016 09:54:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZr-0004io-To for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZp-0005uj-Rw for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:22 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:32790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZp-0005uW-K0 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:21 -0400 Received: by mail-lf0-x234.google.com with SMTP id s64so5912834lfe.0 for ; Wed, 08 Jun 2016 06:31:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=23YrCO8mwGtpICo/r2g5raQ4I+Na6YLHbpxLz83DssI=; b=J6hegTPXmig3BjdTFoagpQTWrUJHEX4vqMEYWptrlNgDnEz+L+7JZ0ev31A4GATN9X spp3V5I5MHlE/7/pE8QERBbgYP6MDTf3aODIggTjwXDSdlJEhsaY1gbxTcMAnHZsjnHN eaufyp0S8f3EqOuyxhnRkOxYEszkWSTtph12s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=23YrCO8mwGtpICo/r2g5raQ4I+Na6YLHbpxLz83DssI=; b=RDN05BPptMgeW5Q+c9uPgHiswhrENLNH5rVv8y9jZ44DCaTG8QUFfZpPhNwRa0ftXY tepNSicfBfkJ3+FmcH8zMtOOrTEcCAVL327VzUDdex5DN2SRIfOcyeuzob7HMucEun9a c5kBbb8EwId5TBfpKReJ9wTZV+/BelcERSOuIi0kRKzn6si9PTCK2KA8DECRCCmRaLWV Mc94xYOq6eGzmLq5I7s/J5TaKoZf+KKrNHGXhWzPE7lO9Guw7Yq1aAWcH70BJO4QK/8F 3FDE/tAutowssTgARi2hTjXuXAPZ/N3kcoesppGF1CRTr4nmyROoAyQYZKz+mGnUItyh 5H2Q== X-Gm-Message-State: ALyK8tIeOJgqj59B49h8nIoClU2gB3GD5nPYmzH49doWwKyMLURvqJThFmh8v3fWmd3P4IF+ X-Received: by 10.25.147.83 with SMTP id v80mr4796797lfd.9.1465392680903; Wed, 08 Jun 2016 06:31:20 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.31.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:31:20 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:25 +0300 Message-Id: <014628a705bdaf31c09915c29e61f4088956564d.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::234 Subject: [Qemu-devel] [PULL 44/44] linux-user: In fork_end(), remove correct CPUs from CPU list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Signed-off-by: Riku Voipio --- 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;