From patchwork Wed Nov 13 11:59:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 179297 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp9498162ilf; Wed, 13 Nov 2019 04:05:14 -0800 (PST) X-Google-Smtp-Source: APXvYqzHrovT0ODhZts2wwH/q91kW1fQgc1pQ343Yy6sBARM2i4VlieKTu2lw1L6L+H5dWvDvV69 X-Received: by 2002:aed:3f21:: with SMTP id p30mr2257062qtf.236.1573646714272; Wed, 13 Nov 2019 04:05:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573646714; cv=none; d=google.com; s=arc-20160816; b=ZhmHokblSx/pC4R0I8Cqy6OmuHdNPT973EbO8g8UepqE29KeMMysINkdH4nqCLvOlT ojS2jnwyZDOubunj2TuF2ptCK8iT7abRNXfTIAEKeYvuRysuzoyjXrD/0N9ngLfl26WX Qm+8Qe8Qxqu2nmX3CF9o2uLxWaA6hoPK/uzXVjss51Y48x//twJbqMKv/WwG7qPGQCtU TXS5dOXEaSRgN44Nr2FZm477W0EsjPc5csg18wNMAywiNYspvqNX7eJuIJhoLSBG6cfy /F/cPZ8dgwc3MhgEFrqpryvNueB83mDr56CEPL9hAOUntYzed37kWkL2C2I1jXrbFcYt Yfgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dAtTKvTGGLbgatjy9hszVeJW8BTJjLusZ3gELbhkEj4=; b=b3oj/kusFcqSL3PgqaaS+XXl7mnu/VaivChycZpHQ9w5ERy0bNLgzaBF/sfHUuSkP3 Rzz+lpQ2k++TJSauzJnUfcwhD6U5bRF4wTpH9h3PeXQELegZS1YEsUDt4MCEX+QnzDK6 CavJoQQ7LXYozROZuYRQ+JqHDSY/74lUXKl2JUbW48FRxz6Osng3eI1hfAb51dkNEZg3 Z8nF9/xHunkMt4aEupF3zMoj4BI4tTjS8FpRzXFX/YS0CH0KlFz3PU5OC5kMGUqaT4+p NpnZaUuUy7KTUDCEqULZ6ZoAUYdeVMRxumfMb0KoWxIiTEPVTBHZwHrg3I9+E8XRXnt9 Oo8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WxoFSJlE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p17si886670qvl.69.2019.11.13.04.05.14 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Nov 2019 04:05:14 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WxoFSJlE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUrOb-0001OS-Nt for patch@linaro.org; Wed, 13 Nov 2019 07:05:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUrJb-00055Z-PL for qemu-devel@nongnu.org; Wed, 13 Nov 2019 07:00:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUrJa-0004GC-G3 for qemu-devel@nongnu.org; Wed, 13 Nov 2019 07:00:03 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34040) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iUrJa-0004FL-99 for qemu-devel@nongnu.org; Wed, 13 Nov 2019 07:00:02 -0500 Received: by mail-wr1-x441.google.com with SMTP id e6so2070071wrw.1 for ; Wed, 13 Nov 2019 04:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dAtTKvTGGLbgatjy9hszVeJW8BTJjLusZ3gELbhkEj4=; b=WxoFSJlEj2PN5haYt/fN+QdjGnMogU4uXP9+eLqNngRW8W6VKaJiD34MZPW9lWFbNy 0hAd1JcemYlOV7G+BPHEt+aNr7WosFzhGp7kSpisaYUpdc80NVkUkxSAXGKX/BgTWurW ZDxlVvABf9GGjBnSNWlTKzoICPhca3e/1u1pa6/7ucvl4eUTrGy0ydy2E1PzlTo+Ng+W o+iRmSb/geS/VshGO5Yxo6oMtqoRyPo2Jvtglfbnie3ecdjf1xXdacCPKLYn15FYfdMj /MEU3cz9d3hvxTxJbJXZ9Ksd3hJhEvkgxx8RihVXe/hoLnezmPQArW+x6Qn6MvAFMFGo TyXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dAtTKvTGGLbgatjy9hszVeJW8BTJjLusZ3gELbhkEj4=; b=TrQlQKbNGvYQhtCfmOoZFun+pNb0ZBry581K08Xcj8aDJL+LKxvb37sBz6t+MLva85 qNhVFaWjw/zb3HaJh5zpFtfy0uOCekkmWwmi6NIdY88eSLvPBSO5lvOYq9X2x2jbEOnH hbk/47v7cSIWZu36NR/6xlPgvhA9bZvdfXterGqTT3xoe1LAqD6KBSFxYY1M8svBAbOX NC8SGZrCZ9PV+HexcXc3QUbz8LgEQUVesR7i9x5zPfqBmAwYwU3LUkNJDl5hOQz4W9G9 ffZkSApZzLKTwG+a3rtlOozbL0BJ+OfCYsVq7YVNnMWkwN6AFK17oj/Cdc7JxWTX+BHY 8bLA== X-Gm-Message-State: APjAAAVWeqp9hukRa5YryvavuGXML+5Wft3tT0GDxyGtzsjEWZtgdlqR yc/72MX5SyweRqCiPyKkadb1mrJpX24= X-Received: by 2002:a5d:6746:: with SMTP id l6mr2433214wrw.349.1573646400980; Wed, 13 Nov 2019 04:00:00 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z4sm2181219wmf.36.2019.11.13.03.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2019 03:59:56 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 860281FF91; Wed, 13 Nov 2019 11:59:52 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/5] docs/devel: convert multi-thread-tcg to a .rst document Date: Wed, 13 Nov 2019 11:59:51 +0000 Message-Id: <20191113115952.775-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191113115952.775-1-alex.bennee@linaro.org> References: <20191113115952.775-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, berrange@redhat.com, stefanb@linux.vnet.ibm.com, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, cota@braap.org, stefanha@redhat.com, marcandre.lureau@redhat.com, pbonzini@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- docs/devel/index.rst | 1 + ...ti-thread-tcg.txt => multi-thread-tcg.rst} | 28 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) rename docs/devel/{multi-thread-tcg.txt => multi-thread-tcg.rst} (96%) -- 2.20.1 diff --git a/docs/devel/index.rst b/docs/devel/index.rst index c86a3cdff2f..3e6624ec604 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -22,4 +22,5 @@ Contents: decodetree secure-coding-practices tcg + multi-thread-tcg tcg-plugins diff --git a/docs/devel/multi-thread-tcg.txt b/docs/devel/multi-thread-tcg.rst similarity index 96% rename from docs/devel/multi-thread-tcg.txt rename to docs/devel/multi-thread-tcg.rst index 782bebc28b4..4e914bacc0c 100644 --- a/docs/devel/multi-thread-tcg.txt +++ b/docs/devel/multi-thread-tcg.rst @@ -1,7 +1,10 @@ -Copyright (c) 2015-2016 Linaro Ltd. +.. Copyright (c) 2015-2016 Linaro Ltd. +.. This work is licensed under the terms of the GNU GPL, version 2 or +.. later. See the COPYING file in the top-level directory. -This work is licensed under the terms of the GNU GPL, version 2 or -later. See the COPYING file in the top-level directory. +================== +Multi-threaded TCG +================== Introduction ============ @@ -40,7 +43,7 @@ Main Run Loop Even when there is no code being generated there are a number of structures associated with the hot-path through the main run-loop. These are associated with looking up the next translation block to -execute. These include: +execute. These include:: tb_jmp_cache (per-vCPU, cache of recent jumps) tb_ctx.htable (global hash table, phys address->tb lookup) @@ -61,7 +64,9 @@ have their block-to-block jumps patched. Global TCG State ---------------- -### User-mode emulation +User-mode emulation +~~~~~~~~~~~~~~~~~~~ + We need to protect the entire code generation cycle including any post generation patching of the translated code. This also implies a shared translation buffer which contains code running on all cores. Any @@ -78,7 +83,9 @@ patching. Code generation is serialised with mmap_lock(). -### !User-mode emulation +System emulation +~~~~~~~~~~~~~~~~ + Each vCPU has its own TCG context and associated TCG region, thereby requiring no locking. @@ -125,10 +132,11 @@ linked list of all Translation Blocks in that page (see page_next). Both the jump patching and the page cache involve linked lists that the invalidated TranslationBlock needs to be removed from. -DESIGN REQUIREMENT: Safely handle invalidation of TBs - - safely patch/revert direct jumps - - remove central PageDesc lookup entries - - ensure lookup caches/hashes are safely updated +DESIGN REQUIREMENTS: + - Safely handle invalidation of TBs + - safely patch/revert direct jumps + - remove central PageDesc lookup entries + - ensure lookup caches/hashes are safely updated (Current solution)