From patchwork Wed Oct 4 08:01:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 729253 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp221598wrs; Wed, 4 Oct 2023 01:12:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFp4t2AgsCYnpBhtMp50SrcT9PQvJPa/YfJEHad8WPxSuCPHfhy8veZ/LNgPovwGjDiB5DE X-Received: by 2002:ac8:5f13:0:b0:418:554:fa25 with SMTP id x19-20020ac85f13000000b004180554fa25mr1957925qta.47.1696407148022; Wed, 04 Oct 2023 01:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696407148; cv=none; d=google.com; s=arc-20160816; b=g26JLKetgiwiDtc2Ekf3xM/lZxZVp05op8jkAzwQzluBvRRNfdKsr2ygoC/myaJqkT Bgz9PYZbX/KReP+X1uqjBPo7LVo5BaCHnPRx1rypNP4tG9WRX+nBiOVHJMQndT+on9JF oZxY/Sx2gTwRS21LOrg7FWxE6BSHBo7EQAtVLU2mvP9yLtSEhLwGXrqjzW7mkNp3VeIC pxTHvw8AjgzTFV4HKAFcRuODDdjxuJNawL15hFiTP4lIvFV1eBUyoDu2SWCYwwTXtq5Z bQwV8BnHjf9wo+moHAtmvs1IWCncRNBKxlS75UWG5G3reBKZ2SFtht+mPXIn69E6WntZ T9NQ== 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; bh=iVDiyQeFKkvdM4ftUiZqGTgtlgLGmvbYpxe2JgWdGzw=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=LMwH6+q0Fc+Xs+0dRdykbeg5M1wLZDiZCXB6lQSoh6Y82+Gwa3dgxtCWZG6F+HVDzt OcOfimuDFkhXbUg+k4Ia61TQIMO0Q4C6uy4lKQpUEr4uOwYZ3msGf+iBEVJGaZZxXarx Kjj3KIR1UM6s2CnEZSkqBpfkxh0Av4Lhm/DhDRkxp91mzLWKZyAO66Q2edAzDjfgmOAA T1hOAycNxLRoZdPx2Q5nHInw2ohSeX9lxydbrl21zVtW2tsQ4yCS8mu8dWqZJi9ehmkw j/lFVcW1JsUJ8VUK43v/AgVG1KoUqVvdwA72Klo9P2U6JXTHieD6i69uMGzZe4va73yn 8few== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z16-20020a05622a029000b0041812c64682si1284495qtw.112.2023.10.04.01.12.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 01:12:28 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnwvt-0002eJ-7Z; Wed, 04 Oct 2023 04:08:37 -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 1qnwtM-0005tj-KJ; Wed, 04 Oct 2023 04:06:07 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnwt6-0002tm-0g; Wed, 04 Oct 2023 04:05:48 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 45A2B275B0; Wed, 4 Oct 2023 11:02:30 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 7D1742CBEA; Wed, 4 Oct 2023 11:02:29 +0300 (MSK) Received: (nullmailer pid 2702859 invoked by uid 1000); Wed, 04 Oct 2023 08:02:21 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.1.2 36/45] accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop Date: Wed, 4 Oct 2023 11:01:57 +0300 Message-Id: <20231004080221.2702636-36-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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 From: Richard Henderson The condition checked is loop invariant; check it only once. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit 5d97e94638100fd3e5b8d76ab30e1066cd4b1823) Signed-off-by: Michael Tokarev 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