From patchwork Thu Sep 14 17:44:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 722574 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp527487wro; Thu, 14 Sep 2023 10:45:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVazthpEhg4hqbqNCxw18poxw/PmXGXiVzKARnmKkidipTTcb4zCZVWlPCiVvVVkPp6We/ X-Received: by 2002:ac8:5d15:0:b0:403:66f7:ae66 with SMTP id f21-20020ac85d15000000b0040366f7ae66mr8066880qtx.13.1694713530139; Thu, 14 Sep 2023 10:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694713530; cv=none; d=google.com; s=arc-20160816; b=muFZo1YVpE1CBkXqKWp0SA8lnlGoQEAsKp5IhX45Rwz2FevCTY9DM90oL2kzer3ivV qGDZU44KC6JLEkBKHNjbMYSVqbvkF5Kl/41+2q7dy5sLD9ZE7GgwOgjs/x5h4y4+ow+H fNz8zeoPqzZhEnoOhKEtTRSsUS1I5qWdf0MkXnUGdZAnWdTeNamet7Os3eqpjMqwBFV0 f6Euilp+5W4Kn0wSJWOWOxB9h9MlzvxKpbatwKCJfTUq/d26u4PSB7dGp2FL4Cyaxr1g UQ5KuB/8kLPHzVlgdrNIKMnLf8v0URkYI4agq1Ywd17UUVfLah7qRHszU2T6iOXWruE+ GKAg== 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=bgCEQn26u9cOavCqkRzqblhPRJruQuAIdfQLbzQ1zEg=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=D1cTkmKyffqgmb3YPKu53z7MrMr7bLYWcYERbaMIHcTZB5SjpdLxt39t6U/BdnEToe B62Q46lApu2mv1LqIyWufRBHoPC/4cZyOLSneXGggPH48o+Va+JAd3qU7d86ggMBr6Hx isur3H2Lb38Ie5XVBpgyWf+pB2hOPlL3VR64kUl4Edol7oV2BiItDUS/oL2FsYQ5xCxd E0/Gz8P/dGkoAf0yotoRNZ0KRvA/XSZ/LVruBPdXyTQ6p9wZlKLntY32f8RXKdvivZY0 UYjjWx0L0YjHAtPb1hX1cKEdaoW1YkaqO8TJKU98aVLG+NkEZY+ZTB73gvyu0P8RzhJQ dFyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MDiFtmxG; 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 d19-20020a05622a05d300b0040ff1b4ba5fsi1242652qtb.729.2023.09.14.10.45.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Sep 2023 10:45:30 -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=MDiFtmxG; 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 1qgqOT-0000ds-U3; Thu, 14 Sep 2023 13:44:45 -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 1qgqOR-0000cs-FS for qemu-devel@nongnu.org; Thu, 14 Sep 2023 13:44:43 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgqOP-0006yy-6e for qemu-devel@nongnu.org; Thu, 14 Sep 2023 13:44:43 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-68fb71ded6dso998113b3a.0 for ; Thu, 14 Sep 2023 10:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694713479; x=1695318279; 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=bgCEQn26u9cOavCqkRzqblhPRJruQuAIdfQLbzQ1zEg=; b=MDiFtmxG/VbbRVIHQ8wtvyw5adaY+/CBt8uMMAg5VpN/TF7BZu2Us0wmu1L6QzBOfd OlvhMnQWYOjYk0yz7vHD+aXH2+IaPDhRizmsaQJjSTP5yNyJezlWZc1daCzGGH2hLwBT yVyFNDPWGtsz0Dr9krhHW9YBBJcu5lQRCNpCnglTJYsL6OoGJ06g2sDFOxetaHWSTROm QnTK5Ww4iVZ9mtoi0nCisfxW82UrCn8DbYeNK2FPKGwJLydm5v+1LiS7g2mKlYTcsmQS 6Lgb0rcvM/Gpryd393+6L1gj9OIvA2ZTCuYWEr54sZDr62C2P2ji+QS4WJzJL8TasP2A dFTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694713479; x=1695318279; 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=bgCEQn26u9cOavCqkRzqblhPRJruQuAIdfQLbzQ1zEg=; b=CsvM0RQXW7Qy6M1Gk8bUJxGFrNn2f0eWvI13+LmU7t2Z+L59m7CfPCHmGFz8QEO7Jg FXXFRxjzK56MAx6qF9+2gaoDHCszjFYklRiYyDtvaoA3c2fnucjKCvAC1Mzjl80xRiIM bQF/1JURPSjZBFkC6pocXEjw7+uSaIITR95T4PKqzEVkXMtE/Hw20akJ/G62CemABcCx gnKagkBKpfkDciccXnhKUAlNpfOxSQvF8KuK8xxL7Ihb54lGFLYZveDWfIhyerSLTj/p gCiNDdsc/OMCFxO4j1Qjpa1jlaaNESZuHCZ6r+rwwbprb6RTxbH/VENzkp/AhkZBg4zy BPAQ== X-Gm-Message-State: AOJu0YyUouD7/3gE/+YUXayrFYraXpFMylkLlBrGhyjNNe2ThSD1r+io rtYRdWJi7QMoIZELSXSkaj5tgK/SXaDn9BrBhjI= X-Received: by 2002:a05:6a00:851:b0:68e:2d59:b1f3 with SMTP id q17-20020a056a00085100b0068e2d59b1f3mr7473449pfk.13.1694713479363; Thu, 14 Sep 2023 10:44:39 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id w17-20020aa78591000000b0068c5bd3c3b4sm1588933pfn.206.2023.09.14.10.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:44:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 2/6] accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop Date: Thu, 14 Sep 2023 10:44:32 -0700 Message-Id: <20230914174436.1597356-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914174436.1597356-1-richard.henderson@linaro.org> References: <20230914174436.1597356-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- 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