From patchwork Thu Jul 9 14:13:15 2020 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: 235149 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1452524ilg; Thu, 9 Jul 2020 07:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXY7VZI0dVBXR+tIYi3zQwiyknbaB9KEOe1BCBnQ81/TaafmhW3D14brtomP9Vb/UAD+1y X-Received: by 2002:ab0:21c6:: with SMTP id u6mr29196989uan.109.1594304067012; Thu, 09 Jul 2020 07:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304067; cv=none; d=google.com; s=arc-20160816; b=wqIQY7pr20rrzpcNcP44Qr3LHj6jd0rpI6aHq/71DyDLKn4DOupbrvjFVi3ZOxHc5W Unb5dsGfbqekvgWJ3wzarVZJ0s1uHaKs4pr1NI5Jetguiqdbl1b/Thj2P8DUTCT9ylm7 IVcOGnNvDVuvEoV32j+cLvZ7i4LX5kbQ6Xw42T+jpzrhsMeRAr1nP/3MZk6HH1S2uKQj x+5M4xxSFJZ1+r5GsvJo3hF5yIQnTsnGcXWKzhed26gWMz165fVOs0zlBdsG8u1sDI3o zZeIY9Ht7xKR0wGzAW8qa95VZkDzjWjz+EYxPHLVEfkQV8dMf8nfkN/YkiMKR3tIfBxk b3Gg== 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=Vdk5UoE5LdEgYcDXZFPkkMaZLzAjEGlDyIOfyPLg77o=; b=nOYb9XoVfHe+z8RawBbioLOp8EFU6RtFLGzc1NGRYN2bOVmgZp9qNZfZSQ508PUM8I Uu8lqQKCS9KbFCcgPqtd0YfNGgmKwiNbgGbZPe45gdiAfI9unxFyLwW9kh8SoTqUfgjQ 7yQGJZNaFzrkNzYCdl6aXVTqfHU8DIBDH6iOhVXOcuS9fzVdehfYQIkmsjJWVQReZZtZ WU3vDKM2ctEQzwonLNgEgJsfH4L58FWFfGLPEgoYOBoIG6wUHDZHkk2RsoIIPc/G1t62 zV5VdrMsWOG81WeTogn/PX06vdWS3tk14DvZ2qgE+yY7EbI1Vsz0suwAR3Cr8VJWmTyB WkWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OJcECKwX; 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 m10si351777vsn.154.2020.07.09.07.14.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:14:26 -0700 (PDT) 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=OJcECKwX; 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]:36790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXJi-0000F3-B2 for patch@linaro.org; Thu, 09 Jul 2020 10:14:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIu-0000Ch-7T for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:36 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIs-0001KG-Aw for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:35 -0400 Received: by mail-wm1-x343.google.com with SMTP id 17so1983484wmo.1 for ; Thu, 09 Jul 2020 07:13:33 -0700 (PDT) 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=Vdk5UoE5LdEgYcDXZFPkkMaZLzAjEGlDyIOfyPLg77o=; b=OJcECKwXnq81b0jF+fH3+ni/W67kLpbHqjcPt4c+4pyD/TXUXvYeoRcW7akC+77oto y64ntRhuctGj9X0JBtU4OSJ6vPE3daLQVQ9+QnDF8kLEYIGJHQh0no/x/nOReAePILtA iQL4Gus9xPyU+pamzEHh+6gyeuf/q/4MDU3i7kir126Dk598txaCxo4EPXj2LnERaRTL hI/l3isJ/Rp5AOIj0neTu4Xyx78GUrRMk1oR9CH/bixnssdGaIIITAQ2bjwt7crCDeEd GcAydwWV/eCHHMtQW++kC/4VvaJpF8Ef22SaqGG11rhjOe8kaf4Cj9LlRtYv60oDNkTa /3OQ== 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=Vdk5UoE5LdEgYcDXZFPkkMaZLzAjEGlDyIOfyPLg77o=; b=FIYjlhLq9CvbR0/+sKjhEGvX72aq6TPaO1oP24IFjWd0zbmp+pFqBEO5lUgyCHdRsp pzNjIwgkxGVhHCGGHwpLxHPcOJRFITug64PT2+/YOtdgOGOPc302Tufjm3y+WBenhCTR s2wLOZQXxP/YXsz4QrSYLHlaAxJUHWqfXePzncTTBJj3afEJ4N0Cm4c2qbN9Fzre8r0i usgs9VibZHu4t3cRjw+Xda1b+WH0POvVGrPepVeeZmYBr9SdeL05hHJpUTacdypr+9Jf Hh5UeEkTyLbjjD9lSG5iPB8PStKBEpKSP9uJuqUt+DLUIEswai4Q8jENTgm1OCkm7ogk ncEg== X-Gm-Message-State: AOAM532HL4uIP80fPPnsQsr7a6jXMk/RipNmwLSbYChuV2WDvAL7ujHT 3JDVWqnJAu1VJnNRWeML5LQbFg== X-Received: by 2002:a1c:2982:: with SMTP id p124mr274753wmp.26.1594304012896; Thu, 09 Jul 2020 07:13:32 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k126sm5166387wmf.3.2020.07.09.07.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:28 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 77ABC1FF87; Thu, 9 Jul 2020 15:13:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 01/13] docs/devel: convert and update MTTCG design document Date: Thu, 9 Jul 2020 15:13:15 +0100 Message-Id: <20200709141327.14631-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Do a light conversion to .rst and clean-up some of the language at the start now MTTCG has been merged for a while. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- docs/devel/index.rst | 1 + ...ti-thread-tcg.txt => multi-thread-tcg.rst} | 52 ++++++++++++------- 2 files changed, 34 insertions(+), 19 deletions(-) rename docs/devel/{multi-thread-tcg.txt => multi-thread-tcg.rst} (90%) -- 2.20.1 Reviewed-by: Emilio G. Cota diff --git a/docs/devel/index.rst b/docs/devel/index.rst index bb8238c5d6de..4ecaea3643fb 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -23,6 +23,7 @@ Contents: decodetree secure-coding-practices tcg + multi-thread-tcg tcg-plugins bitops reset diff --git a/docs/devel/multi-thread-tcg.txt b/docs/devel/multi-thread-tcg.rst similarity index 90% rename from docs/devel/multi-thread-tcg.txt rename to docs/devel/multi-thread-tcg.rst index 3c85ac0eab9b..42158b77c707 100644 --- a/docs/devel/multi-thread-tcg.txt +++ b/docs/devel/multi-thread-tcg.rst @@ -1,15 +1,17 @@ -Copyright (c) 2015-2016 Linaro Ltd. +.. + Copyright (c) 2015-2020 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. Introduction ============ -This document outlines the design for multi-threaded TCG system-mode -emulation. The current user-mode emulation mirrors the thread -structure of the translated executable. Some of the work will be -applicable to both system and linux-user emulation. +This document outlines the design for multi-threaded TCG (a.k.a MTTCG) +system-mode emulation. user-mode emulation has always mirrored the +thread structure of the translated executable although some of the +changes done for MTTCG system emulation have improved the stability of +linux-user emulation. The original system-mode TCG implementation was single threaded and dealt with multiple CPUs with simple round-robin scheduling. This @@ -21,9 +23,18 @@ vCPU Scheduling =============== We introduce a new running mode where each vCPU will run on its own -user-space thread. This will be enabled by default for all FE/BE -combinations that have had the required work done to support this -safely. +user-space thread. This is enabled by default for all FE/BE +combinations where the host memory model is able to accommodate the +guest (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO is zero) and the +guest has had the required work done to support this safely +(TARGET_SUPPORTS_MTTCG). + +System emulation will fall back to the original round robin approach +if: + +* forced by --accel tcg,thread=single +* enabling --icount mode +* 64 bit guests on 32 bit hosts (TCG_OVERSIZED_GUEST) In the general case of running translated code there should be no inter-vCPU dependencies and all vCPUs should be able to run at full @@ -61,7 +72,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,9 +91,11 @@ patching. Code generation is serialised with mmap_lock(). -### !User-mode emulation +!User-mode emulation +~~~~~~~~~~~~~~~~~~~~ + Each vCPU has its own TCG context and associated TCG region, thereby -requiring no locking. +requiring no locking during translation. Translation Blocks ------------------ @@ -92,6 +107,7 @@ including: - debugging operations (breakpoint insertion/removal) - some CPU helper functions + - linux-user spawning it's first thread This is done with the async_safe_run_on_cpu() mechanism to ensure all vCPUs are quiescent when changes are being made to shared global @@ -250,8 +266,10 @@ to enforce a particular ordering of memory operations from the point of view of external observers (e.g. another processor core). They can apply to any memory operations as well as just loads or stores. -The Linux kernel has an excellent write-up on the various forms of -memory barrier and the guarantees they can provide [1]. +The Linux kernel has an excellent `write-up +` +on the various forms of memory barrier and the guarantees they can +provide. Barriers are often wrapped around synchronisation primitives to provide explicit memory ordering semantics. However they can be used @@ -352,7 +370,3 @@ an exclusive lock which ensures all emulation is serialised. While the atomic helpers look good enough for now there may be a need to look at solutions that can more closely model the guest architectures semantics. - -========== - -[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/memory-barriers.txt From patchwork Thu Jul 9 14:13:16 2020 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: 235148 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1452507ilg; Thu, 9 Jul 2020 07:14:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYPOYjMvlsifzuUWHTn35vE2+cQ9jdGYKatF16dJAb622om3AuhqtuLL2XzjDnSLmtq117 X-Received: by 2002:ac8:178b:: with SMTP id o11mr30393571qtj.320.1594304065717; Thu, 09 Jul 2020 07:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304065; cv=none; d=google.com; s=arc-20160816; b=Pj6gf/0gyHSaMG/DRxWS1d7H1XM4+jXu2+/rMxtmmU0xV29olTCmagyYHxDzWtEEvs o7JycrXckLPG5MopUhzu/oRzKcmj3au8JF946bullxIgggIqu23W7Fuf3/5SCI6ldPIP RSD8EloOjuGP8rWURN4+0jq6QBJfBZSPxMzQDCByDmMcnpCJh0j14ek53G9M2YpRl9W5 gZ1dsod1aLggwL2BixYlBp2Q0aQOOiG1lzx+rSPxS25iy4EYcNBYg0T5KYOJQosH+Mot oIGhdQ7Cj/e98gvynZhdnIbjbsxurmIxSn1TvHbBtBrwwUfv7y/QQd4yk81euLtOfSv8 +T4w== 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=Nm8CLC7O4HQxtuuQtcA9m1t+foBk/FQkRZdS8Q7AlJQ=; b=OFS3dWCwo7qPvKm5Wk6iTu0/2IIkdRn2uZFDKNcEgmwz3erqHx8V9ruyhg82K0yjq/ E5XfroCyHb+Icl1oK9kYYj1pgm4cMQjPmfvlYHIhyVrGZ3UdIQ7eQgQ5lr7lRoE38iJW XnG7fxAlHkeCQJRDlkuYpuYZRfTi3dEo6qCYsVn0SdtG+hYfDF2Wt3j28I83jPs8mg0w wLP+k8slruNEIiAI/VM0Lm9h6P+Q2HfBnCQrTyW46hZHsQGTzvXeuhZ7V9121G0xn5LZ YEiJ8NA5ZvvdsVo3Arktw7VLWt9yfyYUO8DC3OTEjKYwjeqwUV+Oqh0/KILv8s7VJi6L +w/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XCyk0Ovi; 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 95si1725897qta.340.2020.07.09.07.14.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:14:25 -0700 (PDT) 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=XCyk0Ovi; 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]:36730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXJh-0000Cn-2F for patch@linaro.org; Thu, 09 Jul 2020 10:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIt-0000BX-2g for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:35 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36838) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIq-0001K2-LJ for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:34 -0400 Received: by mail-wr1-x443.google.com with SMTP id k6so2561898wrn.3 for ; Thu, 09 Jul 2020 07:13:32 -0700 (PDT) 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=Nm8CLC7O4HQxtuuQtcA9m1t+foBk/FQkRZdS8Q7AlJQ=; b=XCyk0Ovif5U0sSesiyXMl1+eA0ZbZS39glLQJjh267Iuri8ehd7gVhH8+ExUvE05TL 32Q8SA6KIQmDfpeWIJABWGRe9IJCDOyI2a7VkGYApWSqgb6y/1VBwgSAiHb94VFxmS0i +XHyKrM7j8m4PhWmpalHtSH6BdDMIbJwdFQ+d6RdRZja74DxZICkA0e2N6Moeevmwo7p hYRLXu0qkOXv9H4RNXi8fGn+Nin4KBBC0+UBfS832n1w/I6iVOqZnSAEzagoban++liB 2e400zC3XK7Rx9UUs3guwxLCnqquZ5hp1NSb80TgKU/rVC6OjXnlmAu2CC0i1U1oL8PW FtTw== 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=Nm8CLC7O4HQxtuuQtcA9m1t+foBk/FQkRZdS8Q7AlJQ=; b=dYJ6m+UxpzXPrliQFhHZ/mg4KwLs9zEtCCBOraOmN56zqxxIa6NWvW/vY7CIJeHjEp rxhe2juQzqpmCnkSOjmK/aJMFf/yFjL+LpRwZKCsPydreVSDw2tRFz1+lt/fsKBuApW3 UGOgdHWT1luV6QoT+xRD/Zv2M1Ik86EPN+Q+0DLWs9i95syRynZHCkxDK2jPn8wCaANb pCOWqd8AtXxrMa/Al2WRb8ZtL8+YenueXTMx0910v3L0mxo0POGd42WTMx9/MG4Xa1FO jS1bdB6ssvpH5AKX3MmqRzHBrHPwRtibUAi7nXlP+BbdSHQHjPO3k9TDeXjQmZD/Xe+T qZTg== X-Gm-Message-State: AOAM5303hwJzrF2wUu7rS5QRbEhoTrKQbmGNniNEQ2hNDVoG8mhjdapy ecsxAelI+U5L/XUod7d0Fj+RQA== X-Received: by 2002:adf:dd81:: with SMTP id x1mr63116515wrl.7.1594304010865; Thu, 09 Jul 2020 07:13:30 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f12sm5629079wrw.53.2020.07.09.07.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:28 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8E10B1FF8C; Thu, 9 Jul 2020 15:13:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 02/13] docs/devel: add some notes on tcg-icount for developers Date: Thu, 9 Jul 2020 15:13:16 +0100 Message-Id: <20200709141327.14631-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, Peter Maydell , berrange@redhat.com, robert.foley@linaro.org, Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, Pavel Dovgalyuk , kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This attempts to bring together my understanding of the requirements for icount behaviour into one reference document for our developer notes. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Cc: Paolo Bonzini Cc: Pavel Dovgalyuk Cc: Peter Maydell Message-Id: <20200619135844.23307-1-alex.bennee@linaro.org> --- v2 - fix copyright date - it's -> its - drop mentioned of gen_io_end() - remove and correct original conjecture v3 - include link in index v4 - Grammar fixes from Peter - re-worded final section --- docs/devel/index.rst | 1 + docs/devel/tcg-icount.rst | 97 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 docs/devel/tcg-icount.rst -- 2.20.1 Reviewed-by: Emilio G. Cota diff --git a/docs/devel/index.rst b/docs/devel/index.rst index 4ecaea3643fb..ae6eac7c9c66 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -23,6 +23,7 @@ Contents: decodetree secure-coding-practices tcg + tcg-icount multi-thread-tcg tcg-plugins bitops diff --git a/docs/devel/tcg-icount.rst b/docs/devel/tcg-icount.rst new file mode 100644 index 000000000000..8d67b6c076a7 --- /dev/null +++ b/docs/devel/tcg-icount.rst @@ -0,0 +1,97 @@ +.. + Copyright (c) 2020, Linaro Limited + Written by Alex Bennée + + +======================== +TCG Instruction Counting +======================== + +TCG has long supported a feature known as icount which allows for +instruction counting during execution. This should not be confused +with cycle accurate emulation - QEMU does not attempt to emulate how +long an instruction would take on real hardware. That is a job for +other more detailed (and slower) tools that simulate the rest of a +micro-architecture. + +This feature is only available for system emulation and is +incompatible with multi-threaded TCG. It can be used to better align +execution time with wall-clock time so a "slow" device doesn't run too +fast on modern hardware. It can also provides for a degree of +deterministic execution and is an essential part of the record/replay +support in QEMU. + +Core Concepts +============= + +At its heart icount is simply a count of executed instructions which +is stored in the TimersState of QEMU's timer sub-system. The number of +executed instructions can then be used to calculate QEMU_CLOCK_VIRTUAL +which represents the amount of elapsed time in the system since +execution started. Depending on the icount mode this may either be a +fixed number of ns per instruction or adjusted as execution continues +to keep wall clock time and virtual time in sync. + +To be able to calculate the number of executed instructions the +translator starts by allocating a budget of instructions to be +executed. The budget of instructions is limited by how long it will be +until the next timer will expire. We store this budget as part of a +vCPU icount_decr field which shared with the machinery for handling +cpu_exit(). The whole field is checked at the start of every +translated block and will cause a return to the outer loop to deal +with whatever caused the exit. + +In the case of icount, before the flag is checked we subtract the +number of instructions the translation block would execute. If this +would cause the instruction budget to go negative we exit the main +loop and regenerate a new translation block with exactly the right +number of instructions to take the budget to 0 meaning whatever timer +was due to expire will expire exactly when we exit the main run loop. + +Dealing with MMIO +----------------- + +While we can adjust the instruction budget for known events like timer +expiry we cannot do the same for MMIO. Every load/store we execute +might potentially trigger an I/O event, at which point we will need an +up to date and accurate reading of the icount number. + +To deal with this case, when an I/O access is made we: + + - restore un-executed instructions to the icount budget + - re-compile a single [1]_ instruction block for the current PC + - exit the cpu loop and execute the re-compiled block + +The new block is created with the CF_LAST_IO compile flag which +ensures the final instruction translation starts with a call to +gen_io_start() so we don't enter a perpetual loop constantly +recompiling a single instruction block. For translators using the +common translator_loop this is done automatically. + +.. [1] sometimes two instructions if dealing with delay slots + +Other I/O operations +-------------------- + +MMIO isn't the only type of operation for which we might need a +correct and accurate clock. IO port instructions and accesses to +system registers are the common examples here. These instructions have +to be handled by the individual translators which have the knowledge +of which operations are I/O operations. + +When the translator is handling an instruction of this kind: + +* it must call gen_io_start() if icount is enabled, at some + point before the generation of the code which actually does + the I/O, using a code fragment similar to: + +.. code:: c + + if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { + gen_io_start(); + } + +* it must end the TB immediately after this instruction + +Note that some older front-ends call a "gen_io_end()" function: +this is obsolete and should not be used. From patchwork Thu Jul 9 14:13:17 2020 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: 235146 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1451935ilg; Thu, 9 Jul 2020 07:13:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3yml3fGVFP6xEwjqliXM3uoa2KHgXCg7Qv2g0ajihwCJCb1Nvx+H2+FW8tPjhTNeGVCJV X-Received: by 2002:a25:8008:: with SMTP id m8mr46776613ybk.104.1594304033590; Thu, 09 Jul 2020 07:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304033; cv=none; d=google.com; s=arc-20160816; b=Ohn/wyVg7/l6ybL2LXM4B9UUR/NIBLvMPkJpD+XV8h1EdO5tiSCC8Q6pt0pOsXvw+2 UvsX/buM5/cDhFTj4P20wulgK22xg80OEiVtyjp9o/oBXbIa5SBAkVL4W1oZ4U6j/VRK x4X8bVOkOrS54VkJRlq4XTlgZHvB2RMlg/r9tU+m2KR4LdXFU9AgqgIAw6r1UTIQR8VU fyBhBtri7aKm8F9iEl65pGLCefnsZ3qUi7O/rA/KsPD5Gf548RX4/v1xNZtqsv9gCon1 2PAhzUcxndubPozghM9d0K2mdsbd/CIqIg2AuCohAVy9Ze6lwRMbppCzmcdNWWbZgm3I IFvg== 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=mziYoPJMSKM1jWfzpm/IJS+/PwzoS5VrAh2yuJs4L08=; b=jOy1DgOf2YVLeE3ghKuP9dhtGSp8C9/oX0GgX8/PuPyw0eE19SaRe5kpidg43GE2z8 7VWkjSUDgrdGqmpI7QHl+5tCtF9B2sBRP55EUPE48CZnM23CsvOULXsECaCT0FoZB1kJ f3oE4a2bqMGY7ELHuPjgjyDEazL1QmEZJL3jJVp921OpIWiFynJV9PD3ruFAEwluV8XI 8Dv/ESaLAZpWQamh85WDefVX4ht6QeapArSVZJeGEfyCKKkKdD3kniRia59Xy6o1+uqA O4/KXQjRxX3iT2Tdfa5HTgXbcKZbfH5SYqNgsAAgaFADthOOGg5RE8nGb/TBh0zVcZ3V teFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Wx4Q8ApL; 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 s14si3265434ybc.129.2020.07.09.07.13.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:13:53 -0700 (PDT) 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=Wx4Q8ApL; 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]:36784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXJB-0000Em-23 for patch@linaro.org; Thu, 09 Jul 2020 10:13:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIt-0000CS-L1 for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:35 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:52862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIr-0001K6-3c for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:35 -0400 Received: by mail-wm1-x344.google.com with SMTP id q15so1987979wmj.2 for ; Thu, 09 Jul 2020 07:13:32 -0700 (PDT) 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=mziYoPJMSKM1jWfzpm/IJS+/PwzoS5VrAh2yuJs4L08=; b=Wx4Q8ApLdOhGKHMMsOwxI5oQI2isap65v/PDZoSWpAKWJMIjygOHcVXkndbmNR4DHh FKPIxCszkTq+Vu14+NX/AIzK2pxHxSgapj46374SF9xhKglS3H3nTeI7sjD7CqwhWkkf SqMH7U+eyLHhs4Dn6P11MzRnGWi14n0wVwQGmzgGS0Gc9lYVb1ls3veqkwcHOZt9PmMR dRhEyiyQlWpHr9Vkgg6GGJjt1TyNYO2e2i3jOyyPJWL4U9s7uzvXxe021TWKuKLpw1ZI lqBrcxBUe7Qeqt3re+D8tNMDgYRsIzx+famleELpXhoIZEpKrCL96cf/aBDIIplVszeH da5A== 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=mziYoPJMSKM1jWfzpm/IJS+/PwzoS5VrAh2yuJs4L08=; b=IF1/oBWg0GDpVsO67JeTI0lXKb9fexxX/eGQbb0hLw7p7m6BGs0qI9HljVIi8ts4gH tBOFcTy7k943QM4eU8VHeoFAMbeMoWwb4+voZx/MQ5yXtErgllMEanUPE7YLExbsRrR6 VXYMElO2xAPdRNWlRkKDyAEGkzvaC3Fb8Mxl7rUyFmDpklHsWAhuXm9LO3qb3bMpfCr4 XR4E/45P9nbl2N/qKrQk20bTzxBJ237HFigNSMcPnIM3mD6DeNeqejxsqQRoYha3J1cH xqC9VG5KHha1PAdOAg5hNlsVm2nYv5RVriBDqNHEhlLEOkO1pHI1UuagbR6R+xVoJ/a8 AgpQ== X-Gm-Message-State: AOAM532vVqebKiob0W7LtKteM4tMiLIj/8DmI7pBfJvduS57HQKHHN6u aJAOsC9Js161TQZkbPZyr507Hw== X-Received: by 2002:a1c:1bc6:: with SMTP id b189mr214566wmb.166.1594304011717; Thu, 09 Jul 2020 07:13:31 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k185sm5002369wmk.47.2020.07.09.07.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:28 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A3B981FF8F; Thu, 9 Jul 2020 15:13:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 03/13] docs: Add to gdbstub documentation the PhyMemMode Date: Thu, 9 Jul 2020 15:13:17 +0100 Message-Id: <20200709141327.14631-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron The PhyMemMode gdb extension command was missing from the gdb.rst document. Signed-off-by: Jon Doron Signed-off-by: Alex Bennée Message-Id: <20200601171609.1665397-1-arilou@gmail.com> --- docs/system/gdb.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst index a40145fcf849..abda961e2b49 100644 --- a/docs/system/gdb.rst +++ b/docs/system/gdb.rst @@ -87,3 +87,23 @@ three commands you can query and set the single step behavior: (gdb) maintenance packet Qqemu.sstep=0x5 sending: "qemu.sstep=0x5" received: "OK" + + +Another feature that QEMU gdbstub provides is to toggle the memory GDB +works with, by default GDB will show the current process memory respecting +the virtual address translation. + +If you want to examine/change the physical memory you can set the gdbstub +to work with the physical memory rather with the virtual one. + +The memory mode can be checked by sending the following command: + +``maintenance packet qqemu.PhyMemMode`` + This will return either 0 or 1, 1 indicates you are currently in the + physical memory mode. + +``maintenance packet Qqemu.PhyMemMode:1`` + This will change the memory mode to physical memory. + +``maintenance packet Qqemu.PhyMemMode:0`` + This will change it back to normal memory mode. From patchwork Thu Jul 9 14:13:18 2020 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: 235150 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1454156ilg; Thu, 9 Jul 2020 07:16:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVEKTrfHgvDHElelQXZBVtnF3P/EfrITYujvQkjB7/SRFeBq5zB761+VPmAuojce7T2x0B X-Received: by 2002:a1f:2409:: with SMTP id k9mr18665118vkk.80.1594304161629; Thu, 09 Jul 2020 07:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304161; cv=none; d=google.com; s=arc-20160816; b=Wwk1bNE91VMYCQ2Tb9ZG2PgzVCPrjDpIJdPb228WkB5VejwWxUlhaSTomOqv6mvF1h ggqy5r6hrrR6p38As43jhzpCgb1053ZBYO89A9jlEAcamkzwW9a6f94Mz6HCqQy06ghi pLu3yW7qWQsIPHCzAp7qTNOSY+lpG0OKsiARjhx0amFKejl9WinwX6gQQWQSijIXtCP0 yOxTic05F4TWj8tw9P12PLLi5Xb9BmtmxL5hlZfs9MfsC9IVysjNXj3qxd3qR0GpXumV N+bUzbaXloNQ/NBMDQ3r1kcHSAsxCYzMqCT3xQrJZGrsE/W39S3XaXvqFbZgluBsHZWH pEng== 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=ZNov9lr+FZ+BjQf8kZgYjYTcVUA09W56mHbfjcwgZik=; b=o96pMkRVAPxpfhCT/US9jl+SajzP9kD9kZ4n5+xuse0xfC39iBuonGhuq+H541Ge0Z O6ML8O4n//MIUL4QN7XNrvllNBC+GwIwY0f2qRqP+2dZcJjl5tX5esx6cbAs3oKXw4mP LN739nFG9wgCfFo4HUVja3ZHD3kniFhaBNyRFGdKUg3hVc4/trJL6AcpKUWTX7YlBpV6 DacqaymdqUFvBuOkcGbtGhPHfMCWJnncLOqO55RVLTU5Jd3L9Z+LVZP5D+yUhFloi7wI U2AxMVCGkITq5FXEKJpG5YZY1eWki0E1gAiA5CH6Tge0cL7CL5fjBqLbkXO19otsaDgh ML1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="O/UzJXiE"; 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 z145si340027vsz.372.2020.07.09.07.16.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:16:01 -0700 (PDT) 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="O/UzJXiE"; 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]:45444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXLE-00048G-SM for patch@linaro.org; Thu, 09 Jul 2020 10:16:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIv-0000E0-7f for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:37 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIt-0001KR-Bw for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:36 -0400 Received: by mail-wr1-x443.google.com with SMTP id o11so2546071wrv.9 for ; Thu, 09 Jul 2020 07:13:34 -0700 (PDT) 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=ZNov9lr+FZ+BjQf8kZgYjYTcVUA09W56mHbfjcwgZik=; b=O/UzJXiEig3CtucaVVXV5U68ZCURQLwvdnnExUD+ttIk/gOz5xPsmp1Zo+5vasz6Ru BywmeDT7RGDM+tGOh+YyZEE0coO/rpfEo7TmuCkqi8Z/lOiSUWos+owG9Mqhq2VQqn6V dySPv5dZ9uGzBtU4rYt40DAmRUOIU7bmFO02RR2HsHEb3fK/s4hdRW7swEQzMrAs1CFy n0rrhEfP560Y7regfQk3Nnzid4szaV0C3dGlsAxbSSh+1B+cHQ1Oa4wXkxNVGV0+ZIXy k8Xm89UDQo9pw7oVelVnIUe+20XaPHvMq8g+WbgRS9iO+ialVqzaI/A/deECzMTdPlPH EfAA== 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=ZNov9lr+FZ+BjQf8kZgYjYTcVUA09W56mHbfjcwgZik=; b=oxDU7HhYdIp5/CQjYVD2GBcwCc37HFkjvInhCfZmvfhLFXqGLII8TKsIpesEhF9muW 0kmYXFZdaF7jadx+HPxqAyhThn8BxOYwiJw0J7KCs/XCR202p399b4zdb3lnE7exXJoA Vsv2TTTVYEQVwxi0wxZZ9bJnyLGaq4lT/AtoOHW+hLA1BIoXNMbLrENn8gxd2RkxUzDZ qlCJrNyXx5nOvcxq/2bXCwVJOzzx4uSj/VbP7o+gty0cM41As/xCx51qbFNtZW9IfFr+ eV6adjZAUUiMChfpdE6GE6Zk8s2S/uOVHQ8gqcewwjxfoK1+q0fwMPXhJNG2X6c7OiDx fFMA== X-Gm-Message-State: AOAM533C2xYTrN8JMsWWfkuJTRYfzr1D56G97EpVBCFJL9xG3nwWXiEo usLv5SmM8Iskp9w5cAx3KIRFOw== X-Received: by 2002:a5d:6748:: with SMTP id l8mr70667319wrw.347.1594304013905; Thu, 09 Jul 2020 07:13:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m16sm6378753wro.0.2020.07.09.07.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BCC421FF90; Thu, 9 Jul 2020 15:13:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 04/13] cputlb: ensure we save the IOTLB data in case of reset Date: Thu, 9 Jul 2020 15:13:18 +0100 Message-Id: <20200709141327.14631-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, Eduardo Habkost , aurelien@aurel32.net, Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Any write to a device might cause a re-arrangement of memory triggering a TLB flush and potential re-size of the TLB invalidating previous entries. This would cause users of qemu_plugin_get_hwaddr() to see the warning: invalid use of qemu_plugin_get_hwaddr because of the failed tlb_lookup which should always succeed. To prevent this we save the IOTLB data in case it is later needed by a plugin doing a lookup. Signed-off-by: Alex Bennée --- v2 - save the entry instead of re-running the tlb_fill. v3 - don't abuse TLS, use CPUState to store data - just use g_free_rcu() to avoid ugliness - verify addr matches before returning data - ws fix --- include/hw/core/cpu.h | 4 +++ include/qemu/typedefs.h | 1 + accel/tcg/cputlb.c | 57 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 60 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Emilio G. Cota diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index b3f4b7931823..bedbf098dc57 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -417,7 +417,11 @@ struct CPUState { DECLARE_BITMAP(plugin_mask, QEMU_PLUGIN_EV_MAX); +#ifdef CONFIG_PLUGIN GArray *plugin_mem_cbs; + /* saved iotlb data from io_writex */ + SavedIOTLB *saved_iotlb; +#endif /* TODO Move common fields from CPUArchState here. */ int cpu_index; diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 15f5047bf1dc..427027a9707a 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -116,6 +116,7 @@ typedef struct QObject QObject; typedef struct QString QString; typedef struct RAMBlock RAMBlock; typedef struct Range Range; +typedef struct SavedIOTLB SavedIOTLB; typedef struct SHPCDevice SHPCDevice; typedef struct SSIBus SSIBus; typedef struct VirtIODevice VirtIODevice; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 1e815357c709..8636b66e036a 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1073,6 +1073,42 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry, return val; } +#ifdef CONFIG_PLUGIN + +typedef struct SavedIOTLB { + struct rcu_head rcu; + hwaddr addr; + MemoryRegionSection *section; + hwaddr mr_offset; +} SavedIOTLB; + +/* + * Save a potentially trashed IOTLB entry for later lookup by plugin. + * + * We also need to track the thread storage address because the RCU + * cleanup that runs when we leave the critical region (the current + * execution) is actually in a different thread. + */ +static void save_iotlb_data(CPUState *cs, hwaddr addr, MemoryRegionSection *section, hwaddr mr_offset) +{ + SavedIOTLB *old, *new = g_new(SavedIOTLB, 1); + new->addr = addr; + new->section = section; + new->mr_offset = mr_offset; + old = atomic_rcu_read(&cs->saved_iotlb); + atomic_rcu_set(&cs->saved_iotlb, new); + if (old) { + g_free_rcu(old, rcu); + } +} + +#else +static void save_iotlb_data(CPUState *cs, hwaddr addr, MemoryRegionSection *section, hwaddr mr_offset) +{ + /* do nothing */ +} +#endif + static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, int mmu_idx, uint64_t val, target_ulong addr, uintptr_t retaddr, MemOp op) @@ -1092,6 +1128,12 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry, } cpu->mem_io_pc = retaddr; + /* + * The memory_region_dispatch may trigger a flush/resize + * so for plugins we save the iotlb_data just in case. + */ + save_iotlb_data(cpu, iotlbentry->addr, section, mr_offset); + if (mr->global_locking && !qemu_mutex_iothread_locked()) { qemu_mutex_lock_iothread(); locked = true; @@ -1381,8 +1423,11 @@ void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr, * in the softmmu lookup code (or helper). We don't handle re-fills or * checking the victim table. This is purely informational. * - * This should never fail as the memory access being instrumented - * should have just filled the TLB. + * This almost never fails as the memory access being instrumented + * should have just filled the TLB. The one corner case is io_writex + * which can cause TLB flushes and potential resizing of the TLBs + * loosing the information we need. In those cases we need to recover + * data from a copy of the io_tlb entry. */ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx, @@ -1406,6 +1451,14 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx, data->v.ram.hostaddr = addr + tlbe->addend; } return true; + } else { + SavedIOTLB *saved = atomic_rcu_read(&cpu->saved_iotlb); + if (saved && saved->addr == tlb_addr) { + data->is_io = true; + data->v.io.section = saved->section; + data->v.io.offset = saved->mr_offset; + return true; + } } return false; } From patchwork Thu Jul 9 14:13:19 2020 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: 235153 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1454916ilg; Thu, 9 Jul 2020 07:16:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxovrOA8z5lIUT+CHLrEhAZ0/dbLGrKDwJ8sJROteZpIR7EFi4PA0ph/yzseoVVB3HIDWrx X-Received: by 2002:ab0:4e98:: with SMTP id l24mr14774307uah.15.1594304212566; Thu, 09 Jul 2020 07:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304212; cv=none; d=google.com; s=arc-20160816; b=kGcYZRAru7n8zWYEjdaufVbKxWLxQr48+2M6sNQtdwhjgPIZrpmOgrySj9q6HOjuli Aqmc/vX/j+a8xwk3Gy1I5J4MKA7ISkYbgppBvmm2HGYlEC734FAXMEMI75HqMDpIj+KE 0xBxPGRNbgNy4VE8K4bGqMu/8+KPp7kOg3s9CNzVUTOX9nFWtdRF6F5sxXr7svZ86XHM 3kaJELbx3ixOBq39Mux8sSI1IHXBW8J79/HBZTnnslWxuQGE0+Z2kurkxMYaxyUwjGxS HiYzip/htSg6C3cGygaD0ImJ5drF9txmyg10DmjDiHMJB4wMqzN2GL/GTgxiVjP6S8Bn eKfg== 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=OBrRMeGy/wov/DYQ76yj5VunpgQV0jWyBVFTMMvKctw=; b=X124X6FgmgLLUI7q7U+thaeG2OdsYI/uTqOxnuqbothSfdVlVu+OpORxoLY9EXq1dQ l5wOBRcAG91t7T3YChZVeQis1wfDZRoDJL0BWkN0MCXvr9ITWESqeZbPrb81dhLGEtLc jW7/Dn6kRGj6dxyak5NtXV3GA8eQRFIecpbMOc3YcZBtZoaXAZov2zYEGnZyAMVXgTIX czPmcglaIV4WvdO2uzmdw3eWTKoyJ8Z8FzJvv5JPc4uVNlDJW9wJWddDuZkgz1jQm6o5 kjzgMJEN+goLOMkzW8sQwORCplMQu8wg+E04f5+ZwEQVFSiZpK06Uh6pMKKSM4NwRWh6 XRQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=nwHuQ3DK; 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 h25si398397uan.111.2020.07.09.07.16.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:16:52 -0700 (PDT) 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=nwHuQ3DK; 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]:48152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXM3-0005Dc-St for patch@linaro.org; Thu, 09 Jul 2020 10:16:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIx-0000JN-Bm for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:39 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIv-0001Ku-Ir for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:39 -0400 Received: by mail-wr1-x443.google.com with SMTP id z15so2541468wrl.8 for ; Thu, 09 Jul 2020 07:13:37 -0700 (PDT) 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=OBrRMeGy/wov/DYQ76yj5VunpgQV0jWyBVFTMMvKctw=; b=nwHuQ3DKzTp8JC9JTVslsyRvuphhDm8WFMC07jcbllaLsRTF+N5f4Es8GK7ZkhcekK F0eNi72RkpFTnDVbgFxsM/gunzQOWcSWW8s9Kcvg4RQZ9R1HRS6BqzR8UH0mbc8ZUUv6 Fv442IgY863tCbKKtAb7GzCL/hvmVY60rLafTdlpPiC47/23o/Kr5cn5TZgPvcW36mxn 1Pvq+wEjoz5rqSnW9/wVVvGDdkmOfzunI+AVLOkc6zqyzLu6ogzEptrBJeHHQgRjZTro ESmTNu40HllAZDTpILxTLAao7eFhcRSDM4dGfxD/ZfpRUUL0ly/iqO4uIKgJGJcQs0XB MtcQ== 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=OBrRMeGy/wov/DYQ76yj5VunpgQV0jWyBVFTMMvKctw=; b=kjaRf2OnVKRBP0FdJqzv4gddNxa7/IQXoQ9be0WoieoHOjWoRl3NusqEWQpA7haU67 wjvbR8fHtqB/3A+P4y9t+1rT+YKCmcMWWK0VaOyd6bd6ZKIdzROdq09a4SrlAN2D8QGJ 1pEUelcxAJ9VR2xrW5h7IHDBc2v8/qt+YVgtLw/uNKRot7pEE5fLIgZ5jEppjsNwNrVC uGn2Wac26+LHEGFnV9j2Dz1XZ3KZUaHZlGD4IX93LygwWM0FncldpKiL809W8DDAO9mR CrjMAw1obTnxuJVnZn6v7/Z9ZSdET4kJuM7EZrncI37bbV8uNec1vG4lO8Z+53FPzRRL 9LBg== X-Gm-Message-State: AOAM531QIJmP+ASLbOWv6KvT0y/9HEPTfMjcs6m7ztibuN4QFzUlMzSs sWEu4wY9eT0jbTTxO912BvGJhQ== X-Received: by 2002:a5d:68cc:: with SMTP id p12mr62816127wrw.111.1594304016340; Thu, 09 Jul 2020 07:13:36 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f186sm4945611wmf.29.2020.07.09.07.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D2DAD1FF91; Thu, 9 Jul 2020 15:13:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 05/13] hw/virtio/pci: include vdev name in registered PCI sections Date: Thu, 9 Jul 2020 15:13:19 +0100 Message-Id: <20200709141327.14631-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, "Michael S . Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When viewing/debugging memory regions it is sometimes hard to figure out which PCI device something belongs to. Make the names unique by including the vdev name in the name string. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin --- v2 - swap ()'s for an extra - --- hw/virtio/virtio-pci.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 8554cf2a038e..215e680c71f4 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1406,7 +1406,8 @@ static void virtio_pci_device_write(void *opaque, hwaddr addr, } } -static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) +static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy, + const char *vdev_name) { static const MemoryRegionOps common_ops = { .read = virtio_pci_common_read, @@ -1453,36 +1454,41 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) }, .endianness = DEVICE_LITTLE_ENDIAN, }; + g_autoptr(GString) name = g_string_new(NULL); - + g_string_printf(name, "virtio-pci-common-%s", vdev_name); memory_region_init_io(&proxy->common.mr, OBJECT(proxy), &common_ops, proxy, - "virtio-pci-common", + name->str, proxy->common.size); + g_string_printf(name, "virtio-pci-isr-%s", vdev_name); memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), &isr_ops, proxy, - "virtio-pci-isr", + name->str, proxy->isr.size); + g_string_printf(name, "virtio-pci-device-%s", vdev_name); memory_region_init_io(&proxy->device.mr, OBJECT(proxy), &device_ops, virtio_bus_get_device(&proxy->bus), - "virtio-pci-device", + name->str, proxy->device.size); + g_string_printf(name, "virtio-pci-notify-%s", vdev_name); memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), ¬ify_ops, virtio_bus_get_device(&proxy->bus), - "virtio-pci-notify", + name->str, proxy->notify.size); + g_string_printf(name, "virtio-pci-notify-pio-%s", vdev_name); memory_region_init_io(&proxy->notify_pio.mr, OBJECT(proxy), ¬ify_pio_ops, virtio_bus_get_device(&proxy->bus), - "virtio-pci-notify-pio", + name->str, proxy->notify_pio.size); } @@ -1623,7 +1629,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) struct virtio_pci_cfg_cap *cfg_mask; - virtio_pci_modern_regions_init(proxy); + virtio_pci_modern_regions_init(proxy, vdev->name); virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); From patchwork Thu Jul 9 14:13:20 2020 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: 235151 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1454119ilg; Thu, 9 Jul 2020 07:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydB0AHwlwTEvJ4E14YG2F+/gg5hSGWtGG96sMJ5Vv7HZm3XELrRJaHI3x1aeSuNhNxt9/J X-Received: by 2002:ab0:3a1:: with SMTP id 30mr47545044uau.29.1594304159010; Thu, 09 Jul 2020 07:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304159; cv=none; d=google.com; s=arc-20160816; b=hZknfhKG176Mno1De/CS+Rzozj/NPKdXTUv3MNbN+Slv8wlm6PJAiwevJTLTRa3cOL ifZj6Jo8+JrYvwBVmFkl0kGaVjKpqTiunltPOqre7Ms0WVXaLGJwvVSReXM2Y00ble9i noO2jxakoVeFPWvrICCCKm3tdBiqx8qzZxq9sKJIHHehXdldd0QKAFjND2dQBTzqrrCH hNmm5OtqnA6JAQTrT134GspkiYMc4h3ZtQwMv//naYTxR5M2cb1zcGrz+5B92fIeGTEF 9avFVBwIcUOmYnOU61q8RfzDjTpxWpmvABiMcgh+LHCZzyjET0nlpnInzGIQQ+3PqHhX OW4g== 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=M56C/7edPLiM8JWg+URAkFUT+3dv8mHH/cx2urJlkD0=; b=nR6tzhcTKui4Wi9fcg6mwZWQ0LjI5obv9Nts/5w84ILvjFTkDZra7nbER9d15Gz/JZ GauFxEh9PfCmfPiiJT3n9xqUxukUZVIVwdqOhX6p6N8iPkgAI2ET8ASM7wfuhP6v9khf H/aIWRpcK1+dHt7VH/QtDZGx3K1yZuNj+3cFdSzXpZ9wHof+uz7mUBVdoa5A9sGq2M63 GX4IK/MvsgN4S0g9uIfTyOaQzEMIsTeUApxvruqVQtPqoggAsvYvDrvzVkgtAwE1teyw L8XrVRKCWChXbOHHKPGzEuR2wysVKIKA4HDG7lK/WNyvR+U2EIN/OsKEN/29g5xCLm8Y YHwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sd9PeuDB; 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 h9si363668vsf.79.2020.07.09.07.15.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:15:59 -0700 (PDT) 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=sd9PeuDB; 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]:45180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXLC-000411-5o for patch@linaro.org; Thu, 09 Jul 2020 10:15:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIw-0000Gh-Gv for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:38 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:46341) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIu-0001Kk-Q6 for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:38 -0400 Received: by mail-wr1-x443.google.com with SMTP id r12so2513278wrj.13 for ; Thu, 09 Jul 2020 07:13:36 -0700 (PDT) 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=M56C/7edPLiM8JWg+URAkFUT+3dv8mHH/cx2urJlkD0=; b=sd9PeuDB/N/2DQ1AvxPNnCUxMyAonBgFqnNk/oHcyVkonhb7LpHeb5TNrbzSz/QXQB UptrUe8BVws5sjl9+4uvEaCSsVVIRSWxQBoHnrrJEvglnKY03EUrJn5aTqc6bTdOppqF RwaaE7zSf7lQ2Sx9jBx2/h6ZIk0vK/I2FJdOleuwF2FD4oAqP9dGauo8gkAJspTyk+im i05nTQBBYN23iELtbGrwnEzMz1KJjZLI+8otc3mFF0z7mHsP7/XffepxxWPMtB0ZoyxL Z9rVMMHP2gviEUFm5UZUNWi0GELhUDF1h5IrZ2g69i2KW8ByZWHxhQOVSXQS/d4LzB2j 2Icw== 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=M56C/7edPLiM8JWg+URAkFUT+3dv8mHH/cx2urJlkD0=; b=LGL1dfyiJ7gr/LAIKPtx4vT9FZJ4Prnh/yOrJDN/4LJQTcon8BBrjX7M0EXTECwK63 J9baEKrMAktMEZBnPy5Rx4dRXFeJMBTwHHmZCqMu8pmJ34Aolpr46aERPJ719eZ8D0pe OgtwnVdTh3nNHQkq/E1vYvrR4rF1w2btLzapnm70DpkAp8Z989p+kNzBMD8tCBaNw+GS TimZeF5hLU5R5IKTOxoPReROzrKSe7q2IkKFbch3wjhJHrEC7SapbZLgSldrctuMo/ed g0fhuVz82rhT5zsqhFC007Lcrf0BVjqBQEdlHck17CVYN0dIpBBFW+Zcme0rTiywM2R9 +u5g== X-Gm-Message-State: AOAM533cmE2P+91K/cH0JeecI/vLyYm/O+HnTyqH+YNr1EL58xRa4Hp+ I712RGEb1qE8D89oUgUyLGRjLA== X-Received: by 2002:a5d:60c5:: with SMTP id x5mr29473461wrt.67.1594304015356; Thu, 09 Jul 2020 07:13:35 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m10sm5738399wru.4.2020.07.09.07.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EA48A1FF92; Thu, 9 Jul 2020 15:13:27 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 06/13] plugins: add API to return a name for a IO device Date: Thu, 9 Jul 2020 15:13:20 +0100 Message-Id: <20200709141327.14631-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, Clement Deschamps , aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This may well end up being anonymous but it should always be unique. Signed-off-by: Alex Bennée [r-b provisional given change to g_intern_string] Reviewed-by: Clement Deschamps Reviewed-by: Emilio G. Cota --- v3 - return a non-freeable const g_intern_string() - checkpatch cleanups --- include/qemu/qemu-plugin.h | 6 ++++++ plugins/api.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) -- 2.20.1 diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index bab8b0d4b3af..c98c18d6b052 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -335,6 +335,12 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info, bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr); uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr *haddr); +/* + * Returns a string representing the device. The string is valid for + * the lifetime of the plugin. + */ +const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h); + typedef void (*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, qemu_plugin_meminfo_t info, uint64_t vaddr, diff --git a/plugins/api.c b/plugins/api.c index bbdc5a4eb46d..4304e63f0cf8 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -303,6 +303,26 @@ uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr *haddr return 0; } +const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h) +{ +#ifdef CONFIG_SOFTMMU + if (h && h->is_io) { + MemoryRegionSection *mrs = h->v.io.section; + if (!mrs->mr->name) { + unsigned long maddr = 0xffffffff & (uintptr_t) mrs->mr; + g_autofree char *temp = g_strdup_printf("anon%08lx", maddr); + return g_intern_string(temp); + } else { + return g_intern_string(mrs->mr->name); + } + } else { + return g_intern_string("RAM"); + } +#else + return g_intern_string("Invalid"); +#endif +} + /* * Queries to the number and potential maximum number of vCPUs there * will be. This helps the plugin dimension per-vcpu arrays. From patchwork Thu Jul 9 14:13:21 2020 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: 235158 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1458981ilg; Thu, 9 Jul 2020 07:21:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHUs8ZqKCF2o49YoVnHNmWJDsiFSjoRFLV46ZDohsftUcVBA20xAGR/CZCYxaszY+f2TOl X-Received: by 2002:a25:8808:: with SMTP id c8mr15554339ybl.422.1594304497508; Thu, 09 Jul 2020 07:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304497; cv=none; d=google.com; s=arc-20160816; b=uXv7cnA05+jN3+/pxrm7wRiejwNYubvxUcddT4jKO6j0cBhuKfVvqqDV2AlJg6Zr3u W8lfOkmyHs3MjBnKoGCabAH0v+zuOD6ec587YFoXlu4sdOZWW8IxLtjXs/CaYfjEYF/1 wHaCidZE0nZ1lvE+63kc2oOv6x0SP9A6dyf0dpZ/Bc4wpGR2HN8RgUtWi0i6ZWMFwb5T wBT0nHJdYQIKX693fnHFu2uXihKOYZ2amI1mDdNlM4AZRLRdqP/2wj2Y8an1cwS4Djgk qaEs+MIBuSY1A5LohGAEpzxF0+PTNtgjEPgYpYxlBZ5B+SoZpE2kNG1yKElbK9i1+fs/ dQOg== 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=ijru7vfuo0rF0FQiZmJ4xzr85Qw/JDmcUhGplkCDPx8=; b=fPj5O3Z9F/5j8liQONYEnNhG0VvxYMfO5mrj6n0+t2U/rb4fNNahVQDbtrRJsR1Lz6 Q4xcfRjjLS36nYLQnn/PbbZ9Q4wkOJgeFs8pcj6zUtovAzFOfBjWlo4RbwBwJ0tZGC7E Lg3k993USHjI45lAquv0rWmeDz/GDqHEK4JAsFEb9oRA/EM46qagv4qZVvtaSCpcPV5H hZgBFMM+TdGdDwL0w2NSYaE/THR2TgGZh5E+6oP7GwcrmlBRbQdDv82g2tXmtVwilm3D npuvnopn9nqffprlB8wdabtqATEKkTW/XFIsigI+zpv/7ZPI6ieaw+zHfGLyU3Q3Tj7H xJ3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S3iVwUZj; 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 r9si2781068ybm.175.2020.07.09.07.21.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:21:37 -0700 (PDT) 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=S3iVwUZj; 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]:34042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXQe-0002ik-S4 for patch@linaro.org; Thu, 09 Jul 2020 10:21:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXJ6-0000YO-Kr for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:48 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXJ4-0001Lc-7s for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:48 -0400 Received: by mail-wr1-x42c.google.com with SMTP id k6so2562595wrn.3 for ; Thu, 09 Jul 2020 07:13:42 -0700 (PDT) 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=ijru7vfuo0rF0FQiZmJ4xzr85Qw/JDmcUhGplkCDPx8=; b=S3iVwUZjHDJZDZuyhj+yTgH4bbYUQr9euBhlOv9yMhNuK22V43NImYbZjebxqI2hd3 fYaHQgt05+FYw2DBZ3QLoRkMlFOwXAJ3xbA3gusj/zZx3vCsCULV+3xWtXca2KSWaqEl noyDJ1BSMzffHSHHDgj0uOeZXiBX2/Kl9+4TfwY9Y/cio+9JP15+5HUYHDCFhYljgjqY JuRMEDsBa6W6K/4wU1v8YfiaWkkboxI3nH4FOhKH7qYgFm3iNnuwgx6j24qGlNhA2HLB Q5cyGV85wbCVJwaI1lIjLZRiFf6l/YVkijeFGXscxxNU/JfahBts78jVih+4+IDHprqL dHjw== 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=ijru7vfuo0rF0FQiZmJ4xzr85Qw/JDmcUhGplkCDPx8=; b=lW0ge80xQ0EUGG2Omk6Sj/3Acu65I8bHGmYFPcICi5/4rSw5NA+uLzmDBbMMMVAMHp g0v6JCcqiTmFOb/gJjA5Bto98BLNfMQnB7JUJbnF8oz7F4ijPC40yZSq98mU0uVCGUhU CQ4Tlqbiv+7X/3aBtRvnDZWrFaVNyiYx98kPTe7AQb9KI2//ISHtVH7EenTy0ThGqQkK RojATaGzkadWzQburCgJvhAS2xEqZGUm4AEazzhkFiXWxNBId5l2KuantgCHMV2Ntl4o OM4JccjLF/us27hjpvYrsYi/lX/8mXPuFFJXsAFg0v6Yw7kMdDxn65l652YFzhdFwgEw /+Hw== X-Gm-Message-State: AOAM531q/vLNEjcsMk+QkYluQCYDPeGIGBMlouvpYI0W+JdcLwrHaaxZ 8c5QLxQMzOZ7rqMg+sD2PAtDcg== X-Received: by 2002:a5d:5686:: with SMTP id f6mr62620207wrv.15.1594304020957; Thu, 09 Jul 2020 07:13:40 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u8sm5431717wrt.28.2020.07.09.07.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 107A11FF93; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 07/13] plugins: new hwprofile plugin Date: Thu, 9 Jul 2020 15:13:21 +0100 Message-Id: <20200709141327.14631-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is a plugin intended to help with profiling access to various bits of system hardware. It only really makes sense for system emulation. It takes advantage of the recently exposed helper API that allows us to see the device name (memory region name) associated with a device. You can specify arg=read or arg=write to limit the tracking to just reads or writes (by default it does both). The pattern option: -plugin ./tests/plugin/libhwprofile.so,arg=pattern will allow you to see the access pattern to devices, eg: gic_cpu @ 0xffffffc010040000 off:00000000, 8, 1, 8, 1 off:00000000, 4, 1, 4, 1 off:00000000, 2, 1, 2, 1 off:00000000, 1, 1, 1, 1 The source option: -plugin ./tests/plugin/libhwprofile.so,arg=source will track the virtual source address of the instruction making the access: pl011 @ 0xffffffc010031000 pc:ffffffc0104c785c, 1, 4, 0, 0 pc:ffffffc0104c7898, 1, 4, 0, 0 pc:ffffffc010512bcc, 2, 1867, 0, 0 You cannot mix source and pattern. Finally the match option allow you to limit the tracking to just the devices you care about. Signed-off-by: Alex Bennée Reviewed-by: Robert Foley Tested-by: Robert Foley --- v2 - use 64 bit cpu masks - warn if we will exceed cpu mask capability - don't run in linux-user mode - skip in check-tcg for linux-user test v3 - update device name API - re-factor and clean-up - add source tracking - use direct hash for source/pattern - add match function - expand the commit message - checkpatch cleanups --- tests/plugin/hwprofile.c | 305 ++++++++++++++++++++++++++++++++++++++ tests/plugin/Makefile | 1 + tests/tcg/Makefile.target | 12 +- 3 files changed, 316 insertions(+), 2 deletions(-) create mode 100644 tests/plugin/hwprofile.c -- 2.20.1 diff --git a/tests/plugin/hwprofile.c b/tests/plugin/hwprofile.c new file mode 100644 index 000000000000..6dac1d5f8541 --- /dev/null +++ b/tests/plugin/hwprofile.c @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2020, Alex Bennée + * + * HW Profile - breakdown access patterns for IO to devices + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +typedef struct { + uint64_t cpu_read; + uint64_t cpu_write; + uint64_t reads; + uint64_t writes; +} IOCounts; + +typedef struct { + uint64_t off_or_pc; + IOCounts counts; +} IOLocationCounts; + +typedef struct { + const char *name; + uint64_t base; + IOCounts totals; + GHashTable *detail; +} DeviceCounts; + +static GMutex lock; +static GHashTable *devices; + +/* track the access pattern to a piece of HW */ +static bool pattern; +/* track the source address of access to HW */ +static bool source; +/* track only matched regions of HW */ +static bool check_match; +static gchar **matches; + +static enum qemu_plugin_mem_rw rw = QEMU_PLUGIN_MEM_RW; + +static inline bool track_reads(void) +{ + return rw == QEMU_PLUGIN_MEM_RW || rw == QEMU_PLUGIN_MEM_R; +} + +static inline bool track_writes(void) +{ + return rw == QEMU_PLUGIN_MEM_RW || rw == QEMU_PLUGIN_MEM_W; +} + +static void plugin_init(void) +{ + devices = g_hash_table_new(NULL, NULL); +} + +static gint sort_cmp(gconstpointer a, gconstpointer b) +{ + DeviceCounts *ea = (DeviceCounts *) a; + DeviceCounts *eb = (DeviceCounts *) b; + return ea->totals.reads + ea->totals.writes > + eb->totals.reads + eb->totals.writes ? -1 : 1; +} + +static gint sort_loc(gconstpointer a, gconstpointer b) +{ + IOLocationCounts *ea = (IOLocationCounts *) a; + IOLocationCounts *eb = (IOLocationCounts *) b; + return ea->off_or_pc > eb->off_or_pc; +} + +static void fmt_iocount_record(GString *s, IOCounts *rec) +{ + if (track_reads()) { + g_string_append_printf(s, ", %"PRIx64", %"PRId64, + rec->cpu_read, rec->reads); + } + if (track_writes()) { + g_string_append_printf(s, ", %"PRIx64", %"PRId64, + rec->cpu_write, rec->writes); + } +} + +static void fmt_dev_record(GString *s, DeviceCounts *rec) +{ + g_string_append_printf(s, "%s, 0x%"PRIx64, + rec->name, rec->base); + fmt_iocount_record(s, &rec->totals); + g_string_append_c(s, '\n'); +} + +static void plugin_exit(qemu_plugin_id_t id, void *p) +{ + g_autoptr(GString) report = g_string_new(""); + GList *counts; + + if (!(pattern || source)) { + g_string_printf(report, "Device, Address"); + if (track_reads()) { + g_string_append_printf(report, ", RCPUs, Reads"); + } + if (track_writes()) { + g_string_append_printf(report, ", WCPUs, Writes"); + } + g_string_append_c(report, '\n'); + } + + counts = g_hash_table_get_values(devices); + if (counts && g_list_next(counts)) { + GList *it; + + it = g_list_sort(counts, sort_cmp); + + while (it) { + DeviceCounts *rec = (DeviceCounts *) it->data; + if (rec->detail) { + GList *accesses = g_hash_table_get_values(rec->detail); + GList *io_it = g_list_sort(accesses, sort_loc); + const char *prefix = pattern ? "off" : "pc"; + g_string_append_printf(report, "%s @ 0x%"PRIx64"\n", + rec->name, rec->base); + while (io_it) { + IOLocationCounts *loc = (IOLocationCounts *) io_it->data; + g_string_append_printf(report, " %s:%08"PRIx64, + prefix, loc->off_or_pc); + fmt_iocount_record(report, &loc->counts); + g_string_append_c(report, '\n'); + io_it = io_it->next; + } + } else { + fmt_dev_record(report, rec); + } + it = it->next; + }; + g_list_free(it); + } + + qemu_plugin_outs(report->str); +} + +static DeviceCounts *new_count(const char *name, uint64_t base) +{ + DeviceCounts *count = g_new0(DeviceCounts, 1); + count->name = name; + count->base = base; + if (pattern || source) { + count->detail = g_hash_table_new(NULL, NULL); + } + g_hash_table_insert(devices, (gpointer) name, count); + return count; +} + +static IOLocationCounts *new_location(GHashTable *table, uint64_t off_or_pc) +{ + IOLocationCounts *loc = g_new0(IOLocationCounts, 1); + loc->off_or_pc = off_or_pc; + g_hash_table_insert(table, (gpointer) off_or_pc, loc); + return loc; +} + +static void hwprofile_match_hit(DeviceCounts *rec, uint64_t off) +{ + g_autoptr(GString) report = g_string_new("hwprofile: match @ offset"); + g_string_append_printf(report, "%"PRIx64", previous hits\n", off); + fmt_dev_record(report, rec); + qemu_plugin_outs(report->str); +} + +static void inc_count(IOCounts *count, bool is_write, unsigned int cpu_index) +{ + if (is_write) { + count->writes++; + count->cpu_write |= (1 << cpu_index); + } else { + count->reads++; + count->cpu_read |= (1 << cpu_index); + } +} + +static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, + uint64_t vaddr, void *udata) +{ + struct qemu_plugin_hwaddr *hwaddr = qemu_plugin_get_hwaddr(meminfo, vaddr); + + if (!hwaddr || !qemu_plugin_hwaddr_is_io(hwaddr)) { + return; + } else { + const char *name = qemu_plugin_hwaddr_device_name(hwaddr); + uint64_t off = qemu_plugin_hwaddr_device_offset(hwaddr); + bool is_write = qemu_plugin_mem_is_store(meminfo); + DeviceCounts *counts; + + g_mutex_lock(&lock); + counts = (DeviceCounts *) g_hash_table_lookup(devices, name); + + if (!counts) { + uint64_t base = vaddr - off; + counts = new_count(name, base); + } + + if (check_match) { + if (g_strv_contains((const char * const *)matches, counts->name)) { + hwprofile_match_hit(counts, off); + inc_count(&counts->totals, is_write, cpu_index); + } + } else { + inc_count(&counts->totals, is_write, cpu_index); + } + + /* either track offsets or source of access */ + if (source) { + off = (uint64_t) udata; + } + + if (pattern || source) { + IOLocationCounts *io_count = g_hash_table_lookup(counts->detail, + (gpointer) off); + if (!io_count) { + io_count = new_location(counts->detail, off); + } + inc_count(&io_count->counts, is_write, cpu_index); + } + + g_mutex_unlock(&lock); + } +} + +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + size_t n = qemu_plugin_tb_n_insns(tb); + size_t i; + + for (i = 0; i < n; i++) { + struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i); + gpointer udata = (gpointer) (source ? qemu_plugin_insn_vaddr(insn) : 0); + qemu_plugin_register_vcpu_mem_cb(insn, vcpu_haddr, + QEMU_PLUGIN_CB_NO_REGS, + rw, udata); + } +} + +QEMU_PLUGIN_EXPORT +int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, + int argc, char **argv) +{ + int i; + + for (i = 0; i < argc; i++) { + char *opt = argv[i]; + if (g_strcmp0(opt, "read") == 0) { + rw = QEMU_PLUGIN_MEM_R; + } else if (g_strcmp0(opt, "write") == 0) { + rw = QEMU_PLUGIN_MEM_W; + } else if (g_strcmp0(opt, "pattern") == 0) { + pattern = true; + } else if (g_strcmp0(opt, "source") == 0) { + source = true; + } else if (g_str_has_prefix(opt, "match")) { + gchar **parts = g_strsplit(opt, "=", 2); + check_match = true; + matches = g_strsplit(parts[1], ",", -1); + g_strfreev(parts); + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + + if (source && pattern) { + fprintf(stderr, "can only currently track either source or pattern.\n"); + return -1; + } + + if (!info->system_emulation) { + fprintf(stderr, "hwprofile: plugin only useful for system emulation\n"); + return -1; + } + + /* Just warn about overflow */ + if (info->system.smp_vcpus > 64 || + info->system.max_vcpus > 64) { + fprintf(stderr, "hwprofile: can only track up to 64 CPUs\n"); + } + + plugin_init(); + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); + return 0; +} diff --git a/tests/plugin/Makefile b/tests/plugin/Makefile index 3a50451428b4..0cb8e35ae407 100644 --- a/tests/plugin/Makefile +++ b/tests/plugin/Makefile @@ -14,6 +14,7 @@ NAMES += hotblocks NAMES += howvec NAMES += hotpages NAMES += lockstep +NAMES += hwprofile SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES))) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 4b2b696fcee3..bc595b058845 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -129,8 +129,16 @@ ifeq ($(CONFIG_PLUGIN),y) PLUGIN_SRC=$(SRC_PATH)/tests/plugin PLUGIN_LIB=../../plugin VPATH+=$(PLUGIN_LIB) -PLUGINS=$(filter-out liblockstep.so,\ - $(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c)))) + +# Some plugins aren't testable automatically +SKIP_PLUGINS=liblockstep.so +ifdef CONFIG_USER_ONLY +SKIP_PLUGINS+=libhwprofile.so +endif + +PLUGINS=$(filter-out $(SKIP_PLUGINS),\ + $(patsubst %.c, lib%.so, \ + $(notdir $(wildcard $(PLUGIN_SRC)/*.c)))) # We need to ensure expand the run-plugin-TEST-with-PLUGIN # pre-requistes manually here as we can't use stems to handle it. We From patchwork Thu Jul 9 14:13:22 2020 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: 235152 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1454813ilg; Thu, 9 Jul 2020 07:16:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOk+evmZZRaDNeEHcBzAjwyPoA1WusZ2M5ACovVxS5519gsrvSRMs0G0Hq6F+V4G182T80 X-Received: by 2002:aed:3b99:: with SMTP id r25mr43094930qte.315.1594304205252; Thu, 09 Jul 2020 07:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304205; cv=none; d=google.com; s=arc-20160816; b=inHBcFLysY/0pA5sYPq8+dFia2u3EFQqFwk1KZWX1TopuX8SCZzOb/EJJR6d9v+wXm QuITWXkj8yozqqsPC3buG6uX9F1b34aWsopYZjzn22Qz2AWU5S6NOq3FH0PkIsGQnlwS CPpNOioqJhoZ6P06Zx2lI0vku+sx7RZTJxaHec6UbYCSKkIs7gEHJh0dUUJGlvkOeJgz /DCeroA0UyYZwCfcCxb9Q/kmUw2GCMoM3gYw0vXIDxPNqHQupXddPhMp20o419MVbijv FWoNuNopZmvDvHfZqjTs0zGH7edt92zAn/iHBM+ZYmO3WCbzPlvFixPv1I5jNA9yZIps iXVg== 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=xx3w/5InGdpOLaQRb40pJxZ2fJfVESZ8ECU7qAZSRME=; b=Q5DdnhesNVF/yJ6LYU1rrKmnB2IcF0hz+Wv5+JsrXBDHfm0iwkR0forbh9bujSZVaA E9W8QehqefvjU3JOTtsx9/qWhuVt3YJTOS+8PbAanos1B7OdlzaAgZiERcU3/2wZOJ3+ wcmuk7jMTrpFq5o0OB9zzKXOcLF4ymAbYCQ0qo7sQMg+iodwpcKxmJrByxspEbDESYm2 lSSq58unOsQuc5+mFNfgyvQj7bAwlkRRCpdcDOoqLcHFjNLKYQtlG0rG9LY1PwHdqOWa M36Bv8LeZG2cLdF+te4C29xUp2d9hU9PWQhGR4SVGswmUlNr5WAIOfbAleQwj1/Il2h9 2o2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WcKYEYgj; 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 g4si2066287qvz.47.2020.07.09.07.16.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:16:45 -0700 (PDT) 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=WcKYEYgj; 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]:45228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXLw-00042E-Id for patch@linaro.org; Thu, 09 Jul 2020 10:16:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIy-0000Mh-Q9 for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:40 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIw-0001L2-VV for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:40 -0400 Received: by mail-wm1-x343.google.com with SMTP id w3so1971350wmi.4 for ; Thu, 09 Jul 2020 07:13:38 -0700 (PDT) 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=xx3w/5InGdpOLaQRb40pJxZ2fJfVESZ8ECU7qAZSRME=; b=WcKYEYgj3pXvhW+StbmmEEue9T9NBzgWIMQeXEmhBPGc4C60e9oe+7ot3HtSgv5JaW AOhnjrq/hPAv+ajvCl1mBXp1yR11UsrGrDRS0g0Sw/FrgZX0uWzBxDHBucM/zyujwiRf Oko0j0DwbUPbpIT49VKsHZ9NMKbZAUZtbQVxFUSWccZ75ANctmSfxOlKAoW4WLx5SBxr Fcih0sqCMFBQ2ZvELcZHjH8vGrJRtefVlBPRy0/Bir9y9sEqkdn3B6DvdSaVmsQsAU1S mu2E183HbY1x9gZ7OBlzQSGOXBGIej/9OpnWDeEnirnq67koz/DVikKkfO+sihPyzuqe eZJQ== 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=xx3w/5InGdpOLaQRb40pJxZ2fJfVESZ8ECU7qAZSRME=; b=M6LV9mCsmVWmpWw3CdJFPTTElFPwez8nboJ4/XMDrMQ7F0lgHWizR0GXTb7cDxVxu5 aCYgdlV8jdPACDsoE+udOjTa4/agwvbcB1qchXQf9joAKsEvN2RkhEKx08cDbTAn5Svo 4NX7GkKfhpDHV9k2ha8ePzhu8vh5pIJMGRleN31HeydT/BeZJCyWeyTyxwKxa14ufaMJ UZQkhkvnZwj0Rp1j8ROSmrnfqU7KAb6GTemKb4qIm3XufX4YdbG4aQ1mrwHEI0NVt1r7 2aNnPexeXRhbGFy+2q7ocJACcoMTv8TyCWnftPFawwaM/ohPWIVrDEIUpFj+01yVyKc2 Mcnw== X-Gm-Message-State: AOAM530VJUYc0Q9gBF2oy1CTnMbXv7EC/T8NF4DWxS2FfUO9QFo+Eoce feC/loyEbjIajj0j6vuZh8pjjQ== X-Received: by 2002:a1c:7717:: with SMTP id t23mr198850wmi.75.1594304017422; Thu, 09 Jul 2020 07:13:37 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 12sm4771730wmg.6.2020.07.09.07.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 29C1D1FF96; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 08/13] plugins: expand the bb plugin to be thread safe and track per-cpu Date: Thu, 9 Jul 2020 15:13:22 +0100 Message-Id: <20200709141327.14631-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, Dave Bort , kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While there isn't any easy way to make the inline counts thread safe we can ensure the callback based ones are. While we are at it we can reduce introduce a new option ("idle") to dump a report of the current bb and insn count each time a vCPU enters the idle state. Signed-off-by: Alex Bennée Cc: Dave Bort --- v2 - fixup for non-inline linux-user case - minor cleanup and re-factor --- tests/plugin/bb.c | 96 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 83 insertions(+), 13 deletions(-) -- 2.20.1 Reviewed-by: Robert Foley diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c index df19fd359df3..89c373e19cd8 100644 --- a/tests/plugin/bb.c +++ b/tests/plugin/bb.c @@ -16,24 +16,67 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; -static uint64_t bb_count; -static uint64_t insn_count; +typedef struct { + GMutex lock; + int index; + uint64_t bb_count; + uint64_t insn_count; +} CPUCount; + +/* Used by the inline & linux-user counts */ static bool do_inline; +static CPUCount inline_count; + +/* Dump running CPU total on idle? */ +static bool idle_report; +static GPtrArray *counts; +static int max_cpus; + +static void gen_one_cpu_report(CPUCount *count, GString *report) +{ + if (count->bb_count) { + g_string_append_printf(report, "CPU%d: " + "bb's: %" PRIu64", insns: %" PRIu64 "\n", + count->index, + count->bb_count, count->insn_count); + } +} static void plugin_exit(qemu_plugin_id_t id, void *p) { - g_autofree gchar *out = g_strdup_printf( - "bb's: %" PRIu64", insns: %" PRIu64 "\n", - bb_count, insn_count); - qemu_plugin_outs(out); + g_autoptr(GString) report = g_string_new(""); + + if (do_inline || !max_cpus) { + g_string_printf(report, "bb's: %" PRIu64", insns: %" PRIu64 "\n", + inline_count.bb_count, inline_count.insn_count); + } else { + g_ptr_array_foreach(counts, (GFunc) gen_one_cpu_report, report); + } + qemu_plugin_outs(report->str); +} + +static void vcpu_idle(qemu_plugin_id_t id, unsigned int cpu_index) +{ + CPUCount *count = g_ptr_array_index(counts, cpu_index); + g_autoptr(GString) report = g_string_new(""); + gen_one_cpu_report(count, report); + + if (report->len > 0) { + g_string_prepend(report, "Idling "); + qemu_plugin_outs(report->str); + } } static void vcpu_tb_exec(unsigned int cpu_index, void *udata) { - unsigned long n_insns = (unsigned long)udata; + CPUCount *count = max_cpus ? + g_ptr_array_index(counts, cpu_index) : &inline_count; - insn_count += n_insns; - bb_count++; + unsigned long n_insns = (unsigned long)udata; + g_mutex_lock(&count->lock); + count->insn_count += n_insns; + count->bb_count++; + g_mutex_unlock(&count->lock); } static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) @@ -42,9 +85,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) if (do_inline) { qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_ADD_U64, - &bb_count, 1); + &inline_count.bb_count, 1); qemu_plugin_register_vcpu_tb_exec_inline(tb, QEMU_PLUGIN_INLINE_ADD_U64, - &insn_count, n_insns); + &inline_count.insn_count, n_insns); } else { qemu_plugin_register_vcpu_tb_exec_cb(tb, vcpu_tb_exec, QEMU_PLUGIN_CB_NO_REGS, @@ -56,8 +99,35 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, int argc, char **argv) { - if (argc && strcmp(argv[0], "inline") == 0) { - do_inline = true; + int i; + + for (i = 0; i < argc; i++) { + char *opt = argv[i]; + if (g_strcmp0(opt, "inline") == 0) { + do_inline = true; + } else if (g_strcmp0(opt, "idle") == 0) { + idle_report = true; + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + + if (info->system_emulation && !do_inline) { + max_cpus = info->system.max_vcpus; + counts = g_ptr_array_new(); + for (i = 0; i < max_cpus; i++) { + CPUCount *count = g_new0(CPUCount, 1); + g_mutex_init(&count->lock); + count->index = i; + g_ptr_array_add(counts, count); + } + } else if (!do_inline) { + g_mutex_init(&inline_count.lock); + } + + if (idle_report) { + qemu_plugin_register_vcpu_idle_cb(id, vcpu_idle); } qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); From patchwork Thu Jul 9 14:13:23 2020 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: 235157 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1457540ilg; Thu, 9 Jul 2020 07:20:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTzQf3JJgw7pdzGpSXReVNXlx2B5QIi0uL7QNH2qngL3+ZSPCODTVa2oCAC0BdTFvYZ2FO X-Received: by 2002:a25:4143:: with SMTP id o64mr21082552yba.226.1594304401376; Thu, 09 Jul 2020 07:20:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304401; cv=none; d=google.com; s=arc-20160816; b=dn+KLLpCukDnXeMrRWMcPasp8rPjnDJXW7dH+9pbr3jOWTCecI4qqtpxIJPOSXP2uV Szz/dL+sLhGNOMz+b0t31Zbbt/z+PE4xCaUrQcz/+DigJw3FaX2xJ0WfDl49uDvbuPC6 I7Or20c/tq3GdZcbgXug6bsMdexv17cDXDF5mKh4+Vv4U66uOnzbOEtbXr7RNkGfpCDI TyO/gxUyBDc+QmFODBQAvEnSTAUckASI1++uyxSVIm+5tsw8BqDghHhRlI3BdqY98BEF N+zKb0ZRLiNDIra1KCidw7WZXzSXq5BvqCoRTuuBSGhMsQL4nJcRu5kq1P7s98Qj4LZQ W9vg== 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=ewDyFwxeAsoL4ZL7KCxcKldr+wl06CrcFcMcQWcDgRc=; b=zsAUR8hKJMkywnVF3zAGNqiv//yadZNFz7p/tSAqCUUFt17TiCRUHuImVZ0yDKtlNK 4pJFu3dRTBZoSlFzXN3LjA94wXmcP5t1M9+mldjzWBHKE3yiWLK9t1Mg0PxiQUHvb46K 1qowX26nBlUQPRamGO4W/QSg2UZ7UAeGckel1HbSXIomCeViyq2MYXNAsAFNgxkIhxfC Wk5ocO6gKv72cXb7upFk/KP3Xu2wRtgdN3cDLjqbLz7jJCrNjk5Q9Q5PRQJlTCcFcjel A3zqri6G6k9BwiPQOyCbfQt309URgyQD2EdhrfFe3+2UWyhRGyU6Uk5G4SjHaJ1X1SBs I3aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yacbWQTr; 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 g14si2771272ybq.424.2020.07.09.07.20.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:20:01 -0700 (PDT) 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=yacbWQTr; 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]:56632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXP6-0000Hs-RD for patch@linaro.org; Thu, 09 Jul 2020 10:20:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXIz-0000P3-Le for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:41 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:45713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIx-0001LB-TD for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:41 -0400 Received: by mail-wr1-x444.google.com with SMTP id s10so2512679wrw.12 for ; Thu, 09 Jul 2020 07:13:39 -0700 (PDT) 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=ewDyFwxeAsoL4ZL7KCxcKldr+wl06CrcFcMcQWcDgRc=; b=yacbWQTrJ5yoHcIO/VeStISRu8ejApcnBRCZagkZ0baIPabIU1kH1EjMtSbkcMCt8S MuvlZdltYGbhvquKn8O0lQhuUPV8YWFkjgNfmzJi3HhLpslL+1cK6ZZ5q/aHCGEZgjie wbVnCNpLH23joinKGTzDc2B+zcjD4cgghVXorXm/wFUdy05t4yfrL2GSve2+k+lmxwNg A3ub1FT2cfiAnCF8tFTmAr/g+naXpsOU4pJFHwv0A4TedxqbG2gFQmKdYLnBraESidwz pGlUPzMiTpou2yAZjeff3utZ4VGNmF89UfweORoxHlh1MTaQEqRZ2Ywvfgcwfnn8LVJc IMow== 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=ewDyFwxeAsoL4ZL7KCxcKldr+wl06CrcFcMcQWcDgRc=; b=cdymFyWOJ4SXwLl/cNdNPHSrdXUAGZ36QNEZgBYsY1CUBEaexyoO51d3+7WmMboNl7 UN2ud7FbEJjWGmEB3Ii4ZSlgWvhTQ1Mps/Vhy42xtLk/Jw2r2RX+pAOGzFuVBoLzQDhJ 3Y3zpLN31JBzgzN7gXlqH0IC0tZoCbRoeDwtfEIkNGgSqaZJDR7j5Gby7VU++2A+GsfT dvxu7+N7t+ckVdDk0GOhsu+h4LuelAzIfSwmsLpGeJppgE4c8O8mZ5Pa8i4TRtp0AC5T wll1JzOw9Aa3gvcVPDUg4OPUlPCsldX9E0oqLmgVBRi9kcY2hMPWNIGOfttgoWpdVPWJ 8ePQ== X-Gm-Message-State: AOAM530UAKlvA61iUvJGP0INdX3SQZF34gys3I7dVGU5cn3IiCSfHjuo H2dCK0qh+zl8FuOKiPBIpVqC7g== X-Received: by 2002:a5d:658a:: with SMTP id q10mr62322515wru.220.1594304018455; Thu, 09 Jul 2020 07:13:38 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g144sm16699999wme.2.2020.07.09.07.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 40C9C1FF98; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 09/13] target/sh4: revert to using cpu_lduw_code to decode gusa Date: Thu, 9 Jul 2020 15:13:23 +0100 Message-Id: <20200709141327.14631-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, Yoshinori Sato , =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, Claudio Fontana , kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The translator_ld* functions very much expect us to be decoding one instruction at a time. Otherwise we will see weirdness such as: qemu-sh4: warning: plugin_disas: 6 bytes left over when we use the disas functions. For what SH4 is doing here (scanning ahead in the instruction stream) this is the right function to use. Reported-by: Claudio Fontana Signed-off-by: Alex Bennée --- target/sh4/translate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 6192d83e8c66..919da72a0c98 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -1915,9 +1915,13 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env) goto fail; } - /* Read all of the insns for the region. */ + /* + * Read all of the insns for the region. We do this directly with + * cpu_lduw_code to avoid confusing the plugins by decoding + * multiple instructions. + */ for (i = 0; i < max_insns; ++i) { - insns[i] = translator_lduw(env, pc + i * 2); + insns[i] = cpu_lduw_code(env, pc + i * 2); } ld_adr = ld_dst = ld_mop = -1; From patchwork Thu Jul 9 14:13:24 2020 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: 235155 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1457037ilg; Thu, 9 Jul 2020 07:19:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO21geGY4Bbt4NsHQMJ6wmnN+sDQMIoF5tcpSDYmUYk8S+YZWpPSRnlzwJHMyf6XylWQi9 X-Received: by 2002:a25:e90a:: with SMTP id n10mr5034605ybd.71.1594304363043; Thu, 09 Jul 2020 07:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304363; cv=none; d=google.com; s=arc-20160816; b=HS/yuxwRB7vE/VfTjIxYkU1U0KksDMBeTM8OTnCTr51zT6ilu4Emtgf375nYSE1VuA 4MkV3fnYeDTKvUCnSzaSRQVc2zz09Q+VV+5CrNs7wE5gFuUQ8Ez9R3oBduWRsoH2OJtc zPDjDrS4Gc7ZpBTv6HQNGyXOpPdXu3d0/DvyBvPSd+5nTLGtg3sKn4vBbR88b824nNZi 2Birg9h14nIi+Z+4Rsj1JJB2BfctPUrXEnT8mfF4UHlTrN38P7VfQkeisTW2YZSoscPX 2dyzKY6n4tJZgcpJA829LjOLH6BXgCjMvA9XdG7rxwFGwkJRearmoNIGl9iW77EvrEXX QeRg== 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=mZEQudYxycdsCekYrXoDMWM3xvLuUrer9RYi3OSY87E=; b=Tqjte59aFRmBBs9EwaqZcTQGdEc1q82rv7pSD/RvnLx+f8HS/qtw6+r+A0B2rxwEx3 y16CCCmKed7LqcmeJOjslYBTtKii7mL7O74CiUgF1n+f+m5lxPGbjQsq/TlKHbei8Z5G u7mEb3V/4qKzVCKUVB+g0HMRvMellkqJ5ZKntag+NjTws2149uPj3Qw+qA5YQe+WAYOy rMWz9Yv1lgCZhhnzwL0rNvQ+LhuZgnGpxhXqJQ5J1jYs8sZaE6U5o9RB7LmbOhoSCZmA ftsJAaOVzJPPD3QdGG7TWY4CMI2Kd7X9/6St/V0lm4cKnMMqr8RVIz82LyaYqMl467sS Vi0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ksr2N1SW; 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 l70si2430165ybl.382.2020.07.09.07.19.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:19:23 -0700 (PDT) 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=Ksr2N1SW; 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]:53510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXOU-0007Qi-E6 for patch@linaro.org; Thu, 09 Jul 2020 10:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXJ4-0000TG-K2 for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:46 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:50612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXIz-0001LO-8S for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:46 -0400 Received: by mail-wm1-x342.google.com with SMTP id l17so1998207wmj.0 for ; Thu, 09 Jul 2020 07:13:40 -0700 (PDT) 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=mZEQudYxycdsCekYrXoDMWM3xvLuUrer9RYi3OSY87E=; b=Ksr2N1SWhwFnSa6MU822KNhRaHMq0Z3HbBzkbMYpgY3zt3cPXSN8Lw6msB2dDeyHGs qWol9Gi2vfG1DITEtcIhR8yyog1T99/TIZ76qUL5OYELox/tR9JJe7VtHK1uaDk6A3y2 rGPMmymrmIwxBgd0hl8enlKDHuqZwmmIGXwOcgWDguq9Wil/P99j1K17QR8KR4KZq8jK rnmiPTjb9ovyjVKpzfF+IDL18NYtj83OFA4U970d0FFHZJYoUGDi1JeCe+jeo2p6l5Rx 0pI6sbA5D+vkWYkBAwFrbxchmUl74h7URGO04ot0olKUhoyCIVZvQlELUlwcjLP7xGEp M3VQ== 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=mZEQudYxycdsCekYrXoDMWM3xvLuUrer9RYi3OSY87E=; b=SFvfeujiF0gcDo1IcqOWYokJVwyCDKCIOwXq5hNcj50LSJzZ6w9Dwwm15MVQPZamd0 lb+WQXrTcCFI//MVUA1X3eHdZ34tCy5aLDFJfCxN8EJcrOIaRTfXSskyXxzi7T85XFzS kKYUQFNeAw1m3idaDV+73Bs69yPawoQlv6b7iVunRdd4E7ORrMeVOv1reebnmI7eyPe7 jII1+6xuFCs1Z/QnWWD7ezTkOwTqmdzDNCWazYBkLXdKmUD33bVaTVjajZAukf6KlKfR rzOLKDV5xGzG7v6SQZYB1Itu6EP/QKmefg2OX2ec3NWPVFeS+csWGSMCJCwJX27oJDpg 8wkQ== X-Gm-Message-State: AOAM533j0JbJdK0AfYslZIBB4zprgk5exdtq4DI1K8ZRy+QG9RoMQwJr tJCDVrFvqtJ6MaGF2gkszh25Rw== X-Received: by 2002:a1c:9e4c:: with SMTP id h73mr188617wme.177.1594304019899; Thu, 09 Jul 2020 07:13:39 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k126sm5520788wme.17.2020.07.09.07.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 57ED91FF99; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 10/13] tests/plugins: add -Wno-unknown-warning-option to handle -Wpsabi Date: Thu, 9 Jul 2020 15:13:24 +0100 Message-Id: <20200709141327.14631-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Not all compilers support the -Wpsabi (clang-9 in my case). Fixes: bac8d222a Signed-off-by: Alex Bennée --- tests/plugin/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Robert Foley Signed-off-by: Alex Bennée diff --git a/tests/plugin/Makefile b/tests/plugin/Makefile index 0cb8e35ae407..dcfbd99b15b8 100644 --- a/tests/plugin/Makefile +++ b/tests/plugin/Makefile @@ -18,7 +18,7 @@ NAMES += hwprofile SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES))) -QEMU_CFLAGS += -fPIC -Wpsabi +QEMU_CFLAGS += -fPIC -Wno-unknown-warning-option -Wpsabi QEMU_CFLAGS += -I$(SRC_PATH)/include/qemu all: $(SONAMES) From patchwork Thu Jul 9 14:13:25 2020 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: 235156 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1457055ilg; Thu, 9 Jul 2020 07:19:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9uIC9JUbH0gucG8NacvlKAjOWQeEvqT2+kyJ+lzZy7FVahjUzoZoRIxwvYpVfKyXIhzqC X-Received: by 2002:a5b:c46:: with SMTP id d6mr104640056ybr.490.1594304364510; Thu, 09 Jul 2020 07:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304364; cv=none; d=google.com; s=arc-20160816; b=W0bhFbYiZIb3rAhGZ9F4noenmtBsl+xlrphH9n3t3PGnDhswWOec4ySru5EQIxSl7d QbOR46iLhj0BUsctSSgmEqGT6lGiBY/fzbC+T9BGa9gnHZrAa0WBC72T+/vWEKlJ1rho 8F5r+zI9Q3TAFVEGzbblk30ewrvokxjoLSHAUtBU4hDMqiWR4zoCm4xQSrEC/Ac5YBf5 Yg98qOd5LX9w2jlA9xPTG4Ucrr/KnyB0sX31tw3Ad0/p9v92KJryuQguoHdcIIBeDdAg Svl41vaXhrBsOdbb9Oif9brq0NcCxM51nvGKj8sRWNRrrkkhkXxxB7IdZKJ+37wrJ71M kldw== 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=CYKi9P2sb/KSIxgc0hWiYAqxm+j/yuO8AIw+hiHGW8Q=; b=nUxwBfPFmYkgggy8iVNcvTn/9UABEBkaU3M9CLZ8lgmBzx5ZCMg1P6uBCDjE6yLHj1 ZUqgQt9RpG9sSNbnjiHMGEtuWyqFA/dBiOXyTgxCF4xnoBViBpoO3txEzE1spQaEa0UP aeZB4+nctC2jxe8xqc2WvLsRJk3hDywdDxmsraqE8K8dVfJiK1VxEnjVfT9W1gFqOFgg T2BccpQYOc2WdR28FSZR0cQZ4tilicETtqTjajVsVlEc8Ep/IKL+ovq9j+9WQ7PIBThT Zq3kQZrBkT/r/N0NCH8tqYc0UjxdyPgs3sCKsfBTF8Av7C7Uq6wYwTz51rpdXSv+0rG6 WZJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="OETuDee/"; 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 y18si2797382ybr.136.2020.07.09.07.19.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:19:24 -0700 (PDT) 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="OETuDee/"; 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]:53712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXOW-0007VW-08 for patch@linaro.org; Thu, 09 Jul 2020 10:19:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXJ5-0000WQ-SD for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:47 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXJ4-0001Lj-9m for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:47 -0400 Received: by mail-wm1-x342.google.com with SMTP id o2so1980048wmh.2 for ; Thu, 09 Jul 2020 07:13:42 -0700 (PDT) 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=CYKi9P2sb/KSIxgc0hWiYAqxm+j/yuO8AIw+hiHGW8Q=; b=OETuDee/gKUepqTzzA/1/0eB6wAG5xehvoDlGLBs6bNt2ti9btU+hhAceHcDMOYElT rzL7GxahM3ZtGIcsloTe5H34ZbCaXhwhVxidIu9dWtneytypgR2+6p7kbKybc/uLVuLR shPjIkRoE8lo5jqdnxkr6oflWTh/8MXHMQZjNqx22W/n+vOxOJL0yDbnCjMzEddyo3OU +abbvrojblXAchnsJBI6d5Djn2XdAQSxw5zs8iBoCnATDepT1YGYCpX6rNuvYp2i83H3 4ZGk1NA5kGETuGUzngktPYxVBjVuNGHqmF3U690GCQjt03fSfncTQruQPW4e5OiSrOFb 8O3g== 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=CYKi9P2sb/KSIxgc0hWiYAqxm+j/yuO8AIw+hiHGW8Q=; b=MJKovdGgXHUwaPOVnV6lzEuEZwuOkHEi57mJHvRMrUWGAhK/B8TESBnFRkORUwDTPe 147EG6kXBqHpTHTirD/5+Qp30jiirKLuzhValM4/uMve+9/Jh/x/73uhM261rey1AscW /FU5V/faGxLggnNQJhJZ3yUUn5v9lPqTsE6VEIrJFlCc1RCyxiV3o1JHzdBN/4BNxOG9 Q5XiTLrCqgDWEcb8p87oP4RYpIXuGLQu6zOr/25wN6IOola5LuhxdJt+M49JR3FV5HPW 53aTXOCMTDTE6T4JNxcy9mrcir3G6c22aSGW68E/WWaHEPRCjys+jrTYEfxf4J1Yc2JV gGuQ== X-Gm-Message-State: AOAM532RXY+DqZBQgZxn22+M6kUVa01HSXLf2AQHRmfbITFylv1O/jXj 2Eq9xbDQqu6KUa+b4HU17SZtkw== X-Received: by 2002:a1c:f60d:: with SMTP id w13mr215476wmc.51.1594304021844; Thu, 09 Jul 2020 07:13:41 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q4sm4932417wmc.1.2020.07.09.07.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6EF8E1FF9A; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 11/13] tests/docker: fall back more gracefully when pull fails Date: Thu, 9 Jul 2020 15:13:25 +0100 Message-Id: <20200709141327.14631-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" I only spotted this in the small window between my testing with my registry while waiting for the gitlab PR to go in. As we pre-pull the registry image we know if that fails there isn't any point attempting to use the cache. Fall back to the way we used to do it at that point. Signed-off-by: Alex Bennée --- tests/docker/docker.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 9684f07bdebe..2d67bbd15a5b 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -306,13 +306,14 @@ class Docker(object): checksum = _text_checksum(_dockerfile_preprocess(dockerfile)) if registry is not None: - dockerfile = dockerfile.replace("FROM qemu/", - "FROM %s/qemu/" % - (registry)) # see if we can fetch a cache copy, may fail... pull_args = ["pull", "%s/%s" % (registry, tag)] - self._do(pull_args, quiet=quiet) - + if self._do(pull_args, quiet=quiet) == 0: + dockerfile = dockerfile.replace("FROM qemu/", + "FROM %s/qemu/" % + (registry)) + else: + registry = None tmp_df = tempfile.NamedTemporaryFile(mode="w+t", encoding='utf-8', From patchwork Thu Jul 9 14:13:26 2020 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: 235159 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1459046ilg; Thu, 9 Jul 2020 07:21:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFdSoZ7Ht1e/HxA02nCjtCZl3uC+LMCn6uplzEAzXO+yH0u0vKTB9KOHt5+rIn79n7wvxC X-Received: by 2002:a25:d2c4:: with SMTP id j187mr115593597ybg.33.1594304503034; Thu, 09 Jul 2020 07:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304503; cv=none; d=google.com; s=arc-20160816; b=dSJ1EmusnBAr/LW6R0nUJ4VGq9lN77q29dqmFsUz6XJoqxwEMUll6DjqYsixjefLSU 06SaBXHDkJtJTc02CM9GUaZKKkbhiPQOPXRVhO1cNd8YFKXoBbsjeoHyt3k57hGMUUPD EMF/Ca7o89deNpJeUNCOxa4vJoyKyq82nzfMZnnIhU7YYwkit0dDsAkQy9jT5tpjMMsM XkCmaxYDsVQrPvcg8AgRviFUQ7jCshLZsD0fixWur5u4CyTfDShMO+tHDdjAUBmSElER 2upqvqcq9MAhSqaK+agws3G0i+1lsfa1nM/WrTt7ia8sMIaMWhKzHIvDhnJ//LvZxudC QTeA== 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=D9RzuX/3jxkQtQdTH0rTmm3wMB62+kPBSn4Xf4Inji8=; b=CGLDVu4hPNVXTSpsoeIcjYUQeV7GyVYhaAYN0uzmJPdZuGwO3VPYDBvA0BgOdh+X1n et62fccw56RMM9wZ4PASwuzufpPq59eRZZ22IfFVtwS22WTNxjVdv60lnTh3GVsPiUfW TvnfWOArXym7PSo5sRv2n313s8Sibt9JRKkhbEix5AvvncFpTGPHk7j110yfpROiUI6S wnpGIGpoKZsfHUmhf8z19stZtml+QyPQxYKlM4gZTJsve/2DC8Gf1u5EGcqCXpAn59P9 GIav2kaVaHHv/H6H3r8FqpGj7aFWA3Ol7QyY+qkPtBNVwCsYEiezI8PJV0wSwuG2b1a7 QRRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gZAdFkz7; 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 126si2817671ybq.146.2020.07.09.07.21.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:21:43 -0700 (PDT) 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=gZAdFkz7; 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]:37276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXQk-000432-Fx for patch@linaro.org; Thu, 09 Jul 2020 10:21:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXJ6-0000X4-4V for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:48 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXJ4-0001Lw-BD for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:47 -0400 Received: by mail-wm1-x342.google.com with SMTP id 22so1989935wmg.1 for ; Thu, 09 Jul 2020 07:13:45 -0700 (PDT) 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=D9RzuX/3jxkQtQdTH0rTmm3wMB62+kPBSn4Xf4Inji8=; b=gZAdFkz7gRtleAGVUtsnPlJAPrRIuvAGIW3mF3xRHMEZ6lpCwAu5KKkqOawxGgjumC yZQsBebJ8tCQuGLUpNSbZAM6FAL2YQ59hxUvf255zCFSwIK7BIxAouLIWx8gQsd/4Qd5 vyg3WN7lmuWPYqbkQgITLDpTuostWwVNpZ0S+lPDq93j0GnlbOSwAtTY5Wv3bMC01DPB LX1bLFQ9egXfkA4C6bhQbYiLsWZHXB8L4qMX7YeHJ6RRC1MKxTp3m0d0UvFqv/vGb2xa CNJ07x7EvRiiH14T+2xhOh+wTCkFwcgrK8LCHIiIIl9gagloDG0w0pFD4NVpDZJmlQ9m 80qA== 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=D9RzuX/3jxkQtQdTH0rTmm3wMB62+kPBSn4Xf4Inji8=; b=FXCw2snWQSPglyImYM/DSU0KfpwbWMJjrB8yL58lbr0qPFrimIJCx2QUXV7RflWmkb GQdhwxvkK+GhQxsMn0LdP7aqX9HFhO8mnb6xlp8F6UAN+6Y030wW9xEyL0qNJRnBy5IW BiAamGpOpnzY4hLDDMT+/YAx7xRdjtKRHxqyI5BOkBaqJKEgsCqrDx2my6cs0EtfSxdd uDOU9TYWDtMdMdIO7zn2MA7MFj79nky1CISNOe5xQkVYDMeMvLflg0rwIBrIQkHTYaAY 9ZnimYKQAjv773pYDijLvWxLWTgMiGLamXeXEY38ozyz495PgoBbuzqE7QcJd0MneGvf L/4w== X-Gm-Message-State: AOAM531eUii4xuw+ysA4/ALUvk0LLXRNjt4NQa0vu4K0kdsYNk61MyOS w0nFU4iEruwI3yXr9MbjYJz1Zw== X-Received: by 2002:a1c:2392:: with SMTP id j140mr259414wmj.6.1594304024625; Thu, 09 Jul 2020 07:13:44 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j16sm5710714wrt.7.2020.07.09.07.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:34 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 867251FF9B; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 12/13] tests/docker: update toolchain set in debian-xtensa-cross Date: Thu, 9 Jul 2020 15:13:26 +0100 Message-Id: <20200709141327.14631-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Max Filippov , aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Max Filippov Switch to the prebuilt xtensa toolchains release 2020.07. Drop csp toolchain as the csp core is not a part of QEMU. Add de233_fpu and dsp3400 toolchains to enable DFPU and FPU2000 tests. Signed-off-by: Max Filippov Signed-off-by: Alex Bennée Message-Id: <20200708082347.27318-1-jcmvbkbc@gmail.com> --- tests/docker/dockerfiles/debian-xtensa-cross.docker | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé diff --git a/tests/docker/dockerfiles/debian-xtensa-cross.docker b/tests/docker/dockerfiles/debian-xtensa-cross.docker index beb73f46baa6..ba4148299c5a 100644 --- a/tests/docker/dockerfiles/debian-xtensa-cross.docker +++ b/tests/docker/dockerfiles/debian-xtensa-cross.docker @@ -18,12 +18,12 @@ RUN apt-get update && \ git \ python3-minimal -ENV CPU_LIST csp dc232b dc233c -ENV TOOLCHAIN_RELEASE 2018.02 +ENV CPU_LIST dc232b dc233c de233_fpu dsp3400 +ENV TOOLCHAIN_RELEASE 2020.07 RUN for cpu in $CPU_LIST; do \ curl -#SL http://github.com/foss-xtensa/toolchain/releases/download/$TOOLCHAIN_RELEASE/x86_64-$TOOLCHAIN_RELEASE-xtensa-$cpu-elf.tar.gz \ | tar -xzC /opt; \ done -ENV PATH $PATH:/opt/$TOOLCHAIN_RELEASE/xtensa-dc232b-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dc233c-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-csp-elf/bin +ENV PATH $PATH:/opt/$TOOLCHAIN_RELEASE/xtensa-dc232b-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dc233c-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-de233_fpu-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dsp3400-elf/bin From patchwork Thu Jul 9 14:13:27 2020 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: 235154 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1456534ilg; Thu, 9 Jul 2020 07:18:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDTnhV3U4JUZBltikNOHzFX7Fydtz/Yq1rKFiU+g5I1ZCS6g3tLQZEVnIYqYIjvc1ED70F X-Received: by 2002:a25:cfd2:: with SMTP id f201mr18281963ybg.286.1594304326731; Thu, 09 Jul 2020 07:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594304326; cv=none; d=google.com; s=arc-20160816; b=v91Rv9tm+Pc6z+ixhB2vde3dwONnvS4IPwQAyzDxOosuGbRgioPsKdWM44umCv5zfd F82pGLRDkwbh5AnsLfsrAQTGnZQgtx09DsGpwRDazMHGj+5Sx0aSp8/EMPeCTHAF74kY NxhP4yAjVyeRGuYe2wpgDdxOlqt+RJeV+KgtvhGzTh84Cfo02cKPnd/w0PWNxVV0Pv1f YywottVANOF6lEVn8qggsrjsgO4xYsgTAhE+YCFTUNtX2hFaLNUaLXmqgTqobXWNvd6h 9GMXfqNCa8b12WwLxbSsCJ9JsUZJShi7yNdxP85cQPkd/zxGFPO8qSIQCYXWmXI3qjfq Gksg== 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=6oUsKppsQSQ9dDcWGFfn/h24xQJ4dIbnKOSlIto0GoA=; b=dijfpaH7FXa0ESk26qcdnjeE3D3HufgNU6GHj2pVw0hOtO4ZJ6WV9I5u+J5zLH2DeZ tJAdGovkVrKt3V6qoZxTjz3NFU4hMhsMRC5tOWZuuRzpNXENNcfrpu+FW8Cn3MWAkZgF j4QWOW2p6q+XPTq7AS57wggAQ7QGR5MsyXnrdlTjYx5PKwmDgqKsNnvpeyiDrjmoyNF1 vEEdD0Yjjjm4Fnih4+zf5Z9MDjGXmThF0+5UlR6DvjBXhKyoTPkr+cpyfVsB1rz5waql 15+qNGSMUyWwDkCdAm265kkXKAit3MWmEh2x8VEoVDRa52Wm1lBQ3JJZfHup1loEXzen 1mgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kMTwBEDN; 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 n6si2991869ybn.213.2020.07.09.07.18.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jul 2020 07:18:46 -0700 (PDT) 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=kMTwBEDN; 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]:53906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtXNu-0007a8-5P for patch@linaro.org; Thu, 09 Jul 2020 10:18:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtXJ7-0000b3-Iy for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:49 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:42832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jtXJ4-0001M2-Rj for qemu-devel@nongnu.org; Thu, 09 Jul 2020 10:13:49 -0400 Received: by mail-wr1-x441.google.com with SMTP id o11so2546845wrv.9 for ; Thu, 09 Jul 2020 07:13:46 -0700 (PDT) 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=6oUsKppsQSQ9dDcWGFfn/h24xQJ4dIbnKOSlIto0GoA=; b=kMTwBEDNnNx8igNKTQwFi4OlDltpw0xtCqrvORcvBDvWTL4k4eLfqpMDdVZDnjJy9X u0ePj2buNN/3uRT5QZXRg1nlHDKcKNQdN7z2pLnBiMpcoIXzy0TLRHXsQMFVWxAynA8O QKKUT8MXP9ajSas+4ggQhxwSyUQHq0cBYvw6hZFzFkVDd+BiJPRTswGFj9TLvstQi1x/ dWKF34T2JSXjZXzoibJgH4oxC+u32zcxq/1yj7WMPGFVfPt8nwASJ5EZqjgnqfxZ290/ m6LRRICRWRHu+C+3CcDz1dy4ErDiqFr0GY6IwnJMBj9T1EhtJqup1iIFHShmD1eTXkIw +SHg== 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=6oUsKppsQSQ9dDcWGFfn/h24xQJ4dIbnKOSlIto0GoA=; b=ONVPz7DiGx8zdMjyBIC2VMDW5ve3oLR0+cxjWgPpBUirddvsiDSKEVWmFBDfq3hYW0 Np1T2x85C1YLkqnDgsmXk/Ge6lmPMkQgVDXAThq1GfnCeW/WZMqhgwOg5K9CvFO3GnYU bj0guCm2P+0UW8W2LHk2iOZxqlWXaHCt89Vv5yam/fFHk8kX+CWVqvI0yz4AjUJFeB/9 Vv1O1Evu5Fy29rpsPt1xfIuMvPwDphBYfFFcI1jbPRocs11Zwt2+F0bZn41NExTGpZGT GYXhD4WbC73dvKeefBJr6U4VZx1ij2lMYamlwyLMoILfa1BMy3qC5RbubUP95p4BZsFK Stlw== X-Gm-Message-State: AOAM531HbnfKJ0YVPhra0orDhWiSRYS7z6RN81BjYSIJ+0Ip0gRRefxz Glu1OozmpH4NCZezgBT/pLw5Gg== X-Received: by 2002:adf:f388:: with SMTP id m8mr66146649wro.338.1594304025439; Thu, 09 Jul 2020 07:13:45 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 51sm6158514wrc.44.2020.07.09.07.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:13:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9C9F91FF9C; Thu, 9 Jul 2020 15:13:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 13/13] configure: remove all dependencies on a (re)configure Date: Thu, 9 Jul 2020 15:13:27 +0100 Message-Id: <20200709141327.14631-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200709141327.14631-1-alex.bennee@linaro.org> References: <20200709141327.14631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, robert.foley@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , richard.henderson@linaro.org, f4bug@amsat.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The previous code was brittle and missed cases such as the mipn32 variants which for some reason has the 64 bit syscalls. This leads to a number of binary targets having deps lines like: all.clang-sanitizer/mipsn32el-linux-user/linux-user/signal.d 140: /home/alex/lsrc/qemu.git/linux-user/mips64/syscall_nr.h \ 455:/home/alex/lsrc/qemu.git/linux-user/mips64/syscall_nr.h: all.clang-sanitizer/mipsn32el-linux-user/linux-user/syscall.d 146: /home/alex/lsrc/qemu.git/linux-user/mips64/syscall_nr.h \ 485:/home/alex/lsrc/qemu.git/linux-user/mips64/syscall_nr.h: which in turn would trigger the re-generation of syscall_nr.h in the source tree (thanks to generic %/syscall_nr.h rules). The previous code attempts to clean it out but misses edge cases but fails. After spending a day trying to understand how this was happening I'm unconvinced that there are not other such breakages possible with this "caching". As we add more auto-generated code to the build it is likely to trip up again. Apply a hammer to the problem. Fixes: 91e5998f18 (which fixes 5f29856b852d and 4d6a835dea47) Signed-off-by: Alex Bennée --- configure | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 1e977601a47a..3c404f31f4f4 100755 --- a/configure +++ b/configure @@ -1955,23 +1955,20 @@ EOF exit 0 fi -# Remove old dependency files to make sure that they get properly regenerated -rm -f */config-devices.mak.d - # Remove syscall_nr.h to be sure they will be regenerated in the build # directory, not in the source directory for arch in alpha hppa m68k xtensa sh4 microblaze arm ppc s390x sparc sparc64 \ i386 x86_64 mips mips64 ; do # remove the file if it has been generated in the source directory rm -f "${source_path}/linux-user/${arch}/syscall_nr.h" - # remove the dependency files - for target in ${arch}*-linux-user ; do - test -d "${target}" && find "${target}" -type f -name "*.d" \ - -exec grep -q "${source_path}/linux-user/${arch}/syscall_nr.h" {} \; \ - -print | while read file ; do rm "${file}" "${file%.d}.o" ; done - done done +# Clean out all old dependency files. As more files are generated we +# run the risk of old dependencies triggering generation in the wrong +# places. Previous brittle attempts to be surgical tend to miss edge +# cases leading to wasted time and much confusion. +find -type f -name "*.d" -exec rm -f {} \; + if test -z "$python" then error_exit "Python not found. Use --python=/path/to/python"