From: "Alex Bennée" <alex.bennee@linaro.org>
To: Thomas Huth <thuth@redhat.com>
Cc: "Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH 3/6] contrib/plugins/hwprofile: fix warning when compiling on 32bits host
Date: Thu, 15 Aug 2024 13:03:53 +0100 [thread overview]
Message-ID: <87plqa2dsm.fsf@draig.linaro.org> (raw)
In-Reply-To: <353d0b10-8a7a-4660-a22c-f3dcb35df89e@redhat.com> (Thomas Huth's message of "Thu, 15 Aug 2024 10:13:32 +0200")
Thomas Huth <thuth@redhat.com> writes:
> On 15/08/2024 01.36, Pierrick Bouvier wrote:
>> Found on debian stable (i386).
>> ../contrib/plugins/hwprofile.c: In function 'new_location':
>> ../contrib/plugins/hwprofile.c:172:32: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> 172 | g_hash_table_insert(table, (gpointer) off_or_pc, loc);
>> | ^
>> ../contrib/plugins/hwprofile.c: In function 'vcpu_haddr':
>> ../contrib/plugins/hwprofile.c:227:19: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>> 227 | off = (uint64_t) udata;
>> | ^
>> ../contrib/plugins/hwprofile.c:232:62: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> 232 | (gpointer) off);
>> | ^
>> ../contrib/plugins/hwprofile.c: In function 'vcpu_tb_trans':
>> ../contrib/plugins/hwprofile.c:250:26: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>> 250 | gpointer udata = (gpointer) (source ? qemu_plugin_insn_vaddr(insn) : 0);
>> |
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> contrib/plugins/hwprofile.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>> diff --git a/contrib/plugins/hwprofile.c
>> b/contrib/plugins/hwprofile.c
>> index 739ac0c66b5..ee94a74ad94 100644
>> --- a/contrib/plugins/hwprofile.c
>> +++ b/contrib/plugins/hwprofile.c
>> @@ -165,7 +165,7 @@ static DeviceCounts *new_count(const char *name, uint64_t base)
>> return count;
>> }
>> -static IOLocationCounts *new_location(GHashTable *table, uint64_t
>> off_or_pc)
>> +static IOLocationCounts *new_location(GHashTable *table, uintptr_t off_or_pc)
>> {
>> IOLocationCounts *loc = g_new0(IOLocationCounts, 1);
>> loc->off_or_pc = off_or_pc;
>> @@ -201,7 +201,7 @@ static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo,
>> return;
>> } else {
>> const char *name = qemu_plugin_hwaddr_device_name(hwaddr);
>> - uint64_t off = qemu_plugin_hwaddr_phys_addr(hwaddr);
>> + uintptr_t off = qemu_plugin_hwaddr_phys_addr(hwaddr);
>
> qemu_plugin_hwaddr_phys_addr() returns an uint64_t, so this looks
> wrong to me.
It is. However it just goes to show you should be expecting to
instrument 64 bit code with a 32 bit host because you can't do pointer
stuffing tricks like this.
Maybe we could just disable plugins on 32 bit hosts?
>
> Thomas
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-08-15 12:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-14 23:36 [PATCH 0/6] build contrib/plugins using meson Pierrick Bouvier
2024-08-14 23:36 ` [PATCH 1/6] contrib/plugins/execlog: fix warning Pierrick Bouvier
2024-08-15 8:06 ` Thomas Huth
2024-08-17 6:47 ` Alexandre IOOSS
2024-08-14 23:36 ` [PATCH 2/6] contrib/plugins/cache: fix warning when compiling on 32bits host Pierrick Bouvier
2024-08-15 8:11 ` Thomas Huth
2024-08-15 11:46 ` Alex Bennée
2024-08-15 17:38 ` Pierrick Bouvier
2024-08-16 2:16 ` Pierrick Bouvier
2024-08-16 12:49 ` Alex Bennée
2024-08-15 22:23 ` Richard Henderson
2024-08-16 12:47 ` Alex Bennée
2024-08-16 14:17 ` Peter Maydell
2024-08-16 21:58 ` Richard Henderson
2024-08-14 23:36 ` [PATCH 3/6] contrib/plugins/hwprofile: " Pierrick Bouvier
2024-08-15 8:13 ` Thomas Huth
2024-08-15 12:03 ` Alex Bennée [this message]
2024-08-15 17:40 ` Pierrick Bouvier
2024-08-16 4:50 ` Pierrick Bouvier
2024-08-14 23:36 ` [PATCH 4/6] contrib/plugins/hotblocks: " Pierrick Bouvier
2024-08-15 8:14 ` Thomas Huth
2024-08-14 23:36 ` [PATCH 5/6] meson: build contrib/plugins with meson Pierrick Bouvier
2024-08-14 23:36 ` [PATCH 6/6] contrib/plugins: remove Makefile for contrib/plugins Pierrick Bouvier
2024-08-15 6:00 ` [PATCH 0/6] build contrib/plugins using meson Paolo Bonzini
2024-08-15 11:42 ` Alex Bennée
2024-08-15 17:42 ` Pierrick Bouvier
2024-08-15 18:04 ` Pierrick Bouvier
2024-08-15 18:37 ` Paolo Bonzini
2024-08-15 19:14 ` Peter Maydell
2024-08-16 6:50 ` Philippe Mathieu-Daudé
2024-08-16 18:44 ` Pierrick Bouvier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87plqa2dsm.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=erdnaxe@crans.org \
--cc=ma.mandourr@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).