From patchwork Tue Oct 11 19:40:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 77523 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp155585qge; Tue, 11 Oct 2016 12:48:16 -0700 (PDT) X-Received: by 10.55.26.17 with SMTP id a17mr4516957qka.250.1476215296791; Tue, 11 Oct 2016 12:48:16 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t15si2200906qkt.124.2016.10.11.12.48.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Oct 2016 12:48:16 -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]:57624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bu328-0007qo-7s for patch@linaro.org; Tue, 11 Oct 2016 15:48:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bu2vS-0002yQ-RQ for qemu-devel@nongnu.org; Tue, 11 Oct 2016 15:41:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bu2vR-0001XS-R8 for qemu-devel@nongnu.org; Tue, 11 Oct 2016 15:41:22 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:34465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bu2vR-0001Wv-KR for qemu-devel@nongnu.org; Tue, 11 Oct 2016 15:41:21 -0400 Received: by mail-pf0-x244.google.com with SMTP id 128so933327pfz.1 for ; Tue, 11 Oct 2016 12:41:21 -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=jg+v8nSveodoSLUpjUfvFC0ozaIdD7lW7G2Gta39Hm17QBdqCXRd/fECuGcYiW15l8 hMyRisyBVRiHtECgw9RlYb3F31MIgyV1Xc4K6qx4ZpyFUn6QKRCo6xLJj0Uohm4+Nm2w MIA4Lwa34ZPs3Ot5HBXcAY3vKXwfKIhbUXiN6QOuYZsoBOHDiUFHLdtKs8kOlVmZmvfz F6XxoupMleS+3xCrDyt18K1DQGWhFWeNOaKf0k7Rt20GlTLdLOmwv91J53EtkioCHsDp KNYgXUvJMlqIERcYCkpFNyIoBCg4aN3XKOdUkbTFx7L8VnXmwj3GXkz/XaUSYiLSvV/3 LSdQ== 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=NMq5GKAvxSq8T28fEfEuVcMxUTIBU4Xrwzr7p4DBqlTRnc9mADSrR7ru6Ak43qFVTH CLKWEMAMyMXUJkm9+xLmDlJgLB1K0vx198KAgkCahL0jVFycD82wYKMLfxCkWdJLCLVa ef9OD+ssHrfLtL1rb76q7aONncwnD+ETNyjzZBUwal+dB7RKfJPOHO1HHv1ztejuqhdI pl5YIVJTFLPuQoX/Pmjt0Uy+FPM5ibNiqcL6GPFNZokhbPKF+3N5eaINz4Q9cBk8Rdny kbJKfIW59rQ7JwrSYfM2kxzJA80oizK+fXUxDTbKBEwujWTJ35t8V14dBIUS3kOgld+j rLnQ== X-Gm-Message-State: AA6/9Rl5gKbiZJ5ldVizJN+MxzV2WyDmSHmD+qdcZaaE4AoH085GddEdskNuFhW92izSDA== X-Received: by 10.99.122.78 with SMTP id j14mr3560060pgn.134.1476214880725; Tue, 11 Oct 2016 12:41:20 -0700 (PDT) Received: from bigtime.twiddle.net ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id j63sm6197571pfg.32.2016.10.11.12.41.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Oct 2016 12:41:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 11 Oct 2016 14:40:33 -0500 Message-Id: <1476214861-31658-8-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476214861-31658-1-git-send-email-rth@twiddle.net> References: <1476214861-31658-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:400e:c00::244 Subject: [Qemu-devel] [PATCH v6 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. */