From patchwork Mon Oct 24 17:39:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 79058 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2727780qge; Mon, 24 Oct 2016 11:37:49 -0700 (PDT) X-Received: by 10.176.6.70 with SMTP id f64mr10054810uaf.118.1477334269459; Mon, 24 Oct 2016 11:37:49 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g14si5910429uab.62.2016.10.24.11.37.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 24 Oct 2016 11:37:49 -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]:48843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byk84-00025E-9k for patch@linaro.org; Mon, 24 Oct 2016 14:37:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byjE7-0002JA-QL for qemu-devel@nongnu.org; Mon, 24 Oct 2016 13:40:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byjE7-0005NC-1K for qemu-devel@nongnu.org; Mon, 24 Oct 2016 13:39:59 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:34185) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byjE6-0005MT-PW for qemu-devel@nongnu.org; Mon, 24 Oct 2016 13:39:58 -0400 Received: by mail-pf0-x243.google.com with SMTP id 128so17137827pfz.1 for ; Mon, 24 Oct 2016 10:39:58 -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=TB6RfcBtn2LLlDd1wqLYhDUz0qPNPdKm4zJZjY0Hvvg=; b=GggumTQdYzQ9ga6pQhNaQcSvFXbuvhVK7Dr95mq9mw+4kD+tRp6ZRU+iqr7o7x6vVT GQXdAnCdR0tKgFg5KZasHY58cN/3p47XmiWsdmhpjPnuYhogEobqUwsQ16i1dd/zoTL0 UcYB1WWsjPROpYJJauvZkzbWEydggWpPnJXxyrQkajc0RlFI0JNl2RBIkVRFc3G/+r2R Cc491SAEcJ/1L2k/SYJlq+o4I/2uM1D2wFnX+3jQ3CPyCFC2zbnZBZ9wjpVbcSBEvk3L 0sdN9bg8fFy+BOTc3+UZ6JMz74xVMaqwgXNRcaeBVHrX/uPy3fI7pgdEDnXtZYJ1gUBw fw5A== 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=TB6RfcBtn2LLlDd1wqLYhDUz0qPNPdKm4zJZjY0Hvvg=; b=lw293acSrTJFcNiZi0nNdDQPaHcOu/BUX+pkGJQRQZWMj50EZlrqPWNcN8S+BYbYRu vQQEb/SrOgv9Usl7PVGseeuxmGFXbpPgFR/sg+7a3eQpuvWjqt1mlO4lPBBLMm+OxB/Y K+nadNxkdAJdKN2cfIhHyMIunDqS7YF7Frr8J4dmz+GVEF/bC0lDut0kjG35G9fN99EE jChuzzZkTutn8C341OU3xb4OUTGOYT5Baowt+wEpjKJ6/U9+9Y61S8+upKNQetPfcixB wfqqAzabxlZ8Lcz8CIGtgnm9jLpbiyMzFxRpXX2+xPSsgqyocB6IOn1/Itck2icQ+Anl 7Pog== X-Gm-Message-State: ABUngvdmcGczj1yQVcGKf+kJtGbW5Os/qaJF0qQ28U14vG7JL7K/q8UbmrDGb82bQnMi1w== X-Received: by 10.98.196.17 with SMTP id y17mr30731953pff.172.1477330797028; Mon, 24 Oct 2016 10:39:57 -0700 (PDT) Received: from bigtime.twiddle.net (174-24-157-40.tukw.qwest.net. [174.24.157.40]) by smtp.gmail.com with ESMTPSA id c15sm26908312pfd.53.2016.10.24.10.39.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 10:39:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 24 Oct 2016 10:39:20 -0700 Message-Id: <1477330788-14996-10-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477330788-14996-1-git-send-email-rth@twiddle.net> References: <1477330788-14996-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::243 Subject: [Qemu-devel] [PATCH v8 09/37] 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: peter.maydell@linaro.org, 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 db697c0..7b77503 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6164,6 +6164,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. */