From patchwork Wed Oct 26 16:15:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 79452 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp152099qge; Wed, 26 Oct 2016 09:23:52 -0700 (PDT) X-Received: by 10.159.35.132 with SMTP id 4mr1766481uao.152.1477499032921; Wed, 26 Oct 2016 09:23:52 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l124si1106211vka.179.2016.10.26.09.23.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 26 Oct 2016 09:23:52 -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]:35924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzQzY-0007zv-5W for patch@linaro.org; Wed, 26 Oct 2016 12:23:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzQsi-0002iw-LV for qemu-devel@nongnu.org; Wed, 26 Oct 2016 12:16:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzQsg-0002DD-Hh for qemu-devel@nongnu.org; Wed, 26 Oct 2016 12:16:48 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:39825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bzQsg-0002Cu-Ch for qemu-devel@nongnu.org; Wed, 26 Oct 2016 12:16:46 -0400 Received: by mail-qt0-x244.google.com with SMTP id 11so310166qty.6 for ; Wed, 26 Oct 2016 09:16: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=TB6RfcBtn2LLlDd1wqLYhDUz0qPNPdKm4zJZjY0Hvvg=; b=WSgsCEY12nP65746RsLWn6Bfq1PwWrzM0Lg1d9sKAauDDuRvhXzYP5MIk39fd/uTuI +YDYaE/PVzh0nOApI89vPJgk18/h6MxqXPQapArP42IFbr2LX/iB+sJU955gtcRC0LEi FebwJEyUpB0k/T2wZjhP5rnd+ZH8uU9Zko0ToMdFQGyIS59qCGTqDEp5ZdIOrT48UdGl YDeVSF/GXPI+YM3XnYG2lcHz8pjFO4p63vNIRQjXnGHEFgu6vWNkWEJy8+XWTsOkRtaJ KI+4hgVOIgS63zt8yNEJRgifMASMsgYrG3lJNzAeulAJNOtVQT2ISRKYcZWw9jt5kUje CN4A== 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=ebm2CwMGdcXatp63sCw8d2fQI5hVuDMfmmslKbZ2cgZICfS7MD96lJ87l6onkSnors jsBUhdAt589q/yv0QpPPxYpKW+vffpwX4T6HixGSo3vKib6bzioDZiopgV4BMT+h7Kfb ikk9OwGFI9IaFqcVUSCTz1LTOby999ME5iOSN5qIlBt4zIHPCFozHLN29Ki8laWPYlPC SBqR9wxmz/3nfbJQ7daobE86tlOPwLjB1H1daLGOPKfrzoJhhUKtz/kKFt3FtMJG2lmu jxv7sszkqiP4t8swKJqlQq31e3rG39kxrzclDTBPYIEXo7CjqsgxZudN4WdZ7/F2fPWv HI+w== X-Gm-Message-State: ABUngvei2TvsFSDviAP4GFzz77xjAYXFsNt+PqQlnELo+lEs1Ri8NB3xzu2Bgo/geSQGkg== X-Received: by 10.237.53.201 with SMTP id d9mr2529947qte.41.1477498605875; Wed, 26 Oct 2016 09:16:45 -0700 (PDT) Received: from bigtime.com (174-24-157-40.tukw.qwest.net. [174.24.157.40]) by smtp.gmail.com with ESMTPSA id e185sm1337941qkd.13.2016.10.26.09.16.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 09:16:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Oct 2016 09:15:35 -0700 Message-Id: <1477498563-29091-10-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477498563-29091-1-git-send-email-rth@twiddle.net> References: <1477498563-29091-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:c0d::244 Subject: [Qemu-devel] [PULL v2 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, =?UTF-8?q?Alex=20Benn=C3=A9e?= 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. */