From nobody Tue Feb 10 01:16:14 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.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 1493107694725981.7210439788561; Tue, 25 Apr 2017 01:08:14 -0700 (PDT) Received: from localhost ([::1]:47642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vW9-0002dO-1A for importer@patchew.org; Tue, 25 Apr 2017 04:08:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIs-0008VN-Om for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000p2-FJ for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:30 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:52847) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000gR-Hk; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 155F921F26; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id EFF7C24813; Tue, 25 Apr 2017 03:54:03 -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=oIt 0v33rjciqAFSJM93+0ftvaG8TKg4ll7wOGlGSNZQ=; b=PfraxVjt0UDKcJJ8D35 JKup4jJAqMjj+g3TDbqKSgk+9PCSqqLLv5i2aNoxQK3q0dJjm/+CxOoR/slJc4XS WaKpUFWhLpQu1o4gFTOhAE+tGpeZSgdWHO6aXbwzffLmB6KwSOBdgE1Iy++5dVYp jqpK+VcIJcBs4p34HLY8/JOY= 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=oIt0v33rjciqAFSJM93+0ftvaG8TKg4ll7wOGlGSN ZQ=; b=Knyd06QGzGPJNa62VQdYUCw8qedzlhoZDsVntXdoq3yWiRGQU97pj7TVv ogdHFZmfMLETVztpbILIlfVi7y236WZHJd98BLKwjY7DNsH9XPaR+qFQuAeiNhFm fZ/r+UBdffDlzQQz4Gb19Hp7nA0vYhJwxsBg27Szmk99FuhXXIejCCOslqLat/Ro sjXWRb5kTX7BniWx0U2r1PTYI/xnVqjLo5ZWvIkOFCK0IGwG6yWFhuGzCuGESTKF hmul+WUVh7IywhQD4asAf5Snhypc4FbWDEoc1kACEIy03C9WIur2qTAtubJDmaQM aAGrEemB6MouNcG7d78IfSR5FXiyA== X-ME-Sender: X-Sasl-enc: McDoeZoQNtvikGtwzThR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:50 -0400 Message-Id: <1493106839-10438-5-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-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.28 Subject: [Qemu-devel] [PATCH v2 04/13] tcg: keep TCGContext's read-mostly fields in a separate cache line 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , 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" Upcoming changes will require reading from TCGContext from a parallel fast path. Prepare for this by keeping the struct's read-mostly fields in a separate cache line, thereby preventing false cache line sharing. Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index 5fdbfe3..b26f0ef 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -642,6 +642,20 @@ QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 14)); QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8); =20 struct TCGContext { + /* Read-mostly fields go here to prevent false sharing */ + struct { + GHashTable *helpers; + + void *code_gen_prologue; + void *code_gen_buffer; + size_t code_gen_buffer_size; + + /* Threshold to flush the translated code buffer. */ + void *code_gen_highwater; + + int code_gen_max_blocks; + } QEMU_ALIGNED(64); + uint8_t *pool_cur, *pool_end; TCGPool *pool_first, *pool_current, *pool_first_large; int nb_labels; @@ -663,8 +677,6 @@ struct TCGContext { =20 tcg_insn_unit *code_ptr; =20 - GHashTable *helpers; - #ifdef CONFIG_PROFILER /* profiling info */ int64_t tb_count1; @@ -697,15 +709,8 @@ struct TCGContext { here, because there's too much arithmetic throughout that relies on addition and subtraction working on bytes. Rely on the GCC extension that allows arithmetic on void*. */ - int code_gen_max_blocks; - void *code_gen_prologue; - void *code_gen_buffer; - size_t code_gen_buffer_size; void *code_gen_ptr; =20 - /* Threshold to flush the translated code buffer. */ - void *code_gen_highwater; - TBContext tb_ctx; =20 /* Track which vCPU triggers events */ --=20 2.7.4