From nobody Tue Feb 10 11:13:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1573646750; cv=none; d=zoho.com; s=zohoarc; b=S/qQ88iiKIVIBrhTZ/U9uhFkKTfHOvStDlrYkvd5neKbObq0Xvo17/eiOonCOmqe0BI1Jq5ryVHBw9/Y0EH0+WXhdAFDCJTJT1qS94PBpp6TcdpX7nliNo5FLI3eAAbBX5D913iDbzizJked8sCmFj4Li5Pytt3fIDPbnyE4cM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573646750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dAtTKvTGGLbgatjy9hszVeJW8BTJjLusZ3gELbhkEj4=; b=BtIQAQAK3hfSSMK4XjhWG/ZIDifrKNVHgpcyaKyncRpMu7P71I5cYxsftwgkO4A3LV0yH0jzfvE2BiyARvX+R5czMFM2f8Swabx+6XDR1GW1FcxSaoRv2ZZ00mbQBpuAjf0490B1PmT3Kecb2+09xH3IxybgOL9aiIa0PEnmVpQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1573646750086384.9239238322921; Wed, 13 Nov 2019 04:05:50 -0800 (PST) Received: from localhost ([::1]:43420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUrPB-0001tO-1L for importer@patchew.org; Wed, 13 Nov 2019 07:05:49 -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) 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) 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-Google-Smtp-Source: APXvYqxs9LH3o+w8MIelf4F6m1mYuGQZ0xo5bEOmeQ4kBkS7cjJ6Iuk+vDApcjg7kOVETzhqqaqwIA== X-Received: by 2002:a5d:6746:: with SMTP id l6mr2433214wrw.349.1573646400980; Wed, 13 Nov 2019 04:00:00 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=20Benn=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Alex Benn=C3=A9e --- docs/devel/index.rst | 1 + ...ti-thread-tcg.txt =3D> multi-thread-tcg.rst} | 28 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) rename docs/devel/{multi-thread-tcg.txt =3D> multi-thread-tcg.rst} (96%) 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. =20 -This work is licensed under the terms of the GNU GPL, version 2 or -later. See the COPYING file in the top-level directory. +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Multi-threaded TCG +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 Introduction =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -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:: =20 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 ---------------- =20 -### 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. =20 Code generation is serialised with mmap_lock(). =20 -### !User-mode emulation +System emulation +~~~~~~~~~~~~~~~~ + Each vCPU has its own TCG context and associated TCG region, thereby requiring no locking. =20 @@ -125,10 +132,11 @@ linked list of all Translation Blocks in that page (s= ee page_next). Both the jump patching and the page cache involve linked lists that the invalidated TranslationBlock needs to be removed from. =20 -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 =20 (Current solution) =20 --=20 2.20.1