From patchwork Sat Jul 17 22:18:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 479257 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2745033jao; Sat, 17 Jul 2021 15:22:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB1KWce101TaQAAN6YX62iWfMUsQKQ5yJ/lI5qgAx/I3rtaN6ONr6+4R45KY4hKc1L10l+ X-Received: by 2002:a05:6214:2623:: with SMTP id gv3mr17261131qvb.46.1626560557177; Sat, 17 Jul 2021 15:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626560557; cv=none; d=google.com; s=arc-20160816; b=OCIQaGAq3ToAWoupOedmEvCkkmculyJfAETe/bxo33nOollBv8EU9OF37H72I4qP8I icl6AloRuS+bxVNjIFcVi1KGuIqgItDVDIDq210K5CYSwik+/z4Z/FcpGYBnhEPhynJT 2qsvjF2bSG/WbEXXtVm/yOIcGhs+IX1raym/SPgLdrcxXoirL/WBR0kl1+FuGmwQXIBu VfYWMXfnXHQ1fi8h8oCecfwLcyUlOYrM2UIsdAcHHCz45QaRwtGHKMsNlYQzK1x2mx27 Yc1kSqdPNcrby+QgDfX4skHEg0zfoKktmruESTcHnp4WsYxAWFBiNhq42SWgH9KTI2YK qHmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=ImN2rDIibPWqsxrjnxHa+huo1+KHTGHZlA26Q9cu+A8=; b=wZ5WIOvwa/DenXJ8BS9gpF7F0r6KYjpZuNwxNknUbe/gcljt0QAtzmlgAuIlz71owj 5jLvvHtLthxAJJW7s293qpjvvRoW5D27/HNVQGMViunZagt2lesr5JHHFo5DzdZPJuPb kjNL/8e2oGrHCMwgtZ1s2+6tlCt/Y3qMdT7WT0XGPdcGyvmxsDRN4/qi5vjT/DBqRsX8 dX6qsiubHeFFpJJXch9jvo6J/RG0UuG3Xdzykyw2relRaJeQEhHM0jcSTDHzSSv+9h/Q d0yOlb8zxhe08eB/Dtx0fZGxPgw+He+d5qsdHgSejWmLtwpqA3zhdkhWIdDjbt1EE6xk pM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h2eO0gV3; 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=fail (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 v12si10259388qto.199.2021.07.17.15.22.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Jul 2021 15:22:37 -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; dkim=fail header.i=@linaro.org header.s=google header.b=h2eO0gV3; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4shg-0004Dm-JL for patch@linaro.org; Sat, 17 Jul 2021 18:22:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4se9-0006pR-UR for qemu-devel@nongnu.org; Sat, 17 Jul 2021 18:18:58 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:34304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4se7-0001yc-C0 for qemu-devel@nongnu.org; Sat, 17 Jul 2021 18:18:57 -0400 Received: by mail-pg1-x530.google.com with SMTP id 62so14574424pgf.1 for ; Sat, 17 Jul 2021 15:18:54 -0700 (PDT) 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=ImN2rDIibPWqsxrjnxHa+huo1+KHTGHZlA26Q9cu+A8=; b=h2eO0gV3xligBMjC2kDqMUgnqnmQNHJKhVCc1X534ofr7XVIUMWQHIVRz12ZmGq3C6 z04PWOvASSanJwKBOYLdTXTQWcPuypBDqR5KLGTf+zSLjHe6dldXcoK/k2eseQBSYq6A ErYG0wzH9kWmT/LQQOIuqGvlJ+aSGgIVbCdEPmdnfy9HwopHHJ6VKlFqgvuTDjsk2Ti0 lCJbaRmPa8D/ofxazewakaL2NnmU35RbJhRDjNZNzuVOLz2fYBNQ/UddF1QviQh1zUHu JORDeUWIkxgwi9XVDM/Po+R/ZOcYwEMB9FCyk3zgPKRfYojM9uqeO46T5QRNdnu0IqY0 r5Sw== 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=ImN2rDIibPWqsxrjnxHa+huo1+KHTGHZlA26Q9cu+A8=; b=h10dQTollbKN+OQ4UfucJipD5i22xFDBO5KLExFZGrdAnYlWKZEb/vOc7pHp9PGpOV wy1WNKrjNAsZarat/R/SpoFdkAhBbax9V5P67M//3shmC2rMwrOreOUFpX2mHcqznhVH dLOWnd1PcsaFZfVM/xILE+BdJa0kNPDDhagb8kU3bIzMkaOo//viv3ddrN2JRpystqde eu2VWTom7flozoobPMNeLKLv+4aNR3hGFNjmJgyWz08G2KRA1fg995cZlQ3SQfjfjtmd C7nWHoJGHoLqjCMOK+uzNhuRbkD7oSa9kyA4nbTvdIgUP7OnnLFe2ZRKok99YPQzlj1A +bjg== X-Gm-Message-State: AOAM530RVCn4Bm9ayBit42KxGgHqe8WqK/5DkNNwi/bRBUt+qj3chW0Q OATvkZ7MGu7hiyvgIR63N8LTMRoNYgusqg== X-Received: by 2002:a05:6a00:14c4:b029:331:7474:cb4b with SMTP id w4-20020a056a0014c4b02903317474cb4bmr18023776pfu.30.1626560333464; Sat, 17 Jul 2021 15:18:53 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id n14sm2405091pjv.34.2021.07.17.15.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jul 2021 15:18:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 01/13] accel/tcg: Reduce CF_COUNT_MASK to match TCG_MAX_INSNS Date: Sat, 17 Jul 2021 15:18:39 -0700 Message-Id: <20210717221851.2124573-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210717221851.2124573-1-richard.henderson@linaro.org> References: <20210717221851.2124573-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The space reserved for CF_COUNT_MASK was overly large. Reduce to free up cflags bits and eliminate an extra test. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 4 +++- accel/tcg/translate-all.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 754f4130c9..dfe82ed19c 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -492,7 +492,9 @@ struct TranslationBlock { target_ulong cs_base; /* CS base for this block */ uint32_t flags; /* flags defining in which context the code was generated */ uint32_t cflags; /* compile flags */ -#define CF_COUNT_MASK 0x00007fff + +/* Note that TCG_MAX_INSNS is 512; we validate this match elsewhere. */ +#define CF_COUNT_MASK 0x000001ff #define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ #define CF_MEMI_ONLY 0x00010000 /* Only instrument memory ops */ #define CF_USE_ICOUNT 0x00020000 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 4df26de858..5cc01d693b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1428,11 +1428,10 @@ TranslationBlock *tb_gen_code(CPUState *cpu, max_insns = cflags & CF_COUNT_MASK; if (max_insns == 0) { - max_insns = CF_COUNT_MASK; - } - if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } + QEMU_BUILD_BUG_ON(CF_COUNT_MASK + 1 != TCG_MAX_INSNS); + if (cpu->singlestep_enabled || singlestep) { max_insns = 1; }