From patchwork Thu Jan 16 16:02:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 857919 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp281907wrb; Thu, 16 Jan 2025 08:14:30 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWfDvlxS9/rHYxMcUsP/W0YuEqoih5ePrr6dXoaXrZcuqz+NQppe3gftYPaZ9VePitJd+/gaw==@linaro.org X-Google-Smtp-Source: AGHT+IHl3HM3ovFDJtKPw+wC3N3aUFX0zKVHHly5WIclRH02JgYhqwHjO2f0joKBfJWZhw7R750O X-Received: by 2002:a05:6214:8111:b0:6e1:7223:19a9 with SMTP id 6a1803df08f44-6e172231a99mr203815646d6.24.1737044070123; Thu, 16 Jan 2025 08:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737044070; cv=none; d=google.com; s=arc-20240605; b=h2HQLkhEGMk9Jv1lDc1PNr4Vr6HvfjVHSgzrpyeTRv/0LUbEYNVGqOSFJ6Rw2pWGqz kdMDeZ2KkfgU0byOl58clMck//0zGo3sd03w1mCye9UwbNCMOWtgHILPVrWelqBrK7dx PkA7MZUjlJxnw1ccjHlpS8EKvvX0GgDPFmJrZOYYtCvZ5SKuqkYqVu01aI+gEiPE1URA EJ2hGVMyO1n+Omr5o0W6LnqLc9ScmHyaauj4eHtfKmBNRMwq3lhUBgZ0CT9h8NlKDp1P TZAUwrZUeXv+YR5Jgj/Uf6ol6lGR/qpu7SlBvxb/k5u0iFVakcIP98SzGxDw88ehrYpF e4YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=1tw2ZvpgzU+NWUchIsRD68y5QyIwwYntbgovoaeHxtY=; fh=LWJxUxOPIoAG7kV40OipmNLMiNyFM+gQ1dWz4vBqJQ4=; b=fyJ+MtOU9aKVjyMfJZhRU7RmOFomvauHcjazQkEa4kr419PQn1CNIMtAp8B8pxOnJD JuNCsOjuy3Be35GOvHaIML8Oul93NyKM/a0MUhMJKDxBa/KwhGdWAcYCG7mhKOpAwRkg yqhJaVMOJXu8VlNfo9uLBVDXOV4tHD9Ogj9LeD2g1J9rAFcF4Kk46ozjusYY4y27s1bG odBFHxJ2T3f3KL7FM7xnKUYv4A2SURkWwBZ32N+zit3HMGFru8lTSIUGKafOckL5FRY8 4kOK0I4Y1BAJy8wDbHncg5iVvaD9g+FP8GO9AfRZusLYMKe5PYZP94xY7lZNO3PplVir Ee9g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U1jwbgSF; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e1afbfabd0si2869516d6.78.2025.01.16.08.14.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Jan 2025 08:14:30 -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=U1jwbgSF; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYSVV-0008My-05; Thu, 16 Jan 2025 11:14:09 -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 1tYSTo-0003jN-MV for qemu-devel@nongnu.org; Thu, 16 Jan 2025 11:12:31 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYSTg-0004UL-VV for qemu-devel@nongnu.org; Thu, 16 Jan 2025 11:12:22 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-38a8b35e168so820535f8f.1 for ; Thu, 16 Jan 2025 08:12:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737043935; x=1737648735; 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=U1jwbgSFYG60UK647y5+aYgFM18NZo8PYqwI5LflpqOLe/nEsIxiuZN3zPnC1AcnE/ Vk/cXKmYUdFMiNSedUvfTKGsjuC0mJNa8q45xza7fmbGtadjknlfFenniAoguWDOai3J Xq8cZpKbdY/yZIAYaaXpDrG9Sxhh7mxN0/0ZYEomL3glgom/u0xbgmCcZXFj5M1HKRQ3 lJvIdYygri2q/mwX64+xU6TcqxofE7wmd4vaObLqUGwuKi8DOAq4ahd1hGX/0L9W8hre azAa8qvnFVVSqYQOdJBGa5u6xzfbaOCfaaO2f0+LbSN8qL9ODXDQLLW3RZn3opTc4Unj qjpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737043935; x=1737648735; 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=k0R+gIXQ84ZxABvy+gsCmpWSjeH1ZXKLlaozsq2jgEdbMTTF1/AdZw0lWqCzQTny1m NCZRGeZogNWcAUIULz7aTM0+bbAVcXtwkz8+DbJMrNJoDfFfnbW53Q1x7VLGy3tw4uLK mRqCok72sKqTzrC0H4zvXx9uIUGWz1sRM10rLQ4TVj1qJAaAkdOTSfr+NnPjhR7H+wmU l6nQUWJH5jCt7bhqA7aRN4YmlsB6peCyZ/c0UgHHGbxOq1HzhMRXrK9wDoqYwDOy00qJ z5gxgsUz1yQfWsomfIpEeSD5LTHHunQ0sm8tYDacMGkMtHSkZm+ePSPGSNHl3f2GsIUQ iKLg== X-Gm-Message-State: AOJu0Yxa0Rxx4N8wYxgscAYlKSwMQI+K16+iGIjR8SLs/gylfY+kNPBU +DFUNGx9kEaf9CZy0+mVNM2Y7qsuLOq8oCEFcqTMEQ6yUGl5C+s/InsbmhzgH9w= X-Gm-Gg: ASbGncv9YNi1INOyE3SG2V7Rfoh6iUtRHCPtCfs3VBNZnrdHtkf5BfeDzSP9edSTSt3 VdqIILYdXm3MnQmGpkMjkEFL9JbjJEf6ck4oO7wbkR6TpeS0bkw1FTm4KRl/vX8fVkKh/Lbm5F7 OuWVNTu0qTfOrpD+PYisduErQE5h6tBlfI41FB3KHFEasWhO1VY10LN7aGQ/E5R7YmZ4co7r9T1 I4C5tygW8pK1vtUer8JqhgGwxMsUsPu5/DGDYmVAxc8c6h2EGa7dbA= X-Received: by 2002:a05:6000:18ad:b0:38a:6183:77b9 with SMTP id ffacd0b85a97d-38bec4eecb3mr2742753f8f.6.1737043934873; Thu, 16 Jan 2025 08:12:14 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf321508esm248143f8f.10.2025.01.16.08.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 08:12:11 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 359786082D; Thu, 16 Jan 2025 16:03:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Markus Armbruster , Yuri Benditovich , Jason Wang , Cleber Rosa , "Dr. David Alan Gilbert" , Peter Xu , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Weil , Stefano Garzarella , qemu-arm@nongnu.org, Michael Roth , Laurent Vivier , Mahmoud Mandour , Andrew Melnychenko , Konstantin Kostiuk , Kyle Evans , Richard Henderson , =?utf-8?q?Marc-Andr=C3=A9?= =?utf-8?q?_Lureau?= , John Snow , David Hildenbrand , Fabiano Rosas , Alexandre Iooss , Eric Blake , =?utf-8?q?Alex_Benn=C3=A9e?= , Vladimir Sementsov-Ogievskiy , Pierrick Bouvier , Kevin Wolf , Peter Maydell , Laurent Vivier , "Michael S. Tsirkin" , Thomas Huth , Warner Losh , =?utf-8?q?Dan?= =?utf-8?q?iel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 18/37] contrib/plugins/cflow: fix 32-bit build Date: Thu, 16 Jan 2025 16:02:47 +0000 Message-Id: <20250116160306.1709518-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250116160306.1709518-1-alex.bennee@linaro.org> References: <20250116160306.1709518-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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=unavailable 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 From: Pierrick Bouvier Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20241217224306.2900490-9-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée --- 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 { /* 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; /* 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 = g_hash_table_new(NULL, g_direct_equal); + nodes = g_hash_table_new(g_int64_hash, g_int64_equal); state = qemu_plugin_scoreboard_new(sizeof(VCPUScoreBoard)); /* score board declarations */ + tb_pc = qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoard, tb_pc); end_block = qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoard, end_block); pc_after_block = qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoard, @@ -215,10 +219,10 @@ static NodeData *fetch_node(uint64_t addr, bool create_if_not_found) NodeData *node = NULL; g_mutex_lock(&node_lock); - node = (NodeData *) g_hash_table_lookup(nodes, (gconstpointer) addr); + node = (NodeData *) g_hash_table_lookup(nodes, &addr); if (!node && create_if_not_found) { node = 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_index, void *udata) uint64_t lpc = qemu_plugin_u64_get(last_pc, cpu_index); uint64_t ebpc = qemu_plugin_u64_get(end_block, cpu_index); uint64_t npc = qemu_plugin_u64_get(pc_after_block, cpu_index); - uint64_t pc = GPOINTER_TO_UINT(udata); + uint64_t pc = qemu_plugin_u64_get(tb_pc, cpu_index); /* 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 = 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); /* * Now we can set start/end for this block so the next block can