From patchwork Thu May 23 16:15:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 798441 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp306058wrw; Thu, 23 May 2024 09:17:37 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVimp9pTjYrDfrTasa5sLX+JcVSbVo8dao5drGpxwbfSCW3rAiQJO+N9x9hpVQP2I7IqNLnQIqZSEWF9hHOU9fK X-Google-Smtp-Source: AGHT+IF7yL4XQRPPn5PXfvrXpTcFeYuqn57o9GqMykgjsHNma+BaLkwhxaNpgvwbWvZ8W4zcF/he X-Received: by 2002:a05:6122:c9e:b0:4df:3558:5ba4 with SMTP id 71dfb90a1353d-4e218571c17mr6443536e0c.6.1716481057555; Thu, 23 May 2024 09:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716481057; cv=none; d=google.com; s=arc-20160816; b=NA6Dm+xsiBDXBTIoMhsKXADl7Ag3GL5ITbVnRjmiFu4WMB936jz4r7IGC9blPgTivg DwJCQTee1GMlL6qYPfqomGIpKOQHkp3w8UeKksmhK3vDsjkGQ+90H3Kxd4xsWhvLSNM6 QDJZyYKlnRIl1vbpx8qmPDFKdg78+5H4niMSA7GQTIhIs7f0erc7L9BA8Et2Ra6cfpPc 1oHLcG9m1TlQNBgyGaA88pFJ1TSb7CAiJnH8nmzh+Le4E4svtHOprjd+T1E5HgrTRsA9 dDzKquAKtrSB2Vs4yeTa2zkK5Qt//EtiQUBO3Hr6Sxq0YcK2KN1F0LxVXpx0gJdQK69L P9qA== 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=/mQMS7XHQY6TkE4rdOTcxfDvk4JYb50U7z9A8FwVzKY=; fh=ud4O1Ydj8kPep7Mkf4OKZprWvK/ZXAvwIEUs1oNffAw=; b=O2mBU9wIZJgT57FhH4N/8KHuPhcWGlpVvt6vUzztujWCz8eMpTPzQPExZui9FPaMfW PDM3dZ1bDggD4pub08BA+ZM2a1fcUTjaYGTr//mAuu0qXPK+P7M4sM0OtXKI9tL75SE+ awwiDBKhC1jzZNUAush4Vl5vM3EfFDKwaIIClmYguUVMyXHdPYTLas8kRHPad+xZsfpQ r9lzBKYiXXfYtu/os6mQoRulajVucFqxeZEqOupjFwKCT9EpPDRnG893nVAN0gwrL0nf OLU3p+4rYsuGcIbC4m4SgIPJLjtxe+SDZSIcgaEzlDoHEwhAJ8sHn5ICX4P2ZAKIrigI t/wA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zYKQvNWm; 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 71dfb90a1353d-4df7c086ce6si5415240e0c.228.2024.05.23.09.17.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 May 2024 09:17: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=pass header.i=@linaro.org header.s=google header.b=zYKQvNWm; 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 1sAB7I-0005D7-K6; Thu, 23 May 2024 12:16:32 -0400 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 1sAB6t-00051i-7f for qemu-devel@nongnu.org; Thu, 23 May 2024 12:16:12 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sAB6n-0002Yz-DT for qemu-devel@nongnu.org; Thu, 23 May 2024 12:16:06 -0400 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6f472d550cbso3351670b3a.1 for ; Thu, 23 May 2024 09:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716480959; x=1717085759; darn=nongnu.org; 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=/mQMS7XHQY6TkE4rdOTcxfDvk4JYb50U7z9A8FwVzKY=; b=zYKQvNWm/QzWXYRaFtgvS7MEYRGCDkLhNzVPNazCFMZ+iD5CIeZeo8sP7mdnZa6/FG +ogwUeoVeO2fpFoPCEd7nN08bJfCdiNwVtkp2r+Vf35VtZWdil6ulYHkJntWrIWEUvI2 JpWlW7NuoFtLLb/o3dAYHXQn++j6XiweOHLOBmOe85G+4fd/Iv/8Xdi/E4n+txy4xC+b +L98KKdCp4ORGC/TwDvB0nwxrFvRc6OGbVh+pQjFndK51q8h7FiC1z37Tg9XfmAqPh9U z+tJsapP4EQWqDYSehMK4xq6lh//SiyOsbh7k37FwG9G09cbi7nPmqzUO1aOpNCxuV7u 8PZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716480959; x=1717085759; 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=/mQMS7XHQY6TkE4rdOTcxfDvk4JYb50U7z9A8FwVzKY=; b=a466tvrYAXf7pBnmhGDG5RnV0MtBPRb9/dm+xCv8+OkTS0QCTfYW+uDVBpu0A+0pBm 8OFCkCtoVtzacm16rl+WS/96nsD6op9h8X9cAPcdou2KMWXxbjdmh8wLqisIsLuZZRMt oIAm9LHweQ/NLQN/jt3OoM0BW2+vbdhCdYK+bAKKLPCZMNYSqVZIBIpLGUBpA1qr4nvU JUutckbuAGm2Lj+6JlwjzKD/0b7obbA3+pIQhbiIahCcpSsLBPkNocD7osrhv+Fgu1Gm PtXbsA8E8t9jQdGlaqLODEA+ZztUto322JC0ksFuH4bIIvjptxGfQplFdSLlUe5U0E33 h5SQ== X-Gm-Message-State: AOJu0Yx4KU+PTpbNkS9VPHhgzQed+tlkWMVLgAlcnEIIgVC4O1hKrp2Q 7yPyGIBCJ37Dl/QjCsfRitUoO3xd/cAxepvinhADob2e89vYTCfBx5iwfMqxh10mn5YGWP7QGNs e X-Received: by 2002:a05:6a00:1382:b0:6ed:cd4c:cc1a with SMTP id d2e1a72fcca58-6f6d60300b2mr7251615b3a.8.1716480959466; Thu, 23 May 2024 09:15:59 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a9d9acsm24890255b3a.90.2024.05.23.09.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 09:15:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Bernhard Beschow , Pierrick Bouvier Subject: [PULL 5/5] accel/tcg: Init tb size and icount before plugin_gen_tb_end Date: Thu, 23 May 2024 09:15:53 -0700 Message-Id: <20240523161553.774673-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240523161553.774673-1-richard.henderson@linaro.org> References: <20240523161553.774673-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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 When passing disassembly data to plugin callbacks, translator_st_len relies on db->tb->size having been set. Fixes: 4c833c60e047 ("disas: Use translator_st to get disassembly data") Reported-by: Bernhard Beschow Signed-off-by: Richard Henderson Tested-by: Bernhard Beschow Reviewed-by: Pierrick Bouvier --- accel/tcg/translator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index c56967eecd..113edcffe3 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -214,14 +214,14 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, set_can_do_io(db, true); tcg_ctx->emit_before_op = NULL; + /* May be used by disas_log or plugin callbacks. */ + tb->size = db->pc_next - db->pc_first; + tb->icount = db->num_insns; + if (plugin_enabled) { plugin_gen_tb_end(cpu, db->num_insns); } - /* The disas_log hook may use these values rather than recompute. */ - tb->size = db->pc_next - db->pc_first; - tb->icount = db->num_insns; - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(db->pc_first)) { FILE *logfile = qemu_log_trylock();