From patchwork Thu Sep 28 19:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 727095 Delivered-To: patch@linaro.org Received: by 2002:a5d:60c8:0:b0:31d:da82:a3b4 with SMTP id x8csp94113wrt; Thu, 28 Sep 2023 12:42:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlDLxQZeX/jKILWLiAnISXSwHy8oLwpoM0SL3SULB4RvZhXiYhs3Zc3r7RvJUuSxMbtL+W X-Received: by 2002:ac8:7d4d:0:b0:412:c81:eff3 with SMTP id h13-20020ac87d4d000000b004120c81eff3mr2297814qtb.15.1695930137998; Thu, 28 Sep 2023 12:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695930137; cv=none; d=google.com; s=arc-20160816; b=HubzM9h4f8g6eXMrkP3t3fbZPba5PDR4ZDD32HgIb8k8OQk+4LrxTNnn7BgZjdlxfO 6Rpvl6uM/IHvatrS7wPvMk97sMUKvph/1l7Adpchufo+Dx6ZcLCCTH2azvrHwM/3uiW6 l+lrlaUDKEA7OU6LHX/za7BJTsx/l4ivb8uh2xeiZvq2CvUW6XkAxSGpvmQd+mr7mSKa dp9qkRylzdHKwGtAh9RgrnzHvONnDw/aEGwGn7sN+mc3/BxZy8XxxztqgS5wXa/GJFR6 8+gXELTRxHWHPE9c6RDd3VcxcPDMUQBxqtwsnHCKuaW3bzJdcObW1BGHBVDQdem1qH5S ugVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=ytGH6JE+ydbRM4358s66cugltU3Ll2YBV5fZ6EN4mvI=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=U6hgDfXWVvsAVsgOue5J2F90+as0089UcOuN0JAJC7ynS4giHyvVnx4pdIcBTsRUrf 1Aia0YsxF0tN9dloeBbD0MPahQkWr6Tb3Xa1YriQcAdkM99TgfKNSgS3JsbLAsN3t/q7 iHDCMreml+zZTUA3UXhzd0RV/psk0MI/mt1RCxiBQCBSn0DItVTQ2zTuhXySuNRVxkqP 6NUNzYN5Vuv1OFW1SGzzAP0Bw9aGfTnWUHchtos6itd5yFLOlEExAgNF2rgB8uRMYhIw YXXSesgHpkh5L1N7JABPEz6OYoc/x7qFQNW4F3YUxCo4zc5nojpYYvMHL4aotN8/AyzH p+WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cOXsYqun; 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=pass (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 e14-20020a05622a110e00b00417931c4b8csi5165832qty.570.2023.09.28.12.42.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Sep 2023 12:42:17 -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=pass header.i=@linaro.org header.s=google header.b=cOXsYqun; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The condition checked is loop invariant; check it only once. Reviewed-by: Philippe Mathieu-Daudé 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 == DISAS_NEXT); /* no early exit */ - plugin_enabled = 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 = plugin_gen_tb_start(cpu, db, true); + } else { + plugin_enabled = plugin_gen_tb_start(cpu, db, false); + } while (true) { *max_insns = ++db->num_insns; @@ -176,12 +182,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (db->num_insns == 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); /* * We can't instrument after instructions that change control