From nobody Sat May 10 04:38:16 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1736442851; cv=none; d=zohomail.com; s=zohoarc; b=VwYtQ0wd5kHoGJ5hgpEg5ZgWBVfn5vEXM9GRH2IQg+ipKOyXwcEwmmb/FzzIpXy5Lgv5cVeN0cXY1PGp2Z1WcMmK0TOfBQM0SzXbh3a55m37OyKKA4vhfPfZQBmSH1ALNkTX7/yu2C46iQjtvtY7ZoNG/ps6tk9t5KDYl3MqICc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1736442851; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1tw2ZvpgzU+NWUchIsRD68y5QyIwwYntbgovoaeHxtY=; b=cLf4YLPHwn9iKT3CFrKUVVAc08HtgTgZ2ppsdasmIq5/MBS3Hl5eOd1TRAM1WTISqHFrcEjEhq9SXxNdpI1JxThe3YIGlibgXpPgunSXdXxT1VHaLRCdhIViynzAqtbNKWEIN1U+MYexM7AzpcqUhUpXyQEHMftZUIFaTcyHh/o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from=<alex.bennee@linaro.org> (p=none dis=none) Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1736442851736281.81532445577045; Thu, 9 Jan 2025 09:14:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1tVw62-0007PG-JM; Thu, 09 Jan 2025 12:13:26 -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 <alex.bennee@linaro.org>) id 1tVw60-0007OR-5E for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:13:24 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>) id 1tVw5y-0007uv-GA for qemu-devel@nongnu.org; Thu, 09 Jan 2025 12:13:23 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5d3d143376dso1485586a12.3 for <qemu-devel@nongnu.org>; Thu, 09 Jan 2025 09:13:22 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d9900c4326sm762431a12.23.2025.01.09.09.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 09:13:19 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7F9F4609B6; Thu, 9 Jan 2025 17:06:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736442801; x=1737047601; 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=1tw2ZvpgzU+NWUchIsRD68y5QyIwwYntbgovoaeHxtY=; b=iLe928aq5pk/9aboFFlMCs+N7VYpc8creQ/fAGp7gPYwm23II7r8jbOweSvGMxOsTb oUJydqVwm5vzNAAJtJh06i9YVXM5IJF29CEeN3HJpMP/K7ROvGQzEOLwf4NGbkI91f2O RPjCTXdBv99XX6Krkg2uPc2UNRExQ9HMxc1gUioWhwTK1GMyqyuSh2I4bNIl342GUEvP viPZ0UbfqmlJxXfk24PLnM4nb5jXYrKJFUuVx8gb0/1oUoabbCxJrZkq40ISDfTo7p15 zQkhsfLjugbKe6T+qjlJs+IZvib87LNLvU1qxxf15JTXSXCbeQvX9u7lwM6Z31IgddBa jNvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736442801; x=1737047601; 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=1tw2ZvpgzU+NWUchIsRD68y5QyIwwYntbgovoaeHxtY=; b=IPUCrbUTYPy87uBp/FNwU7Eu7RKzMlHvYeWkxtm7JjeaaRB1ij0kcl+yXUV34Eqf+j TLvUceEQF9KTDgOkRicrHlREX3JGM2sPDJEwMgOj1P8/mejW9k334G05HvBHQBbPKmg9 u8HuInKYY0I7tccMGtL4MjteTxc3foFDPoOdbKemDTvvDb0UHhNtm2zLfvGm3Tj0OgG7 xmbp5UEfhnJeYbHsLTdQAHXYQtbdhAtu6aqwRTAflqyrQt7UJ0ukCQRuWxY/vkoyW9xD KSfHTFz+rEn6c+++ASwzfHwOzujoC+F+VydwbfR9uMU+fH+aLK7stBaCqUUE9dKPMktt ijNw== X-Gm-Message-State: AOJu0YwzEWlTo4EfGH2/uYqOYC3RP/hWdNl0Ua/I+z8s+tqq8BU2Zkdz SmD1D8xDCn7t2UozzVaRyu1V06HaTQvaAuCRzV7WNLUVYzI/uxcz/IFIJXRRkGg= X-Gm-Gg: ASbGncsKsX22ze5fEt/yUPAZCE+7ME8hLRj4eFkhXDs93DKcnvZOXH7GOteaEkx8jc4 4mnKIwRa3O/uvNkaOo/W4YTMqEA+ExEkKfuq5XT5JtO+JTBKmm3qcCkf5nlDWt+9zUyl/38rTPq AxyhRCKa2tqOPFf19A8hgifCyK/fI7USghYgZ84Eu4bAzO6Jqpt+wyRyD0aE4Cadj805knXrkkS t8XD8QVhL7cZ2k1uuaDGvqxF/iF4Z7h7cyXOZ9GDimc83qirTYGFjs= X-Google-Smtp-Source: AGHT+IHlLMwAnejvich4wZpY9B/qevFpJ/e16g57WvcRb5Uf3g7t72eUw9TRCufDywPQxpDRZ1VZiQ== X-Received: by 2002:a05:6402:348d:b0:5d9:6a8b:468f with SMTP id 4fb4d7f45d1cf-5d972e6d1b4mr7574774a12.28.1736442800730; Thu, 09 Jan 2025 09:13:20 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org> To: qemu-devel@nongnu.org Cc: "Dr. David Alan Gilbert" <dave@treblig.org>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Mahmoud Mandour <ma.mandourr@gmail.com>, Alexandre Iooss <erdnaxe@crans.org>, Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <laurent@vivier.eu>, =?UTF-8?q?Alex=20Benn=C3=A9e?= <alex.bennee@linaro.org> Subject: [PATCH 18/22] contrib/plugins/cflow: fix 32-bit build Date: Thu, 9 Jan 2025 17:06:15 +0000 Message-Id: <20250109170619.2271193-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250109170619.2271193-1-alex.bennee@linaro.org> References: <20250109170619.2271193-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::531; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1736442853917116600 From: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20241217224306.2900490-9-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e <alex.bennee@linaro.org> --- contrib/plugins/cflow.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/contrib/plugins/cflow.c b/contrib/plugins/cflow.c index b39974d1cf..930ecb46fc 100644 --- a/contrib/plugins/cflow.c +++ b/contrib/plugins/cflow.c @@ -76,6 +76,8 @@ typedef struct { =20 /* We use this to track the current execution state */ typedef struct { + /* address of current translated block */ + uint64_t tb_pc; /* address of end of block */ uint64_t end_block; /* next pc after end of block */ @@ -85,6 +87,7 @@ typedef struct { } VCPUScoreBoard; =20 /* descriptors for accessing the above scoreboard */ +static qemu_plugin_u64 tb_pc; static qemu_plugin_u64 end_block; static qemu_plugin_u64 pc_after_block; static qemu_plugin_u64 last_pc; @@ -189,10 +192,11 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) static void plugin_init(void) { g_mutex_init(&node_lock); - nodes =3D g_hash_table_new(NULL, g_direct_equal); + nodes =3D g_hash_table_new(g_int64_hash, g_int64_equal); state =3D qemu_plugin_scoreboard_new(sizeof(VCPUScoreBoard)); =20 /* score board declarations */ + tb_pc =3D qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoard, = tb_pc); end_block =3D qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoa= rd, end_block); pc_after_block =3D qemu_plugin_scoreboard_u64_in_struct(state, VCPUSco= reBoard, @@ -215,10 +219,10 @@ static NodeData *fetch_node(uint64_t addr, bool creat= e_if_not_found) NodeData *node =3D NULL; =20 g_mutex_lock(&node_lock); - node =3D (NodeData *) g_hash_table_lookup(nodes, (gconstpointer) addr); + node =3D (NodeData *) g_hash_table_lookup(nodes, &addr); if (!node && create_if_not_found) { node =3D create_node(addr); - g_hash_table_insert(nodes, (gpointer) addr, (gpointer) node); + g_hash_table_insert(nodes, &node->addr, node); } g_mutex_unlock(&node_lock); return node; @@ -234,7 +238,7 @@ static void vcpu_tb_branched_exec(unsigned int cpu_inde= x, void *udata) uint64_t lpc =3D qemu_plugin_u64_get(last_pc, cpu_index); uint64_t ebpc =3D qemu_plugin_u64_get(end_block, cpu_index); uint64_t npc =3D qemu_plugin_u64_get(pc_after_block, cpu_index); - uint64_t pc =3D GPOINTER_TO_UINT(udata); + uint64_t pc =3D qemu_plugin_u64_get(tb_pc, cpu_index); =20 /* return early for address 0 */ if (!lpc) { @@ -305,10 +309,11 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct= qemu_plugin_tb *tb) * handle both early block exits and normal branches in the * callback if we hit it. */ - gpointer udata =3D GUINT_TO_POINTER(pc); + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_STORE_U64, tb_pc, pc); qemu_plugin_register_vcpu_tb_exec_cond_cb( tb, vcpu_tb_branched_exec, QEMU_PLUGIN_CB_NO_REGS, - QEMU_PLUGIN_COND_NE, pc_after_block, pc, udata); + QEMU_PLUGIN_COND_NE, pc_after_block, pc, NULL); =20 /* * Now we can set start/end for this block so the next block can --=20 2.39.5