From patchwork Sat Oct 22 21:04:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 78809 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1915915qge; Sat, 22 Oct 2016 14:21:45 -0700 (PDT) X-Received: by 10.200.36.202 with SMTP id t10mr8369472qtt.85.1477171305202; Sat, 22 Oct 2016 14:21:45 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z5si6112940qke.305.2016.10.22.14.21.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 22 Oct 2016 14:21:45 -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]:38742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1by3jc-0000eY-MM for patch@linaro.org; Sat, 22 Oct 2016 17:21:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1by3Tx-00052E-9o for qemu-devel@nongnu.org; Sat, 22 Oct 2016 17:05:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1by3Tw-0001qH-Ee for qemu-devel@nongnu.org; Sat, 22 Oct 2016 17:05:33 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:34014) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1by3Tv-0001pH-VS for qemu-devel@nongnu.org; Sat, 22 Oct 2016 17:05:32 -0400 Received: by mail-pf0-x242.google.com with SMTP id 128so12086195pfz.1 for ; Sat, 22 Oct 2016 14:05:31 -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=rgQ/w+3ZHk2FHvZriChHI4ruC84+tJY4xiHlVRHzkYjfW5vloM0jL3KSWzAJRzdYaA Wp2qk6vvt8VtbZf6Per61iQF4RaKn8iu1AOW9zw5hXvf3hDC77/fuVANSgm+BC0d9BBV USOy8vlyQlAjcHpVhFQU62dMgiSBdnNPXaS8bid5rkQxCJcX5sKjqqmNwn0YhbtcE4aq q5sfEwXiLCWKZ59i8YTbkKtjE45CaDrWoVpYHznsAcL/k6PH9u+EjqwEX0l+pJfcuQ3T pG0C7npPvuNLSf2Ung+gj+ZmS5vobY1pR2A344QED2fPHh28FQDMGBdZuDY+f2450Kth 1ChQ== 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=Lg1d9PstuZMR7VEblMjGhQ3EPvn5QgtqOT2E6kdO6T+vZPu25yVaZtRCNjVsFi2szg KkDdq3kxbC0xQ/dS0o2csicKAjWozVd7rPLzVDxABpKg0UrzRbT86V7unTTlTNZAmGaq 2QbAKWR5Rzzuqj+V2dC+0++7qhBC4gVVNdB9k05RwTG4kLURV+vYmh+AUar5Gw8lpe0m GlEu+lIPag/rzI8ZUNZociQTFPqGDv+GEN3ME6obuNSQvu0hElQP+0lRdnv0ElQr9nNE YU7Fq68XegRvfTKYaEWJwEZFx236eJ4XubFs65pk3ftUOF1224f/FIcFHnp5rPKMNrJ1 809w== X-Gm-Message-State: ABUngvfU2i8SfWjqUyljNhsE210AOOyMPRVy1E+mxdogJ8z2ukEH5plet6ZzT+dAES+Tcw== X-Received: by 10.99.117.17 with SMTP id q17mr11657926pgc.177.1477170330769; Sat, 22 Oct 2016 14:05:30 -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 f129sm14300679pfc.3.2016.10.22.14.05.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Oct 2016 14:05:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 22 Oct 2016 14:04:56 -0700 Message-Id: <1477170324-17783-8-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477170324-17783-1-git-send-email-rth@twiddle.net> References: <1477170324-17783-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::242 Subject: [Qemu-devel] [PULL 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: 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 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. */