From patchwork Mon Jan 30 20:59:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 648594 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp1376138pva; Mon, 30 Jan 2023 13:03:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvhG+hxE4PWyLH8DwUL92hGhkduVvrxPJ3aSItWWaNkoynOHzBwXh0wWj1gF5RbWPtcjBvJ X-Received: by 2002:a0c:8021:0:b0:4c7:13f1:98bd with SMTP id 30-20020a0c8021000000b004c713f198bdmr71411954qva.5.1675112614066; Mon, 30 Jan 2023 13:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675112614; cv=none; d=google.com; s=arc-20160816; b=AA1kAG7qWjEdKWupLx/UalgUZeXfX5VaL+EuTnDIvQNlFlrDVrUw1wa8/GTpZXylor 0W4b535BVtBGoFOOZ5ORW1gCOH8eB2bUfUVU5HmaDBZ8d7aphgfMErZxcmaXaz+h4O5K N+eEyCHY1sAkAq8UJp6A9VoQJG0Q4M6AKYVlVb+Iid/87nc5MBgCxDRZn1N0MZ+zJdHU Y41E3N8xswEOVtCeDNE0W7q1NsdZL8bp6cu+UZMQ4VWglSHLzYC0MlcDE+3F6KOt6cPx DTbnZ7+8DHZQQRuqc1G1gnxiXk8aQFoQ6z6px7yzHJYijFVE3BE1yqxOYcr4Nb9kqGTn MoXA== 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=sTUZLEFCfr7lT34+spBSQV2zfVIDOr8BydY/0R/vz+U=; b=g6VGwmn4l05TO/PBNj4P5Q1LXA+CvwrKCL/s3kAIJEdDnQJ6+rv/+Yptl8L7U2LoWB 8/MTW3zylj4txFInNoajgy3Znm8Ml+G24ohn/Rcw4cGjgspfTdsQLtNE6Ha15gUakInf bcd2GiaIugIEvQOS22NjFea9bXyUCGtmRDb6WBbJ/77SHwswZJ5iA8q4vVKZe5wmYG2k jL+JSyZIv0Z+gIhvq+rdo47tj+EHkthmkGlhDCZL3xRKreBCCmr4ugY5MPZOQQAxRqDo B2GgEb4xiliNQJ8oWtpyMNQQlvJIgwk030bNKaH9octBRXoFzEXIBz/46Pf22mMlvM2E x7zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jxbcnqzX; 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 q69-20020a0c914b000000b00535664290f7si7136176qvq.437.2023.01.30.13.03.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jan 2023 13:03:34 -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=jxbcnqzX; 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 1pMbFt-0007vQ-5T; Mon, 30 Jan 2023 15:59:57 -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 1pMbFk-0007Uk-Mq for qemu-devel@nongnu.org; Mon, 30 Jan 2023 15:59:52 -0500 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMbFj-0005D8-6X for qemu-devel@nongnu.org; Mon, 30 Jan 2023 15:59:48 -0500 Received: by mail-pg1-x531.google.com with SMTP id d10so8558876pgm.13 for ; Mon, 30 Jan 2023 12:59:46 -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:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sTUZLEFCfr7lT34+spBSQV2zfVIDOr8BydY/0R/vz+U=; b=jxbcnqzXENm8yzrOogANceQlBCWzYok3tfiBo56TQvyE6Z2/E9Yjc/hCIS8kxq2c43 /JZZ2de4ciQEKf4smuInNuAHbUP/b0Zlkjq0DZDtcOtFMSYdiOdcHyBRm6i7S+MvGNrR 9epROmX2lHPjnB1YyNVZVniChUwyApYLP7yYjARJExadQuzel+HsQ4KujvYSVz3KyQ9E I/2K3vFf3lvPf3WT4hr7MJZUSwlKLgbL8yJ2ZDY8GEzO6vtxKcjByAJJRacQ+VltqCot rn1QlJHY+bwFFvklNbgHfFWldpfxUCRam4Ee6VqBSexpJv9xvZZNoQF8lUzPJjedDYG+ rCiw== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sTUZLEFCfr7lT34+spBSQV2zfVIDOr8BydY/0R/vz+U=; b=jPji0Nvzkwt6lejSSkXN7K9euYY/iXbKugI1U+RiSjJovcw1Ypqec9INJSbWc3uW4w DQsJcPi3dctJfwlgq3Je3/OG1NYAkRiKUMU+FrHMTjddP+dcxvpMi5/gbXkTyT89AkTd 2n9r80/ivvV0PciGOCXGg0lkcnnaO7t66/OPxl4eIoSuK6IT5QiOrtIHtEYEOBM6ydjl IvwmBcpM0tbdEK4JToEKPL3sUkzjFO+Xiyc4Au+LOyQS2Q6RZgB+Dv/88HzoObqMEs1p m3qrzRmQVSAHZlD0UTSyA6Q0rah8HVDIOpO61qSu/bbpvPtRGraWpDTfwSo9H0EQl/QG KHPA== X-Gm-Message-State: AO0yUKUgFYx1ryawZh1gio/cMTHNaL90Q1EM8yqmA0QTiwEZjHyFbB4/ l9wR72OqDxuQWiZthRAqmdTZ9gq+1ViW+bVT X-Received: by 2002:a05:6a00:1f0d:b0:593:b470:aeda with SMTP id be13-20020a056a001f0d00b00593b470aedamr5261352pfb.29.1675112385638; Mon, 30 Jan 2023 12:59:45 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id x10-20020aa79a4a000000b00593eb3a5e44sm102933pfj.37.2023.01.30.12.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 12:59:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, cota@braap.org Subject: [PATCH 03/27] accel/tcg: Use more accurate max_insns for tb_overflow Date: Mon, 30 Jan 2023 10:59:11 -1000 Message-Id: <20230130205935.1157347-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130205935.1157347-1-richard.henderson@linaro.org> References: <20230130205935.1157347-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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 --- 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 08a816bffe..250647eb49 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 */