From patchwork Sun Oct 9 23:41:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 77421 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1009223qge; Sun, 9 Oct 2016 16:53:58 -0700 (PDT) X-Received: by 10.55.175.1 with SMTP id y1mr28102318qke.150.1476057238671; Sun, 09 Oct 2016 16:53:58 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c62si1655913qkb.153.2016.10.09.16.53.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 09 Oct 2016 16:53:58 -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]:46384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btNuo-00023L-4V for patch@linaro.org; Sun, 09 Oct 2016 19:53:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btNjz-0001m5-5u for qemu-devel@nongnu.org; Sun, 09 Oct 2016 19:42:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btNju-0000Cr-Tu for qemu-devel@nongnu.org; Sun, 09 Oct 2016 19:42:46 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:34516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btNju-0000CZ-PU for qemu-devel@nongnu.org; Sun, 09 Oct 2016 19:42:42 -0400 Received: by mail-qk0-x242.google.com with SMTP id n189so5672525qke.1 for ; Sun, 09 Oct 2016 16:42:42 -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=Q3eGP46/+mDEIoZynkd78mMjxgGZBdjX70GHoaDgpwA=; b=F3uAzgNo07E194X2qFvD7/QKVu0FyMh+zK8voxTzCCs3tUiJwStvIlftI9uOopI804 yMJ+bsFZz7aGCgUreE0VbvwESCO4b5Ad6xE/8dyniFXxQchAAidx1EYQWUk+X2mWvPse t4hELykJrpt+SPOnTXQoCw14x01Xcdrw3gmZRB1AFE7UELHhZWbkXb+W/NJZeA5N7Xnz P2rYwSwosJA3juM4JWRphLAsbrVGXPTt+Gx6v+vZwarqAwAaU1nBTkhpn6VdIQe8DQbC qnzRS9LDYAx3kYVsxIX+hqG22kYi7wUAuMWqn0i1Tuqf4NCPnBznNVaNYIx9k+SBWX+O rFSw== 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=Q3eGP46/+mDEIoZynkd78mMjxgGZBdjX70GHoaDgpwA=; b=TRxO9xhMqHqiqt2szXKM8dIFlTqHdbHz2S4Z/ng5ibl3uhEAMIbl5DFcyy1dJZPX7s GBXao/OZyghCZB8vTYOf3h2h/FK7DUK4lDBdZZds0ZAPeImY8IUTztz/AUeKw13+loUc 7O93LhNiNUwKed9e79qrWDD11eBpRtEHuwBmTcADQSLQT0Z9xxgmHAsPf03XXjO4rZGp hj+ZqilEC2CBdldzEqqTMowV9/kxBL7uvfPdx0Su6l+C5Hq61Pfk6DOdbmjKcCRhgW1w T1cxQgRnojwKrEiNEUmIpOEZonLQg9lkEC1ol8XDrswBM9mPoJUs6mnnK7alQTTpHqEl HBqQ== X-Gm-Message-State: AA6/9RkWYWposRMtFcBDEnQez5LygKgZdCUlKbA6eax2oFX4c9FYhE8gmE1LiT94HStoqQ== X-Received: by 10.55.48.10 with SMTP id w10mr28829800qkw.43.1476056562405; Sun, 09 Oct 2016 16:42:42 -0700 (PDT) Received: from bigtime.com ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id g63sm10741172qkf.47.2016.10.09.16.42.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Oct 2016 16:42:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 9 Oct 2016 18:41:38 -0500 Message-Id: <1476056526-30740-8-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476056526-30740-1-git-send-email-rth@twiddle.net> References: <1476056526-30740-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::242 Subject: [Qemu-devel] [PATCH v5 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: 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. 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 0815f30..9d528bd 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. */