From nobody Wed Feb 11 01:00:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1613222929; cv=none; d=zohomail.com; s=zohoarc; b=bOY0bhpd+Os4pYqLLlpyAIt5Dl0BYk+hJTb2xnXlSX0DVxnfWypgMUNOvpR6kIgEiJY4GUKaWs4Bvryf+cKjiA031ko7BPoyGuF9RmSOoydhQ85ZvlfUCoAIwFueV8xvLAwIX0quH0+jLo+evRRrrtRIau8kz/xqGPaStRXb2bQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613222929; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sLRYtNzUYMGlG0RFqU3qAIH1hSNZ0dnsFsh4PVmqjUg=; b=SL80dKZsjYgslriop/YxnjBysyiNvWFz7DYt21rFhGbQ3N1QubBEF+0HWr/KPBHq4mownxbgb8Ts9zlZHd+uPVuWTHGGRTnJwzFRqqSwnokD1+oxKtprplHbAjyKD2HjOAi7XQWszmcvGOAXwODzeUSSZAaSJ1Eb+8lRBYtCyBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613222929928463.1376199589861; Sat, 13 Feb 2021 05:28:49 -0800 (PST) Received: from localhost ([::1]:44008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAuye-0006Oa-TI for importer@patchew.org; Sat, 13 Feb 2021 08:28:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAuib-0000OT-96 for qemu-devel@nongnu.org; Sat, 13 Feb 2021 08:12:13 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:44722) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAuiU-0000pQ-FR for qemu-devel@nongnu.org; Sat, 13 Feb 2021 08:12:11 -0500 Received: by mail-wr1-x433.google.com with SMTP id g6so2876007wrs.11 for ; Sat, 13 Feb 2021 05:12:05 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t30sm11717555wra.56.2021.02.13.05.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Feb 2021 05:12:03 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 106D21FF9F; Sat, 13 Feb 2021 13:03:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sLRYtNzUYMGlG0RFqU3qAIH1hSNZ0dnsFsh4PVmqjUg=; b=er+yNEIb0bQrLtaZ1+LunVihmmkkocBTc7qSiq9MI5iLvtKDfTY3hW+zBIjyj6LUMx nwVfGm04Eyb/Z4pyu9CPCDKHasJxocG5gsfdhZFCujBopdXqtrHElnwvOtGL3VJkJo2d uh21JjTCb+1QB5AF71wz5EyW1CvIE9CeC4SK/EDXIedtI67EO+A+VzZoJXZFk1/D9l74 4Nn+wPlXmVaqPVPQ+cHCMfmhbRRUzJr+W4Oxyfv3UXdbhkcaJPMHXr63t0CyIBDB2V6A l/DvpAs0FmHFBKeMeVQIwly7yLidaTJzmzUyvrCzUrpWPIhXcGrdktmq5imV5VHt7RfK WAsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sLRYtNzUYMGlG0RFqU3qAIH1hSNZ0dnsFsh4PVmqjUg=; b=oGFmBObLp/w+HEQAvr5O4otIIpqJlJnI8C2YQkQYV/HtoSG1LCOaVtbvjIROhtchgg YO4d3efhlk/irGnqTT+sSdXMuT2DMaPg0zJNs6Yw28Y3iHPp2g2THHg0iD4kb5YnTHX3 RKjxWrxDVTJdpPL6DmDDjhY15CLGp/q7Wwf6DLeqoBI5e0PXA1Gjt86Lun3gBsXSbew4 tRCRlTrwvX9MNk2xn5EXmfCCKG3d5/m6oQY7wimLkidGhH3vKnhtopo4an+YxvfIuJiD WjYfagYxQc7G2upBasFgz5xsZTDBisWrIkgu5ZLspu7zoCThYd/b+lLIMOE/kCAAsPZI 8hjw== X-Gm-Message-State: AOAM530+YswVdNf3XA2ZHNTPdq9Qx6tubaTvGExeqyNawAI1uP4O2xvR qRPWQJCy7tryhowldIoO9iJQEw== X-Google-Smtp-Source: ABdhPJy6vgHJ0quvVGH42AUD3ICMtIV/2aw6DeRji6FdVcjLfF79GqN6f6BikgxRgzNXaY+FQkmP5g== X-Received: by 2002:a5d:4ad0:: with SMTP id y16mr8774378wrs.399.1613221924947; Sat, 13 Feb 2021 05:12:04 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 16/23] accel/tcg: actually cache our partial icount TB Date: Sat, 13 Feb 2021 13:03:18 +0000 Message-Id: <20210213130325.14781-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210213130325.14781-1-alex.bennee@linaro.org> References: <20210213130325.14781-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When we exit a block under icount with instructions left to execute we might need a shorter than normal block to take us to the next deterministic event. Instead of creating a throwaway block on demand we use the existing compile flags mechanism to ensure we fetch (or compile and fetch) a block with exactly the number of instructions we need. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20210209182749.31323-8-alex.bennee@linaro.org> Message-Id: <20210210221053.18050-17-alex.bennee@linaro.org> --- accel/tcg/cpu-exec.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index f2819eec7d..d24c1bdb74 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -730,16 +730,17 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tr= anslationBlock *tb, /* Ensure global icount has gone forward */ icount_update(cpu); /* Refill decrementer and continue execution. */ - insns_left =3D MIN(0xffff, cpu->icount_budget); + insns_left =3D MIN(CF_COUNT_MASK, cpu->icount_budget); cpu_neg(cpu)->icount_decr.u16.low =3D insns_left; cpu->icount_extra =3D cpu->icount_budget - insns_left; - if (!cpu->icount_extra && insns_left < tb->icount) { - /* Execute any remaining instructions, then let the main loop - * handle the next event. - */ - if (insns_left > 0) { - cpu_exec_nocache(cpu, insns_left, tb, false); - } + + /* + * If the next tb has more instructions than we have left to + * execute we need to ensure we find/generate a TB with exactly + * insns_left instructions in it. + */ + if (!cpu->icount_extra && insns_left > 0 && insns_left < tb->icount) { + cpu->cflags_next_tb =3D (tb->cflags & ~CF_COUNT_MASK) | insns_left; } #endif } --=20 2.20.1