From patchwork Wed Feb 22 23:26:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 655712 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp36394wrb; Wed, 22 Feb 2023 15:29:32 -0800 (PST) X-Google-Smtp-Source: AK7set/2qk7sOvtpVCdtXM0efVzDEfflR1gwSl89RkLqoYkCY2a59zVSA/lp+J2OadG0aRVnreBA X-Received: by 2002:a05:622a:1196:b0:3b8:6814:ea20 with SMTP id m22-20020a05622a119600b003b86814ea20mr18809050qtk.67.1677108572202; Wed, 22 Feb 2023 15:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677108572; cv=none; d=google.com; s=arc-20160816; b=i0ENxVNBZsgT7n1i2qQWBggtfWh4Cbb0zDk0qUnIPqpGGerd2V5HKhBfP5D+035GON A8EO41vwppVCdKIUUpeGczHb1kDzKhc3bDKtH/FJ50BuMZ6cCRbknTLfF8OU/6T57llT qOD2JKTqsIL/GCfuvTT/sxKZCD3UP+lTWQDndz2FgRE8NOgJ8j2KsorRRrcrrh84ZLqe 4BrQlDAJRn5tbkQadWbz/m6aEooKe1SXhbkUnWBvO6ZEBDDqgyfjnCPP8SGK6glIscRJ ibFtgwTMBI1KW1f5jRldU11a1nQApMBssVopewRmL5X7mZUy+EwD69SneobK0c3rXVEQ hM7A== 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:to:from :dkim-signature; bh=e0W3dfgscBZiAke8PH+I6rrjx86D3UgfDKHKsEqF660=; b=ISWOeeJm5OnqUinf6rHpf2TvcfMCgbYd742byjzAwpH8xt6JsJMBXygRNewlFIBakN 1s3wSKKy7QWRgPfHcS4wX/eHja3//QIWrS/fmYGCwC/jhvJHrAqKd2T4ybAqc42/5kp6 vpcUErcmUQJV8A5kPxMukZsFaa404VydSo0gRxmg14aXJkgwk3GPLSd7KkPlxN5ouUdN dQmTTWR/9kgEKI74vUDEohYvxdXYkqgx2dUk2aj8Z9bt2qnvaQAkX29r41U4KS9Ey5El dLHojvCmJxZ5gddegFqFl/khAV4deNhV9f5e9DgVn3PuCZgVBeHRp2ktVqXzPfALDqz2 /nPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ltpso0nm; 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 o7-20020ac80247000000b003bd161e1e8dsi2497780qtg.549.2023.02.22.15.29.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Feb 2023 15:29:32 -0800 (PST) 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=Ltpso0nm; 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 1pUyWD-0000MO-W5; Wed, 22 Feb 2023 18:27:26 -0500 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 1pUyWD-0000M4-64 for qemu-devel@nongnu.org; Wed, 22 Feb 2023 18:27:25 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pUyWB-0005IW-MK for qemu-devel@nongnu.org; Wed, 22 Feb 2023 18:27:24 -0500 Received: by mail-pj1-x102a.google.com with SMTP id oe18-20020a17090b395200b00236a0d55d3aso10509420pjb.3 for ; Wed, 22 Feb 2023 15:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=e0W3dfgscBZiAke8PH+I6rrjx86D3UgfDKHKsEqF660=; b=Ltpso0nmKJOGBFLs3z7zQaNOILBRKogOVRfKAlULMB7Q7ERElbNPPRMP4KtbrDHT8v O3iJs6PcvLGuZna5jEFkLXpot/Irnr+P6C8RvXCSifn9hP8Vutb1HV16nXu0CsgdQQlS vOqjs0nraxFsn/BSYFmg9yz9uDYrqhTgRDgAFBXXoTmdOiKNKR6gvgkIGrPruSGcAP18 9kDaC/2pn/PpaGKpkKmWXp3EYYnUrpDs8wNFy+vhEWW8RL+VvTY5tJDXon8LJFDm7srd AojtGSJUN5sA37kzkNf78SbLqjf/k693+m/98NF5J4+vQVoiZdJgZOu1io76RMgeIHe5 OCzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e0W3dfgscBZiAke8PH+I6rrjx86D3UgfDKHKsEqF660=; b=2TUV77F+c//dn8ImoGpLi9paO+g/KHB44DSP2e6uFZBPGxv+Qvamo3SQEooCWmu43h bBdyVbW/AzjH3yInP+6qieGuNGoqUJdfK9WWjiL3QUsuvzDJJ6dBrpA8p1SgUn5glZOu twbPZaff0hSKE5v68WCwgQuoR7XGB/QHk+A/vlX0rc15FVYpIXgMV1N7v6oLk4dsOZxd zZGe4S/xiQaoH7ZCeBaZEhD91pLYe937y50HACS/rWffTPJhH5iQagLFvucMpxvQLZrc VhUr0BKm+pPM1sJtGFrroWPqEPos1puPM9jGPiBe9DvApoZGIPI/JGYh6nGBy9Po3BDZ AjVQ== X-Gm-Message-State: AO0yUKVpkxmLpBmg/EpwSC/pNYpP79lbNcZ0FLgVKFL+Mcti4dV9ZPn7 l3r747Lvuk1HraJpUDuCJqhCpyU3Yefi46+SLvs= X-Received: by 2002:a17:90b:4b83:b0:236:7270:ddbf with SMTP id lr3-20020a17090b4b8300b002367270ddbfmr10681688pjb.21.1677108441872; Wed, 22 Feb 2023 15:27:21 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id s16-20020a17090ad49000b00234e6d2de3dsm5008918pju.11.2023.02.22.15.27.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 15:27:21 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 03/28] accel/tcg: Use more accurate max_insns for tb_overflow Date: Wed, 22 Feb 2023 13:26:50 -1000 Message-Id: <20230222232715.15034-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230222232715.15034-1-richard.henderson@linaro.org> References: <20230222232715.15034-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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 Write back the number of insns that we attempt to translate, so that if we longjmp out we have a more accurate limit for the next attempt. This results in fewer restarts when some limit is consumed by few instructions. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/translator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index fac1e8c465..62e8f28025 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -78,7 +78,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, plugin_enabled = plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY); while (true) { - db->num_insns++; + *max_insns = ++db->num_insns; ops->insn_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */