From patchwork Wed Oct 19 17:21:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 78315 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp363197qge; Wed, 19 Oct 2016 10:29:26 -0700 (PDT) X-Received: by 10.55.220.131 with SMTP id v125mr7203031qki.307.1476898166640; Wed, 19 Oct 2016 10:29:26 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u24si25001129qtc.60.2016.10.19.10.29.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 19 Oct 2016 10:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:49930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwug9-0004AZ-7V for patch@linaro.org; Wed, 19 Oct 2016 13:29:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwuZk-0006Uf-42 for qemu-devel@nongnu.org; Wed, 19 Oct 2016 13:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwuZj-0002uY-4f for qemu-devel@nongnu.org; Wed, 19 Oct 2016 13:22:48 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwuZi-0002tz-Ui for qemu-devel@nongnu.org; Wed, 19 Oct 2016 13:22:47 -0400 Received: by mail-qk0-x243.google.com with SMTP id f128so2487275qkb.0 for ; Wed, 19 Oct 2016 10:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kXm6ReYyTeGQL/pF4/257DAIQ1pGiyGFcIKDTwX0O/U=; b=mqem8yeka5i5pkX2nvIRZ229omdrWFX0YmiY1b50ceNSEZhAjG4OJQz+9O9sGJWDin zZkhg0PsEnUs3BbrbCryY0FfU9G62CXPF47/iADpQt/Dhfzj51YV0SKs/sUM8dJdbHAD UWZTrGBth+SOl+c9T1zTQJrbZrXivPQn3HjFjsS/1tqas+OpTbYH/+8YQnO9C7XUd8pV N7RE2xupyQFenOcF9xQl3c0/9znBa8Qzv8814CusjtwXzI2yIrG0/BV8AIDKVcoBcsAW iDOiUi4p7SR6oG0ngeycAUBeGHrB90DukT6sgzd4qNT1zVRO0WnDzkvxfj//mZu6HrNq k3Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kXm6ReYyTeGQL/pF4/257DAIQ1pGiyGFcIKDTwX0O/U=; b=dbo1b8V8qppAGJ0NXTyYaGv5WeiFEONodD1G1Xmt3UbADf9DrVI7EBLp6/tut/BZj8 9a2rjrRshbEYyibta5oi8NG7x0kwet+gllueUQ/e1BwSaOtQH6UhoE9JHYOcNbyuS0uF YYLC7B+FZtRdHgoJoPOcarrP4cfzGVSUZWEEQwUnmRz7hQhAxqTNQJDv2A9uwUWT4tf8 VhYaniS0ebLFaG7zLR/XjWj00UFGqiJ9rK60evoQ7oOaito/T7eXkJl4/Wcbfo3UbisD fXO515gIZT+C1mrK6zqm+1pKqQTlEJHlw48X81u3pSgtVr6cSgGtkpMf7Su/eBh+NsQg 7k1w== X-Gm-Message-State: ABUngvdNvYQSQr4IGdIPKML13pu/WkK+FMi/dLulx7lPr8QWPel8H5YgaqOV1Q9MseHddw== X-Received: by 10.55.198.132 with SMTP id s4mr4910651qkl.221.1476897766037; Wed, 19 Oct 2016 10:22:46 -0700 (PDT) Received: from bigtime.com (174-24-157-40.tukw.qwest.net. [174.24.157.40]) by smtp.gmail.com with ESMTPSA id 16sm18357530qtf.36.2016.10.19.10.22.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 10:22:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 19 Oct 2016 10:21:39 -0700 Message-Id: <1476897727-791-8-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476897727-791-1-git-send-email-rth@twiddle.net> References: <1476897727-791-1-git-send-email-rth@twiddle.net> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH v7 07/35] linux-user: enable parallel code generation on clone 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: cota@braap.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée The variable parallel_cpus controls the generation of thread aware atomic code. We only need to set it once we clone our first thread. At this point any existing translations need to be thrown away. Reviewed-by: Emilio G. Cota Signed-off-by: Alex Bennée Signed-off-by: Richard Henderson --- linux-user/syscall.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 03339ba..52740b7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6144,6 +6144,14 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, sigfillset(&sigmask); sigprocmask(SIG_BLOCK, &sigmask, &info.sigmask); + /* If this is our first additional thread, we need to ensure we + * generate code for parallel execution and flush old translations. + */ + if (!parallel_cpus) { + parallel_cpus = true; + tb_flush(cpu); + } + ret = pthread_create(&info.thread, &attr, clone_func, &info); /* TODO: Free new CPU state if thread creation failed. */