From patchwork Sat Feb 25 08:59:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 656453 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1352568wrb; Sat, 25 Feb 2023 01:04:05 -0800 (PST) X-Google-Smtp-Source: AK7set/bdlSgASGv2L06QlvVRMO+iAiNRU3ilopet98of6RJROX5HcshXbK6RDhfKlcWV3XxtBwi X-Received: by 2002:ac8:5a81:0:b0:3bc:d0de:6adf with SMTP id c1-20020ac85a81000000b003bcd0de6adfmr33724679qtc.31.1677315845784; Sat, 25 Feb 2023 01:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677315845; cv=none; d=google.com; s=arc-20160816; b=qUMwrdCPUK25/EwZSlaQG0NYv+MTwSpWq4PG4aulCeC7tTYtmB9kmTftbhftoZJMnt P6nzdNHYtuozFlznv5WDqqBEm7RCCmhy7WNZVlQq5tNNuc0alZ362moQHC5zX6EHWdpz t9ZscLTMeZIVk3g3zN+5WO57QsBIr112bKkJab6gkNAuh+f531v8EOKzYpL6bCDsyFaz 0lFgZRISmdsghnea3EFC7wDzibQU042EO3Kjb20DEXeMp0AxIz2EI2CP9HNV5UBRZEap qNoz+74sOlhVFD9dsGMGFkhwuLJij7m5xMSdfEuylxKD42cETiJiKruZn/YJrpVWEiQ8 0l7Q== 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=q/lxx08bzggLpozZyWgUkQK1Gl9+CtNC5ZWpyB9XF2A=; b=bPkgrfB/RUih7eW4yi1SP2bOPO302W9vh8DkVo9x4by20DW324rrUKpbpE2lgZuRX+ SSfj9F1N1ZZFYVGsPJOBpgnx9UKCRxI24GO/eg+ZdhdWyGos8EePks4T/vGzsKV3qnvS wWUQmIOTH6Ibn2TuLoXjKWSbGp0Sl8+Tm4Ljfk9xYs2SfwDL19wvX/p5j2nkvLxQln2b 3/Lh4fkeb4ynuqSFpKQOaPYL1pR7H7rl4L4QEgxVOpRTzHj5zC8HnxpillaIEYYYAhCz v0OdfXx1aG+bU7CXkv/xZl/8XZtPGBVsAvSOL+jTKZnBF2ZO4RtmGajCD5kJzKpzcKm0 hG3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZVZ2Cbuj; 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 z24-20020a05620a261800b0071e1bf11e81si1385198qko.363.2023.02.25.01.04.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Feb 2023 01:04:05 -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=ZVZ2Cbuj; 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 1pVqPR-0000Na-3n; Sat, 25 Feb 2023 04:00:01 -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 1pVqPN-0000MG-7a for qemu-devel@nongnu.org; Sat, 25 Feb 2023 03:59:59 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVqPL-0004pG-BP for qemu-devel@nongnu.org; Sat, 25 Feb 2023 03:59:56 -0500 Received: by mail-pj1-x1029.google.com with SMTP id cp7-20020a17090afb8700b0023756229427so5213045pjb.1 for ; Sat, 25 Feb 2023 00:59:54 -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=q/lxx08bzggLpozZyWgUkQK1Gl9+CtNC5ZWpyB9XF2A=; b=ZVZ2CbujN6KzFIUGnHL93oFfllzQBsp0iFJ1oeHPFPr2+xlKE3EHIT+qpLyLpq+jah M99XB7jaE4FTkWyDytOe4X6DHtZxa1ciTrO2L135G9qu+YXWWsQ3W3iXiT6zG8NminSs DyNv1mUcsh+XJgGnsBJWIgdswau1DPT9DoWuuhEPq9YRQRSnWM3nGStaoBKJv9tVu/sQ fQstqdZbYqDWe1N6M5eN0P7GMj6/Lh34ahcwiQ47QObJx36djVBZu1YptS1JudGd2Fz4 m+VkYshcjqJ1AyWNiPuksYc+CjgvzI79eJ20kvX/H3pFISuk7ByvnkgLEQK+eTDC74i7 1LXQ== 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=q/lxx08bzggLpozZyWgUkQK1Gl9+CtNC5ZWpyB9XF2A=; b=H82MvFkXMVGslXnRumrlCAlNn2AE2ytSpUgqfArmGVDTrY3AsMB1Fw6nH6aSKWRRxT qQSmH+B2rxODPsdtCOXk3C6KI3GVArFRcZrGLLymXNeFpTSkndasS9D4+7vXG96z/cA0 JXfUgLVu95ape5pNpp+pNuMpJg/GC2pbDpF5HeRGcRfd/2BBXqpgH9PC+IjEs1OG6Ue8 K99gVJ1OSy//LS/JoX18TheM4N58OUTAuROeDPytJ7yNlqliFN0C/zvMEly9ko3TDeN1 kn29SSX3pOauWuHOvlIewvLo6vnGA5L2JTCuM4yuqnPPc4Abuy1GOBS9yJak8NFDzzfZ 2OuQ== X-Gm-Message-State: AO0yUKV3I3KHOj9eQ/Nga/EXhNKXOpIBxQRimwxPRonYriL/WEmeRo3o 8v7yiDBZYeXENmEKdV5QtX/nGAbtCu9ssAvG+BA= X-Received: by 2002:a05:6a20:1585:b0:c7:13bf:695e with SMTP id h5-20020a056a20158500b000c713bf695emr20786108pzj.18.1677315593919; Sat, 25 Feb 2023 00:59:53 -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 s17-20020a639251000000b00502ecb91940sm715546pgn.55.2023.02.25.00.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 00:59:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 03/30] accel/tcg: Use more accurate max_insns for tb_overflow Date: Fri, 24 Feb 2023 22:59:18 -1000 Message-Id: <20230225085945.1798188-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230225085945.1798188-1-richard.henderson@linaro.org> References: <20230225085945.1798188-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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. Reviewed-by: Philippe Mathieu-Daudé 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 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 */