From nobody Mon Feb 9 03:05:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499587550251236.43493401147782; Sun, 9 Jul 2017 01:05:50 -0700 (PDT) Received: from localhost ([::1]:35318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dU7Dw-0007ph-Tt for importer@patchew.org; Sun, 09 Jul 2017 04:05:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dU6zL-0004RH-7s for qemu-devel@nongnu.org; Sun, 09 Jul 2017 03:50:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dU6zF-00031h-CE for qemu-devel@nongnu.org; Sun, 09 Jul 2017 03:50:43 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:53043) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dU6zE-000301-Q3 for qemu-devel@nongnu.org; Sun, 09 Jul 2017 03:50:36 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0E08B20913; Sun, 9 Jul 2017 03:50:35 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Sun, 09 Jul 2017 03:50:35 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id CBCCC7E70C; Sun, 9 Jul 2017 03:50:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=pHD pNGHV/1gs0s5Swyo6UHJtms5yBA3noLN382UZZAI=; b=HAW5Q9ckjZBdYHj4t3Q ve3xnwfOX1G7HBZUn6Cx/bCFOC7wex6RSQaSR8UgESBkETVqRiiNgnW849rZRXy7 RvUqQ5x4UbZWKiWnfZoD5o5iYuPS3fd8C/5QveKz/yKLZ07DdewDaX9f8hm6/upU DXKTGQX8vUtxhBwd75fj3Xrw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=pHDpNGHV/1gs0s5Swyo6UHJtms5yBA3noLN382UZZ AI=; b=GRTHR4eEst6gsoosUW1afdrnv3hJuejfFP+E6yjxF8HfsRcnHfTqgh6GK Ty7G01xxDf1rkhrnyTjwLH5LyhhpPALT44vLHQvzt+L3Uv69veF5196qan7FHr8f FTnOmyUuP5sgDmR+Unujvx9wzO2n6O7UBgeKTtWBj4RmH6rKQnortKHe68tXW3bO AHE5/5NAykdTBhzvjqh7CmUQ8LNWgWP1S59p1FuokMoz7xeihWT24k3W2nQpKZ07 /8b0FmxV1yxs3hqj/hCxkvO9+E1wnW6NRB07yYwn0osVYXPZFLys5kuvbCljafAI 0p4KEIux8kWJ81zj6GorCkr6z9KIQ== X-ME-Sender: X-Sasl-enc: Ei7MHNg7Dq2wC6khbm/3MoNFTMmBOqqC58cvc28t4cI0 1499586634 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Sun, 9 Jul 2017 03:50:11 -0400 Message-Id: <1499586614-20507-20-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499586614-20507-1-git-send-email-cota@braap.org> References: <1499586614-20507-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.27 Subject: [Qemu-devel] [PATCH 19/22] tcg: introduce tcg_context_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: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Before we make TCGContext thread-local. Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 1 + tcg/tcg.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/tcg/tcg.h b/tcg/tcg.h index 2a64ee2..be5f3fd 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -778,6 +778,7 @@ static inline void *tcg_malloc(int size) } =20 void tcg_context_init(TCGContext *s); +void tcg_context_clone(TCGContext *s); void tcg_prologue_init(TCGContext *s); void tcg_register_thread(void); void tcg_func_start(TCGContext *s); diff --git a/tcg/tcg.c b/tcg/tcg.c index 2f003a0..8febf53 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -117,6 +117,7 @@ static bool tcg_out_tb_finalize(TCGContext *s); =20 #define TCG_HIGHWATER 1024 =20 +static const TCGContext *tcg_init_ctx; static QemuMutex tcg_lock; =20 /* @@ -353,6 +354,7 @@ void tcg_context_init(TCGContext *s) TCGArgConstraint *args_ct; int *sorted_args; =20 + tcg_init_ctx =3D s; memset(s, 0, sizeof(*s)); s->nb_globals =3D 0; =20 @@ -409,6 +411,18 @@ void tcg_context_init(TCGContext *s) } =20 /* + * Clone the initial TCGContext. Used by TCG threads to copy the TCGContext + * set up by their parent thread via tcg_context_init(). + */ +void tcg_context_clone(TCGContext *s) +{ + if (unlikely(tcg_init_ctx =3D=3D NULL || tcg_init_ctx =3D=3D s)) { + tcg_abort(); + } + memcpy(s, tcg_init_ctx, sizeof(*s)); +} + +/* * Allocate TBs right before their corresponding translated code, making * sure that TBs and code are on different cache lines. */ --=20 2.7.4