From nobody Mon May 6 22:10:29 2024 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.zoho.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 1498873730836514.743977148026; Fri, 30 Jun 2017 18:48:50 -0700 (PDT) Received: from localhost ([::1]:46541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dR7Wh-0002fO-UQ for importer@patchew.org; Fri, 30 Jun 2017 21:48:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dR7Vv-0002MS-SG for qemu-devel@nongnu.org; Fri, 30 Jun 2017 21:48:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dR7Vs-0002WP-QH for qemu-devel@nongnu.org; Fri, 30 Jun 2017 21:47:59 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52385) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dR7Vs-0002W1-9b for qemu-devel@nongnu.org; Fri, 30 Jun 2017 21:47:56 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4EDD620A4E; Fri, 30 Jun 2017 21:47:55 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Fri, 30 Jun 2017 21:47:55 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 0BE3F246E8; Fri, 30 Jun 2017 21:47:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=+Ji+MC0d2wtb/ixcZfLghN7Bb6RD3SjU0f0jgs QxHgk=; b=fRelHCDhSIkEEtOfB/SFUBHRtk5Vd5o/AecDp2RFKmsBA3cI/TI+rG o5iWKqm3G4tiY3t7mEczLeIXig5475OWx6dtzeddKC3d4uJzHv20uzdMuCCpWtkx MFqS8lNnZ26ZJ8iiF4K+VfSpGeqh3L1gQnx431OLRhO+OfUvav40A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=+Ji+MC0d2wtb/ixcZf LghN7Bb6RD3SjU0f0jgsQxHgk=; b=pPmCeWjyv3bvNBXMkrhQ75FH6iY6ufdgr6 yJFnEqOPS8iAhHULDVNLaWRhpIuTQ/ewHS0xLSa4/oxwkGsriAlN5ZXA4BMNar8w NdZ629YaYb7IIF6mvwkYC8n9mpJ/I4pokgv1OTgUrstBSsZ227/yoHQPyLax9uBj zEKqE1qJnGwS9gcNQKninBONQ+FBaiNQ+/0EKYOH+DYGlBo+vMrqc1wfUUlPfI6a OIIefOS7z5YGrYUKLHHNefvsWs2Gn9u6rle+p1b169Oo0s0WYX5PzduB7RtZw9Q7 QSFLqOs/l8EqMTa7okoOuCF32KSfVQL+Lo73AfYe0TyUQ0lnlMtg== X-ME-Sender: X-Sasl-enc: XhY88sFLvK+Vf0LL0qelbCEvQcWtv7zCG+jM9PTJwKGU 1498873675 Date: Fri, 30 Jun 2017 21:47:54 -0400 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Message-ID: <20170701014754.GA32043@flamenco> References: <1498768109-4092-1-git-send-email-cota@braap.org> <1498768109-4092-7-git-send-email-cota@braap.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1498768109-4092-7-git-send-email-cota@braap.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH] fixup: missed some TLS variables 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 Content-Type: text/plain; charset="utf-8" On Thu, Jun 29, 2017 at 16:28:28 -0400, Emilio G. Cota wrote: > XXX: After allowing tb_gen_code to run in parallel (see next patch), > crashes due to races in TCG code are found very quickly with -smp > 1 > (e.g. "tcg/tcg.c:233: tcg_out_label: Assertion `!l->has_value' faile= d.") > Note that with -smp 1 it works fine; with smp > 1 I can make it > fail later with "taskset -c 0", so clearly there is a race going on. Fixed! I missed a few __thread's -- see below. I found the missing ones by moving tb_lock around and using 'valgrind --tool=3Ddrd' (it's not ThreadSanitizer, but it doesn't choke on our coroutines and it's reasonably fast). Preliminary tests show even with patch 6 we don't gain almost anything when booting 64 cores (on a 64-core host), which is what I expected (we still have to acquire tb_lock on each translation, even if only for a few instructions, which is a scalability killer). But I'd worry about optimisations later; for now I'll focus on cleaning up the patchset, so my next steps are: - Apply Richard's feedback so far - Consolidate TLS variables into TCGContext, so that we'll have as little TLS variables as possible. Cheers, E. --- 8< ---- Signed-off-by: Emilio G. Cota --- include/exec/gen-icount.h | 2 +- tcg/optimize.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 62d462e..2e2bc7b 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -6,7 +6,7 @@ /* Helpers for instruction counting code generation. */ =20 static int icount_start_insn_idx; -static TCGLabel *exitreq_label; +static TCG_THREAD TCGLabel *exitreq_label; =20 static inline void gen_tb_start(TranslationBlock *tb) { diff --git a/tcg/optimize.c b/tcg/optimize.c index adfc56c..71af19b 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -40,8 +40,8 @@ struct tcg_temp_info { tcg_target_ulong mask; }; =20 -static struct tcg_temp_info temps[TCG_MAX_TEMPS]; -static TCGTempSet temps_used; +static TCG_THREAD struct tcg_temp_info temps[TCG_MAX_TEMPS]; +static TCG_THREAD TCGTempSet temps_used; =20 static inline bool temp_is_const(TCGArg arg) { --=20 2.7.4