diff mbox series

[12/13] contrib/plugins/hotpages: fix 32-bit build

Message ID 20241217010707.2557258-13-pierrick.bouvier@linaro.org
State Superseded
Headers show
Series Fix 32-bit build for plugins | expand

Commit Message

Pierrick Bouvier Dec. 17, 2024, 1:07 a.m. UTC
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 contrib/plugins/hotpages.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Richard Henderson Dec. 17, 2024, 3:37 p.m. UTC | #1
On 12/16/24 19:07, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   contrib/plugins/hotpages.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

> 
> diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c
> index 8316ae50c72..c6e64937194 100644
> --- a/contrib/plugins/hotpages.c
> +++ b/contrib/plugins/hotpages.c
> @@ -103,7 +103,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
>   static void plugin_init(void)
>   {
>       page_mask = (page_size - 1);
> -    pages = g_hash_table_new(NULL, g_direct_equal);
> +    pages = g_hash_table_new(g_int64_hash, g_int64_equal);
>   }
>   
>   static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo,
> @@ -130,12 +130,12 @@ static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo,
>       page &= ~page_mask;
>   
>       g_mutex_lock(&lock);
> -    count = (PageCounters *) g_hash_table_lookup(pages, GUINT_TO_POINTER(page));
> +    count = (PageCounters *) g_hash_table_lookup(pages, &page);
>   
>       if (!count) {
>           count = g_new0(PageCounters, 1);
>           count->page_address = page;
> -        g_hash_table_insert(pages, GUINT_TO_POINTER(page), (gpointer) count);
> +        g_hash_table_insert(pages, &count->page_address, count);
>       }
>       if (qemu_plugin_mem_is_store(meminfo)) {
>           count->writes++;
diff mbox series

Patch

diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c
index 8316ae50c72..c6e64937194 100644
--- a/contrib/plugins/hotpages.c
+++ b/contrib/plugins/hotpages.c
@@ -103,7 +103,7 @@  static void plugin_exit(qemu_plugin_id_t id, void *p)
 static void plugin_init(void)
 {
     page_mask = (page_size - 1);
-    pages = g_hash_table_new(NULL, g_direct_equal);
+    pages = g_hash_table_new(g_int64_hash, g_int64_equal);
 }
 
 static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo,
@@ -130,12 +130,12 @@  static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo,
     page &= ~page_mask;
 
     g_mutex_lock(&lock);
-    count = (PageCounters *) g_hash_table_lookup(pages, GUINT_TO_POINTER(page));
+    count = (PageCounters *) g_hash_table_lookup(pages, &page);
 
     if (!count) {
         count = g_new0(PageCounters, 1);
         count->page_address = page;
-        g_hash_table_insert(pages, GUINT_TO_POINTER(page), (gpointer) count);
+        g_hash_table_insert(pages, &count->page_address, count);
     }
     if (qemu_plugin_mem_is_store(meminfo)) {
         count->writes++;