From nobody Wed Feb 11 00:59:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1695930168; cv=none; d=zohomail.com; s=zohoarc; b=czdAPV4YZy+CIazRXayhynf/9n/Rz8BD1a5Fj/z4ijKtOexedUYn/4dOmfrim5CBlaneYdsA95t87PkfpDnLcZ/eEOdFVg/SWo/wjioj34lkKJLyPF9oxyWtvGkdaOdOpIvKpSjeKWprbOTBVfAl2Dz9iEDpe1lRg4CakL7BoqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695930168; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ujd1qr2cxmKKRJwbJe5azKA+HhGSxwUyFcBo+rqU3b0=; b=TIivRUw9y3AO/E1UNnUqJLRDFShT4uzDF9YU+3aapiBG/b5bsRdyiNHjpEKRsa8INNJcr6pp3shnzr9GVRDqCoJ0rlWuRFJixSwdo4EM7AJCiPzd0xGyoUcPJMsT+xbrTfce+rmQuXLuuK7z4pbAw2iHIpaez6jGLX/XJnxb/tk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169593016857358.86951876947683; Thu, 28 Sep 2023 12:42:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlwth-0007vn-M1; Thu, 28 Sep 2023 15:42:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlwtg-0007v5-OE for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:04 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qlwtc-0007wN-Rt for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:04 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-690f7bf73ddso10547874b3a.2 for ; Thu, 28 Sep 2023 12:42:00 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x23-20020a170902821700b001b80d399730sm15273450pln.242.2023.09.28.12.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695930119; x=1696534919; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ujd1qr2cxmKKRJwbJe5azKA+HhGSxwUyFcBo+rqU3b0=; b=cmV4NsvXiGgLTljIM7wkEpTpK2Z9OsvPYWoGK2qFUL3ncyjfHC8vE8vnFrV30+Lym/ UvYXzuG8q4g6Gxq1tSYf8cpwQjcg5Yp0xWNxc++v4g+vuwNqZSSTxfHPHehvpW/Hx8NX XlqRZA7r6TE/eH6JrVhiuBh8wkzHhL0Jaj8cEXMzxU4GCABJNZZ48kvl9QoU15MAj1zH KT/llk5TWB7jY7PHlkzZ4xe50UGZDfvg7Ibv8rk7yXmxKigvDUryAY20shUoEkt16EDo NXQ0KPrA85jnEAgEVoJ9VttLfL9ZPoCNbc/TRaaBqzLDSIUJGqqv2YWxK5CTYcDy9mxF JlTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695930119; x=1696534919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ujd1qr2cxmKKRJwbJe5azKA+HhGSxwUyFcBo+rqU3b0=; b=t/h3y//F8Gw79DDTdkXHJ0wiwLvYvPIxBIDEADD9JfXoxrjGkhRH+tP8gvepXs9vVG LP0+VsN15L+NcztOaRHv+mKe7S4dPwG0Y2afTkBjqPAh4pJY69MfwYGnlOG3N4a6K+JO EYYOjQcaCkJFFiR+zxWR0dsj4L2lssmdYTp+DfZgytwhfZYIo4082osNZc8CwTdRYZBp 1ga25FmVeHSUbVG+B5EUXY8sxOP4y7Dwb0ZzaJySwJsgABrCForflHkeSuO0L18RF/dw FCjsDU3t15gPgXAO8Mpy3FMgmpKmnaGiLm9qkdgGylyy5R9leaFAxiTgfCmFqRGi1b5R 74EQ== X-Gm-Message-State: AOJu0YxnpzzxCkbd5hgrBoi+Q5RnMmzj6i583tNQBQB58uDQpHL5cFfC yVFKJtaWpYmGOUMzP67td8eLvyWEvd3fRl8oBco= X-Google-Smtp-Source: AGHT+IH+FjCgA5xN5ce7l5TxvacmnNIsqQa4/i4qzf3sT6WhrTBK22z1AELw8arm9ZzZjtIdtvXHoQ== X-Received: by 2002:a05:6a20:1609:b0:14b:887a:6d70 with SMTP id l9-20020a056a20160900b0014b887a6d70mr2012330pzj.15.1695930119236; Thu, 28 Sep 2023 12:41:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 1/6] accel/tcg: Avoid load of icount_decr if unused Date: Thu, 28 Sep 2023 12:41:51 -0700 Message-Id: <20230928194156.237351-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928194156.237351-1-richard.henderson@linaro.org> References: <20230928194156.237351-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1695930168884100002 With CF_NOIRQ and without !CF_USE_ICOUNT, the load isn't used. Avoid emitting it. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 1a6a5448c8..a3983019a5 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -49,12 +49,15 @@ bool translator_io_start(DisasContextBase *db) =20 static TCGOp *gen_tb_start(uint32_t cflags) { - TCGv_i32 count =3D tcg_temp_new_i32(); + TCGv_i32 count =3D NULL; TCGOp *icount_start_insn =3D NULL; =20 - tcg_gen_ld_i32(count, cpu_env, - offsetof(ArchCPU, neg.icount_decr.u32) - - offsetof(ArchCPU, env)); + if ((cflags & CF_USE_ICOUNT) || !(cflags & CF_NOIRQ)) { + count =3D tcg_temp_new_i32(); + tcg_gen_ld_i32(count, cpu_env, + offsetof(ArchCPU, neg.icount_decr.u32) - + offsetof(ArchCPU, env)); + } =20 if (cflags & CF_USE_ICOUNT) { /* --=20 2.34.1 From nobody Wed Feb 11 00:59:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1695930138; cv=none; d=zohomail.com; s=zohoarc; b=YpLpk/pCFhwTeoqzZ4LYBqjD/YgXND8mL/bMrip1OaPVQ1drpZpBxC5BAKOEOrIi2N68zUSPjahvqEn0Npa+OIjUxKmfCMHXnF6r64GuvUz+1yzHBBgqhhvhB5MvViWox2WF5pymBoHbcHrqKKuyreVakK0Gt7J87md0dCGgB2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695930138; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ytGH6JE+ydbRM4358s66cugltU3Ll2YBV5fZ6EN4mvI=; b=VF1VEPvufBebmXQnWeBPF420V5gjCn1UjZyLcegI3p9YQLz2k0c/Ze1PznZeDtSkmuVNmAILxhNRSh8DhXLyoz0XiwTX0CGD6uvO5JZp632uvLKWTbjkin5UAmtbDZoUhdb1Ob41sQJUmK/YskyN/RBDmLYTbOrWuCWMijIWm7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695930138302121.82583305071933; Thu, 28 Sep 2023 12:42:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlwtg-0007vD-U8; Thu, 28 Sep 2023 15:42:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlwtf-0007u8-6z for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:03 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qlwtd-0007xA-Cp for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:02 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c7373cff01so8387035ad.1 for ; Thu, 28 Sep 2023 12:42:01 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x23-20020a170902821700b001b80d399730sm15273450pln.242.2023.09.28.12.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695930120; x=1696534920; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ytGH6JE+ydbRM4358s66cugltU3Ll2YBV5fZ6EN4mvI=; b=cOXsYquntGSuWYRIER0dO1tukNE4WgcsDV+B7wnkd95r3444QZTMYqoBX7bJA9cS+k OjmNFXVO38G+dt0//w6UbhpYYifwgVfnkuTPPOXCao9AM6REOS88m17/iQvWPL4TbXdy 0tqHqECBKOIQZpFdCfsbIcSKYxPbKLnbiUjtCqpO5wXZ6riO3oMqitkNXO1h0mxEigTF Hjwxa1CRh/yk/Sc3NuvC+p/ssS1XsaPmxiBzGbNkIeQw+iDCVIgmwy9CQ7v2r1UNoQDr qe+uzEZ5vYO6bZG8TOgwdKQUY8Ukg1v8rX9+aOhI4V8pOsYmnQMHm6s9PPAeiBqoSeCG WkFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695930120; x=1696534920; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ytGH6JE+ydbRM4358s66cugltU3Ll2YBV5fZ6EN4mvI=; b=k8Shncawt1k1MHF3RWbtFX3owi7ep1mYaaVZgI7YEjizTJKMATinIc2dXnAXxiZ+3J dmm7cVgfRzb9BqD4gTRFTg22dvtr682TD4buF4jeeU0tSo/tq0io0O/h4sMQypM5yIeq FXTkOr555CmBoifJ45ByxfWNcuI4ZtRBd0ItpGoArV1h4QEpjkA4kZOFdzt0sSzhrfWv cZWf6LI08yFCvsiQ59t2Iu7IhvaknRQvLHIndxj/ZvTq3fTK8bjQ2Cmo16vIQNyfNaIq LGdzqYooDI2L4GfDd4clIGFPJtBhXRleUavwdx8lxCQpUmpFfYNYlKgyU9mofhJbCbGI SXDg== X-Gm-Message-State: AOJu0YwFiX6HkU0nlP0NDdFJFbJozZo8tF7fSSQ+jmb4A5xCd5daUN5j FTsbHI6chQLg9cAHUh/Ou82upFJe98peBup/XkY= X-Google-Smtp-Source: AGHT+IHpcUnZboLNERVX7ZGYu5YoOmQnCb52f7Pves3ocIKUEhPFPDZJFjJlFciJrRM8YrZsOUDVHA== X-Received: by 2002:a17:902:dad2:b0:1c7:2e8f:c3b5 with SMTP id q18-20020a170902dad200b001c72e8fc3b5mr3380815plx.20.1695930120071; Thu, 28 Sep 2023 12:42:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 2/6] accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop Date: Thu, 28 Sep 2023 12:41:52 -0700 Message-Id: <20230928194156.237351-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928194156.237351-1-richard.henderson@linaro.org> References: <20230928194156.237351-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1695930140064100006 The condition checked is loop invariant; check it only once. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index a3983019a5..b6ab9f3d33 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -158,7 +158,13 @@ void translator_loop(CPUState *cpu, TranslationBlock *= tb, int *max_insns, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 - plugin_enabled =3D plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY); + if (cflags & CF_MEMI_ONLY) { + /* We should only see CF_MEMI_ONLY for io_recompile. */ + assert(cflags & CF_LAST_IO); + plugin_enabled =3D plugin_gen_tb_start(cpu, db, true); + } else { + plugin_enabled =3D plugin_gen_tb_start(cpu, db, false); + } =20 while (true) { *max_insns =3D ++db->num_insns; @@ -176,12 +182,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *= tb, int *max_insns, if (db->num_insns =3D=3D db->max_insns && (cflags & CF_LAST_IO)) { /* Accept I/O on the last instruction. */ gen_io_start(); - ops->translate_insn(db, cpu); - } else { - /* we should only see CF_MEMI_ONLY for io_recompile */ - tcg_debug_assert(!(cflags & CF_MEMI_ONLY)); - ops->translate_insn(db, cpu); } + ops->translate_insn(db, cpu); =20 /* * We can't instrument after instructions that change control --=20 2.34.1 From nobody Wed Feb 11 00:59:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1695930177; cv=none; d=zohomail.com; s=zohoarc; b=kuxkBFdDdmjOUAky7zhnjdBtfdd79zfwJ3Mc+6Xg9OCeMDV39edvaQaMIZqtWtA6R2O0afnKyyfSFBqqiN6SNHnPGpdWs3W4n9bTw+4V4Fy2d/yQJYy3ySQmb76kZB8NyDGpcKlwMVxiK4krbnbfoy4hZSfCEQJBW6wV0H+fQ3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695930177; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LstmnDMwNDQFVw3SQAKvu0MWGEv1hgOUR8OcXIkEB5k=; b=hCrZleLQvk8H4hQptAIFPOYsTXC+V1U7Y7ObzwIveYkPu2qshHpeUI86CszdyEFKK+bVS8oZ+Qe6UlgB21V4UWrG9PUrqGspayKOyHzByBOM1YvLNS19lcqmXDY4C3NHzvkiKvFY8lfRp/9XEkbrZOD/i3SlpS7zaoOF9MgjYIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695930177201765.2626651691104; Thu, 28 Sep 2023 12:42:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlwti-0007wG-I0; Thu, 28 Sep 2023 15:42:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlwtg-0007uV-C1 for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:04 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qlwte-0007xL-H3 for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:04 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c63164a2b6so43963445ad.0 for ; Thu, 28 Sep 2023 12:42:02 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x23-20020a170902821700b001b80d399730sm15273450pln.242.2023.09.28.12.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695930121; x=1696534921; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LstmnDMwNDQFVw3SQAKvu0MWGEv1hgOUR8OcXIkEB5k=; b=udjhRXyaR6+EP4YXXJSAjqxn94Wn/tjU0C4jbQYxmD8khm1rOBzeR3PUrsuJ02Hwq9 z47vMqZLm50ygMC06mYTOGER6MCYfYy7pnTPOn55yi3UqIzDwaVWvjep42S3Qu0mhZI7 2PQBBfJRHla986m2NQBRx9YRIFv5vyREJlGQsYDqZWo4Tb5AxV1ITDbIYeIX1tCPh9h6 KdceA81+HAxx4kKcMknIatTdsJfmDXbCqnxpiZqBksMZiHvQUVlvuItmrFtIMnmQWVdY bRIVUq4Y+1pyepANXpl0P6zA7ODuwzvr+bq75pjfnnbgOI9dfvOrVqecn7HGJNDqdB9Z odHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695930121; x=1696534921; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LstmnDMwNDQFVw3SQAKvu0MWGEv1hgOUR8OcXIkEB5k=; b=KtRu0IavGE+am+GhTJKmwXlV9wntXHDR5pIbuTFYP5wUXP8wgU2TOH+7gcji0s823J 0jRVMISY8npgdhitwmrqPWqzvuwrPvSXM7Q6I2BE9ng7UyJl33nbep7y+OamEiLja2Oz U946VSEorZwM1KJudqFiG8wDH+ye2+oaMIq0eERz0z1K7wWwhEuMpCC1If45OJXDaj6y 0X8vbGwW5aCpFDMH/99gadE8g8IRZ5ZvM+mN6pEcb5EIdlDtPKoCkSjTBBwo+L/4yPzb z4HNjW4kCV9CpN6AYSVuMqrmnLI2o7aiWLEeFFMHoDmvqZHgLICIt7nbRwfb1n/JwScJ zrog== X-Gm-Message-State: AOJu0YxXaGTxQzwehvwyFBZqjQiSJxIlndvrCb+A7W2emJueisA2JOFS 5nIGcQ6vb/4seDqV7pqQJTZ2EhHw8zv4ClywOMg= X-Google-Smtp-Source: AGHT+IGVeJgfXsbq/zF4oFQYIfEu2XzkxqVBSnzi/HtJPJ9San7nUweDj/qAujiuFs46Ote2ENVeRg== X-Received: by 2002:a17:902:e80e:b0:1c2:193e:1126 with SMTP id u14-20020a170902e80e00b001c2193e1126mr3180189plg.28.1695930120909; Thu, 28 Sep 2023 12:42:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 3/6] accel/tcg: Track current value of can_do_io in the TB Date: Thu, 28 Sep 2023 12:41:53 -0700 Message-Id: <20230928194156.237351-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928194156.237351-1-richard.henderson@linaro.org> References: <20230928194156.237351-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1695930178390100001 Simplify translator_io_start by recording the current known value of can_do_io within DisasContextBase. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/translator.h | 2 ++ accel/tcg/translator.c | 31 ++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/exec/translator.h b/include/exec/translator.h index 4e17c4f401..9d9e980819 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -72,6 +72,7 @@ typedef enum DisasJumpType { * @num_insns: Number of translated instructions (including current). * @max_insns: Maximum number of instructions to be translated in this TB. * @singlestep_enabled: "Hardware" single stepping enabled. + * @saved_can_do_io: Known value of cpu->neg.can_do_io, or -1 for unknown. * * Architecture-agnostic disassembly context. */ @@ -83,6 +84,7 @@ typedef struct DisasContextBase { int num_insns; int max_insns; bool singlestep_enabled; + int8_t saved_can_do_io; void *host_addr[2]; } DisasContextBase; =20 diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index b6ab9f3d33..850d82e26f 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -16,11 +16,14 @@ #include "tcg/tcg-op-common.h" #include "internal.h" =20 -static void gen_io_start(void) +static void set_can_do_io(DisasContextBase *db, bool val) { - tcg_gen_st_i32(tcg_constant_i32(1), cpu_env, - offsetof(ArchCPU, parent_obj.can_do_io) - - offsetof(ArchCPU, env)); + if (db->saved_can_do_io !=3D val) { + db->saved_can_do_io =3D val; + tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, + offsetof(ArchCPU, parent_obj.can_do_io) - + offsetof(ArchCPU, env)); + } } =20 bool translator_io_start(DisasContextBase *db) @@ -30,12 +33,8 @@ bool translator_io_start(DisasContextBase *db) if (!(cflags & CF_USE_ICOUNT)) { return false; } - if (db->num_insns =3D=3D db->max_insns && (cflags & CF_LAST_IO)) { - /* Already started in translator_loop. */ - return true; - } =20 - gen_io_start(); + set_can_do_io(db, true); =20 /* * Ensure that this instruction will be the last in the TB. @@ -47,7 +46,7 @@ bool translator_io_start(DisasContextBase *db) return true; } =20 -static TCGOp *gen_tb_start(uint32_t cflags) +static TCGOp *gen_tb_start(DisasContextBase *db, uint32_t cflags) { TCGv_i32 count =3D NULL; TCGOp *icount_start_insn =3D NULL; @@ -91,12 +90,9 @@ static TCGOp *gen_tb_start(uint32_t cflags) * cpu->can_do_io is cleared automatically here at the beginning of * each translation block. The cost is minimal and only paid for * -icount, plus it would be very easy to forget doing it in the - * translator. Doing it here means we don't need a gen_io_end() to - * go with gen_io_start(). + * translator. */ - tcg_gen_st_i32(tcg_constant_i32(0), cpu_env, - offsetof(ArchCPU, parent_obj.can_do_io) - - offsetof(ArchCPU, env)); + set_can_do_io(db, false); } =20 return icount_start_insn; @@ -147,6 +143,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, db->num_insns =3D 0; db->max_insns =3D *max_insns; db->singlestep_enabled =3D cflags & CF_SINGLE_STEP; + db->saved_can_do_io =3D -1; db->host_addr[0] =3D host_pc; db->host_addr[1] =3D NULL; =20 @@ -154,7 +151,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 /* Start translating. */ - icount_start_insn =3D gen_tb_start(cflags); + icount_start_insn =3D gen_tb_start(db, cflags); ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 @@ -181,7 +178,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *t= b, int *max_insns, the next instruction. */ if (db->num_insns =3D=3D db->max_insns && (cflags & CF_LAST_IO)) { /* Accept I/O on the last instruction. */ - gen_io_start(); + set_can_do_io(db, true); } ops->translate_insn(db, cpu); =20 --=20 2.34.1 From nobody Wed Feb 11 00:59:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1695930191; cv=none; d=zohomail.com; s=zohoarc; b=Hwk2mzflVYTO+2EGxPxkD4OO4RD0YmkSxqgS7TgKG2Ye1Xl8m8+7apm/JkCwsGADPgY3X5qG7yUyk+rNKFylAZLsxWjq+Jl1DEDhqHn33+but33+iHdGbgvYmoRjo+kgL7FquhhDjc7eH2okFp2fHiDx5NSh4LjFdvO+oM3Z2HM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695930191; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=t5+OWaefyNNMkLVduE/VRJ4ajnCIurTsfMfEZxbDqbs=; b=FQ6V0yxhYQo7rmdpT77p1q30lNS5idbKQRPTEyVdrpcJa/8C+gdUXk8dHUGDH4KiRaVxmNiIXHMvFVilOJ7qgJvTp62y2MpcFPFjJfO+MmDVsmjPchFG7ECpx5VCwZ3Lj1Az0yOcdJEtvPIq1J8VMQC6VRemS1z8SV9WcCsaUnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169593019120565.07089630882729; Thu, 28 Sep 2023 12:43:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlwtj-0007y4-LO; Thu, 28 Sep 2023 15:42:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlwti-0007vs-4j for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:06 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qlwtf-0007xn-JL for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:05 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c724577e1fso34557915ad.0 for ; Thu, 28 Sep 2023 12:42:03 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x23-20020a170902821700b001b80d399730sm15273450pln.242.2023.09.28.12.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695930122; x=1696534922; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t5+OWaefyNNMkLVduE/VRJ4ajnCIurTsfMfEZxbDqbs=; b=MIr6p1nzHUqHrWCyQaevbx0xjJ5ps6OCYkxetj6rqwDRETUNqGcJ6jpAG2m5f+9u7t 8I9kLr1GhTquXWFDv29jK4CivzsrZbzTGTh9RBE+8wqvZG3jGt576LZpFXNUIw7SwO5u 6oWUB0bJI4zfXEWebjEDFl6epmLdpmCJ3YsSNOgLxza2Cn9JIM+tzirtwoGCOUNwungM 1r1MeqLs/gD7xJH+tDk+0dwZpH4yMkHgIk02WFPcbOejxtRAOmQ9sIS7a2EKRWGmmWLe UbAxDWsfcM5862YmO9HheFbc+Xamh53HEFgHvnJJ2bPP+UPKA/MxxlwbKAoWWsy/Q8sW ulJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695930122; x=1696534922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t5+OWaefyNNMkLVduE/VRJ4ajnCIurTsfMfEZxbDqbs=; b=OXIlW9m9QhXNpGIHLoxjjHBgi7OkS3uu1pTN0y51SCQ1VW1tvS33p3CEQgTmyOw7J9 QbsyvZUZpeNWkb4yXr9slMug2aFSkxgkIiQcCtRg/07N0zAaAQx6YizN0+wMLUkkScyQ r6FnmThTruaLgeyt2kfFYqvfGHsursekXEXTAYkNKjb2dxcJH0Or0/UDZNDCNXBz7I6Q vQ3Y2NIExNmh+ythB7SNvnjzSpJSoWHJggrk/ymSeuXtMlVHA0u+Jh4HUuGEXiNHR4LC 8+xWrsuUMmQfGwMeJURnL1x08Hok5tfrkjXVr3w19qe9rcuBGh6MYekZNz51eeZ1sC3g ldWg== X-Gm-Message-State: AOJu0YwCYNVG0LJ5/uWb3e0/g67MFmzfnPwoDxvyZXOH0Gc8s/vRDsdk gZWZ+Ak3swut1DwZ9dY5pPZi/PpqT3E6K9q2RXk= X-Google-Smtp-Source: AGHT+IE2cL82n53So+MqOZG6b5UrFbc9Z4gcZ7JqjB0DhfNCfeZL5HEHzq5De/pi8X33c2hY1rKMtQ== X-Received: by 2002:a17:903:22cd:b0:1c6:2dbb:e5f4 with SMTP id y13-20020a17090322cd00b001c62dbbe5f4mr1974648plg.26.1695930121905; Thu, 28 Sep 2023 12:42:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 4/6] accel/tcg: Improve setting of can_do_io at start of TB Date: Thu, 28 Sep 2023 12:41:54 -0700 Message-Id: <20230928194156.237351-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928194156.237351-1-richard.henderson@linaro.org> References: <20230928194156.237351-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1695930191590100001 Initialize can_do_io to true if this the TB has CF_LAST_IO and will consist of a single instruction. This avoids a set to 0 followed immediately by a set to 1. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index 850d82e26f..dd507cd471 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -87,12 +87,12 @@ static TCGOp *gen_tb_start(DisasContextBase *db, uint32= _t cflags) offsetof(ArchCPU, neg.icount_decr.u16.low) - offsetof(ArchCPU, env)); /* - * cpu->can_do_io is cleared automatically here at the beginning of + * cpu->can_do_io is set automatically here at the beginning of * each translation block. The cost is minimal and only paid for * -icount, plus it would be very easy to forget doing it in the * translator. */ - set_can_do_io(db, false); + set_can_do_io(db, db->max_insns =3D=3D 1 && (cflags & CF_LAST_IO)); } =20 return icount_start_insn; --=20 2.34.1 From nobody Wed Feb 11 00:59:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1695930138; cv=none; d=zohomail.com; s=zohoarc; b=ZjWisbnrYNmEaG23X6fgVsxR3RITWZ350ymOPm3oy87Yy9wNLuDALersgnljTWhgOt96lK/2Y6HZHPpoE2i1YEG5iPo2UnClN3QOl6+Ld6UqHlnxQYuNgGbylQ8B8gn8bfC43Tvu6fNTpWc87wxX+hOS5rawzxQ9R3JLIB3DF20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695930138; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Pino+Pzpra8kDOPi8wLUPqIV+r06yGcltlj2T5gxEf8=; b=h6eLljMhamU62vAEFy+u8cH1+7BujnIx039+Tslz9Pk4wHP1pxcp1WoLoAckfLcbwkMbrpg/KOAfajK2a0+RogEyBl3G569a8vBoB8GsC5S2iCmtGUdVJ+89Qk7drweUry9F7UccKuwo7w0mfvx96GduC8ArSZGGVoe28M5WrAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1695930138132391.84309468933805; Thu, 28 Sep 2023 12:42:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlwtk-0007yX-6d; Thu, 28 Sep 2023 15:42:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlwti-0007wW-Nb for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:06 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qlwth-0007yW-4p for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:06 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c735473d1aso11371255ad.1 for ; Thu, 28 Sep 2023 12:42:03 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x23-20020a170902821700b001b80d399730sm15273450pln.242.2023.09.28.12.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695930123; x=1696534923; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pino+Pzpra8kDOPi8wLUPqIV+r06yGcltlj2T5gxEf8=; b=wdM2an+vUAPytuALdj2EXtNsEv4Um8Q4jpLk16ZgHxyMUd2wCoZtVPAOmUs+pnBDBK Klcb2Dkh6vO7ungXAzU1Xo6lDnmQBWgREFMR3p37p6TR7bYT6GNQpqyq01VCCfWz70uj N+yksgmX40emRnVDisNSpKpErAKRJmAdb5MBFFBo7Giv7x2szweSzkHd6TbwF8mo1UTj JdPpzHPiWXkDkKkxOdtVYMKVeia8123/M5Jc17sVudIaYsSWjrcas4OVP/rrpKvAJB4k YuUsaMkiMmAdIhQ4sS++tgCPATLAABj7Ht2yBugQaM2FAZbNQEGXMb5LYWohARywyQzu fhqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695930123; x=1696534923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pino+Pzpra8kDOPi8wLUPqIV+r06yGcltlj2T5gxEf8=; b=t6nK0a9ZKGSi+rDQKm83H5O8NxbZzMTQ8vmT02iEDEeEN6H/8dVnp2jdNMHQ9HR6xi FFIMHB9fPVENdrj48uVkAgAfHag4N6Cody6Hxm3o0XkARK6GK+1eW7ylwSkaI9yNaCpH +dzZRUsFbRxKf2EhIC08qtCiWu7tc8h6Onb+s17n+YM22YqcCMSOyLDtAQdNECjS4tPy Sq3xHtu2j8P+ZxMmWJDdwpZcP6O943LXS/kg+g0N1nRX3l2CxPNoD6Dzrl74XA29Tv+q PHQyF1cA/J5mCfyXfdMG2CBqVS1hPpdktbb8KMGW5umYI8ottvF0KJz7H/f/Uc2CzHuB sE0A== X-Gm-Message-State: AOJu0Yw7Sqfcu4B/fNekLF3ulEgZKhz4lYRbuOr9kfWv+TZ422GmQ212 Ls4GV7zpEXOO4ZqlycNHdy/8J9hw4o6dljmNZFk= X-Google-Smtp-Source: AGHT+IF1opDIjKq5IVIHCddXJX6mRxKoXA8mx6OdtJ6Jel4ohYFfrpcCASTiu4LgO8nwebTCfOI4iA== X-Received: by 2002:a17:903:2344:b0:1c5:6dbc:7938 with SMTP id c4-20020a170903234400b001c56dbc7938mr2397915plh.69.1695930122652; Thu, 28 Sep 2023 12:42:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 5/6] accel/tcg: Always set CF_LAST_IO with CF_NOIRQ Date: Thu, 28 Sep 2023 12:41:55 -0700 Message-Id: <20230928194156.237351-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928194156.237351-1-richard.henderson@linaro.org> References: <20230928194156.237351-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1695930140061100005 Without this we can get see loops through cpu_io_recompile, in which the cpu makes no progress. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 2 +- accel/tcg/tb-maint.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e2c494e75e..c724e8b6f1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -720,7 +720,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, = int *ret) && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra =3D= =3D 0) { /* Execute just one insn to trigger exception pending in the l= og */ cpu->cflags_next_tb =3D (curr_cflags(cpu) & ~CF_USE_ICOUNT) - | CF_NOIRQ | 1; + | CF_LAST_IO | CF_NOIRQ | 1; } #endif return false; diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 32ae8af61c..0c3e227409 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1083,7 +1083,8 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t ad= dr, uintptr_t pc) if (current_tb_modified) { /* Force execution of one insn next time. */ CPUState *cpu =3D current_cpu; - cpu->cflags_next_tb =3D 1 | CF_NOIRQ | curr_cflags(current_cpu); + cpu->cflags_next_tb =3D + 1 | CF_LAST_IO | CF_NOIRQ | curr_cflags(current_cpu); return true; } return false; @@ -1153,7 +1154,8 @@ tb_invalidate_phys_page_range__locked(struct page_col= lection *pages, if (current_tb_modified) { page_collection_unlock(pages); /* Force execution of one insn next time. */ - current_cpu->cflags_next_tb =3D 1 | CF_NOIRQ | curr_cflags(current= _cpu); + current_cpu->cflags_next_tb =3D + 1 | CF_LAST_IO | CF_NOIRQ | curr_cflags(current_cpu); mmap_unlock(); cpu_loop_exit_noexc(current_cpu); } --=20 2.34.1 From nobody Wed Feb 11 00:59:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1695930147; cv=none; d=zohomail.com; s=zohoarc; b=KKT/n/viapCN/wVDVQhLX2W/3vdPtgPvgv2dqmUtegzoDgoqAPLtjX0OQbx67mwWjslnjCF3xLqvpTuBnnTwMiAbtupbpfG0JuTIBhm7dyroJ92u8dNEpQ4VTiTWsOMf7MFAuO7tIGitZa7mZwkVIXzPCQjKhZfEx1GmLC81bnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695930147; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MTgXBkn5TnELvpBo0aJHFhInTurB6cKNpUDk0rnkIf0=; b=mzYJ+ZirKOO0G1t8kUuXqW3R39U3hhj96B1d8gG/YB3PBpCN0gzEJ4vYQzP646ZBYXjpaUwlQ4xkQ5J56pIvIu7LkF0jnW2dPqNoidRkbTjKTv7XhV+CT7J0WtwQbFBwy7a9FrCZQjZAoLl6L5K34DRnwGkws50XLILzXmAVVjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169593014708835.84137305466993; Thu, 28 Sep 2023 12:42:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlwtl-0007zZ-RI; Thu, 28 Sep 2023 15:42:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlwtj-0007yM-P3 for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:07 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qlwti-0007yy-2t for qemu-devel@nongnu.org; Thu, 28 Sep 2023 15:42:07 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c1e3a4a06fso100721845ad.3 for ; Thu, 28 Sep 2023 12:42:05 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id x23-20020a170902821700b001b80d399730sm15273450pln.242.2023.09.28.12.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695930124; x=1696534924; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MTgXBkn5TnELvpBo0aJHFhInTurB6cKNpUDk0rnkIf0=; b=oi/9nNC4hS4yX+wjbCkCeN/s10vg5Y5Gwa6wtLN1KWwJ2tf9Eucf7S+dUnn9Vk4hI6 PoFnV+jGCvwGeK6DLIf7KewT9WItnNMJcyGiDRHaxGG9q7qrnc0D/CqRBKAdadh8Srrg WVpLKjz9h5jZoq05SG1PjkuFVEwKXWW0VtXf6P8KnDa9Y0ljzaJfw/ynduHIg4/aYGQT A0e2SgSqiKdX069ocMCfyMUr8hl92RFnKonrEw2MDhP6mJr9FDMUc1c35BpDSQJ8i+1U XBUHR5Z//H3Eovf298yIEQmePchVTQ1AE+0sR/XjIP/eA2ehYR2irHtjLEXCaKVcnorY jD5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695930124; x=1696534924; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MTgXBkn5TnELvpBo0aJHFhInTurB6cKNpUDk0rnkIf0=; b=TnaolkGU/vIkav8Ns3bXGg/XEWiFb6yb4QMObeYNQ+XvAu5We/0Qg73BZenwpqJH2R 3ALKJ/OTHK01KkUa7nbF3VXS/rNfKi0SwR4tSHQE/mPCxXXx552GVvudHBmyjAF6m+R1 zaJzV87Dm7OXa9PU7qnZbYzAFVvBwId4mmS+/OwehkxZe59KiKkonYQGKHXHNxDEiJsD s+g6BdM6UYuViAcBiSazDy48KRHWZuk47XmMlAuyk73B4rJl4oVxYB9nsiWYVUNEqWoY JM8nfvJIbFKApB8iz49Icwr7MumVoXUs3mYRdwjssdsYFmQEF5RF3C0J/Sr1GDukU8my +2Mg== X-Gm-Message-State: AOJu0Yzfvxk98W8qzwMhOTYei+T0Z09EYzvX5p969O71rXTY+OcC0ieA ypxwUcDaeewcwQsYwkgHqH8ZQzW2GQlp44O54hI= X-Google-Smtp-Source: AGHT+IFjWcdR089jauWFuykjgLXd783I7ptZSSxaIXPeARYv94MEM5diWzECCkPG2Mqyq4Su9vCc0A== X-Received: by 2002:a17:902:b783:b0:1c6:1ac5:144c with SMTP id e3-20020a170902b78300b001c61ac5144cmr1767692pls.40.1695930123696; Thu, 28 Sep 2023 12:42:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 6/6] accel/tcg: Always require can_do_io Date: Thu, 28 Sep 2023 12:41:56 -0700 Message-Id: <20230928194156.237351-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230928194156.237351-1-richard.henderson@linaro.org> References: <20230928194156.237351-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1695930147969100001 Require i/o as the last insn of a TranslationBlock always, not only with icount. This is required for i/o that alters the address space, such as a pci config space write. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1866 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- accel/tcg/translator.c | 20 +++++++------------- target/mips/tcg/translate.c | 1 - 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index dd507cd471..358214d526 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -28,12 +28,6 @@ static void set_can_do_io(DisasContextBase *db, bool val) =20 bool translator_io_start(DisasContextBase *db) { - uint32_t cflags =3D tb_cflags(db->tb); - - if (!(cflags & CF_USE_ICOUNT)) { - return false; - } - set_can_do_io(db, true); =20 /* @@ -86,15 +80,15 @@ static TCGOp *gen_tb_start(DisasContextBase *db, uint32= _t cflags) tcg_gen_st16_i32(count, cpu_env, offsetof(ArchCPU, neg.icount_decr.u16.low) - offsetof(ArchCPU, env)); - /* - * cpu->can_do_io is set automatically here at the beginning of - * each translation block. The cost is minimal and only paid for - * -icount, plus it would be very easy to forget doing it in the - * translator. - */ - set_can_do_io(db, db->max_insns =3D=3D 1 && (cflags & CF_LAST_IO)); } =20 + /* + * cpu->can_do_io is set automatically here at the beginning of + * each translation block. The cost is minimal, plus it would be + * very easy to forget doing it in the translator. + */ + set_can_do_io(db, db->max_insns =3D=3D 1 && (cflags & CF_LAST_IO)); + return icount_start_insn; } =20 diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c index 9bb40f1849..593fc80458 100644 --- a/target/mips/tcg/translate.c +++ b/target/mips/tcg/translate.c @@ -11212,7 +11212,6 @@ static void gen_branch(DisasContext *ctx, int insn_= bytes) /* Branches completion */ clear_branch_hflags(ctx); ctx->base.is_jmp =3D DISAS_NORETURN; - /* FIXME: Need to clear can_do_io. */ switch (proc_hflags & MIPS_HFLAG_BMASK_BASE) { case MIPS_HFLAG_FBNSLOT: gen_goto_tb(ctx, 0, ctx->base.pc_next + insn_bytes); --=20 2.34.1