* [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V
@ 2020-07-30 13:05 Bruce Rogers
2020-07-30 13:25 ` David Hildenbrand
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bruce Rogers @ 2020-07-30 13:05 UTC (permalink / raw)
To: qemu-devel, sgarzare; +Cc: Bruce Rogers, david
This likely affects other, less popular host architectures as well.
Less common host architectures under linux get QEMU_VMALLOC_ALIGN (from
which VIRTIO_MEM_MIN_BLOCK_SIZE is derived) define to a variable of
type uintptr, which isn't compatible with the format specifier used to
print a user message. Since this particular usage of the underlying data
seems unique to this file, the simple fix is to just cast
QEMU_VMALLOC_ALIGN to uint32_t, which corresponds to the format specifier
used.
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/virtio/virtio-mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
index c12e9f79b0..7740fc613f 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
@@ -36,7 +36,7 @@
* Use QEMU_VMALLOC_ALIGN, so no THP will have to be split when unplugging
* memory (e.g., 2MB on x86_64).
*/
-#define VIRTIO_MEM_MIN_BLOCK_SIZE QEMU_VMALLOC_ALIGN
+#define VIRTIO_MEM_MIN_BLOCK_SIZE ((uint32_t)QEMU_VMALLOC_ALIGN)
/*
* Size the usable region bigger than the requested size if possible. Esp.
* Linux guests will only add (aligned) memory blocks in case they fully
--
2.27.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V
2020-07-30 13:05 [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V Bruce Rogers
@ 2020-07-30 13:25 ` David Hildenbrand
2020-07-30 13:28 ` Stefano Garzarella
2020-07-30 14:13 ` Pankaj Gupta
2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2020-07-30 13:25 UTC (permalink / raw)
To: Bruce Rogers, qemu-devel, sgarzare
On 30.07.20 15:05, Bruce Rogers wrote:
> This likely affects other, less popular host architectures as well.
> Less common host architectures under linux get QEMU_VMALLOC_ALIGN (from
> which VIRTIO_MEM_MIN_BLOCK_SIZE is derived) define to a variable of
> type uintptr, which isn't compatible with the format specifier used to
> print a user message. Since this particular usage of the underlying data
> seems unique to this file, the simple fix is to just cast
> QEMU_VMALLOC_ALIGN to uint32_t, which corresponds to the format specifier
> used.
>
> Signed-off-by: Bruce Rogers <brogers@suse.com>
> ---
> hw/virtio/virtio-mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
> index c12e9f79b0..7740fc613f 100644
> --- a/hw/virtio/virtio-mem.c
> +++ b/hw/virtio/virtio-mem.c
> @@ -36,7 +36,7 @@
> * Use QEMU_VMALLOC_ALIGN, so no THP will have to be split when unplugging
> * memory (e.g., 2MB on x86_64).
> */
> -#define VIRTIO_MEM_MIN_BLOCK_SIZE QEMU_VMALLOC_ALIGN
> +#define VIRTIO_MEM_MIN_BLOCK_SIZE ((uint32_t)QEMU_VMALLOC_ALIGN)
> /*
> * Size the usable region bigger than the requested size if possible. Esp.
> * Linux guests will only add (aligned) memory blocks in case they fully
>
We should probably force that to always at least 1MB or so ... other
discussion :)
Thanks (compile-tested on x86-64)!
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V
2020-07-30 13:05 [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V Bruce Rogers
2020-07-30 13:25 ` David Hildenbrand
@ 2020-07-30 13:28 ` Stefano Garzarella
2020-07-30 14:13 ` Pankaj Gupta
2 siblings, 0 replies; 4+ messages in thread
From: Stefano Garzarella @ 2020-07-30 13:28 UTC (permalink / raw)
To: Bruce Rogers; +Cc: qemu-devel, david
On Thu, Jul 30, 2020 at 07:05:19AM -0600, Bruce Rogers wrote:
> This likely affects other, less popular host architectures as well.
> Less common host architectures under linux get QEMU_VMALLOC_ALIGN (from
> which VIRTIO_MEM_MIN_BLOCK_SIZE is derived) define to a variable of
> type uintptr, which isn't compatible with the format specifier used to
> print a user message. Since this particular usage of the underlying data
> seems unique to this file, the simple fix is to just cast
> QEMU_VMALLOC_ALIGN to uint32_t, which corresponds to the format specifier
> used.
>
> Signed-off-by: Bruce Rogers <brogers@suse.com>
> ---
> hw/virtio/virtio-mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
> index c12e9f79b0..7740fc613f 100644
> --- a/hw/virtio/virtio-mem.c
> +++ b/hw/virtio/virtio-mem.c
> @@ -36,7 +36,7 @@
> * Use QEMU_VMALLOC_ALIGN, so no THP will have to be split when unplugging
> * memory (e.g., 2MB on x86_64).
> */
> -#define VIRTIO_MEM_MIN_BLOCK_SIZE QEMU_VMALLOC_ALIGN
> +#define VIRTIO_MEM_MIN_BLOCK_SIZE ((uint32_t)QEMU_VMALLOC_ALIGN)
> /*
> * Size the usable region bigger than the requested size if possible. Esp.
> * Linux guests will only add (aligned) memory blocks in case they fully
> --
> 2.27.0
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Thanks,
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V
2020-07-30 13:05 [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V Bruce Rogers
2020-07-30 13:25 ` David Hildenbrand
2020-07-30 13:28 ` Stefano Garzarella
@ 2020-07-30 14:13 ` Pankaj Gupta
2 siblings, 0 replies; 4+ messages in thread
From: Pankaj Gupta @ 2020-07-30 14:13 UTC (permalink / raw)
To: Bruce Rogers; +Cc: David Hildenbrand, qemu-devel, sgarzare
> This likely affects other, less popular host architectures as well.
> Less common host architectures under linux get QEMU_VMALLOC_ALIGN (from
> which VIRTIO_MEM_MIN_BLOCK_SIZE is derived) define to a variable of
> type uintptr, which isn't compatible with the format specifier used to
> print a user message. Since this particular usage of the underlying data
> seems unique to this file, the simple fix is to just cast
> QEMU_VMALLOC_ALIGN to uint32_t, which corresponds to the format specifier
> used.
>
> Signed-off-by: Bruce Rogers <brogers@suse.com>
> ---
> hw/virtio/virtio-mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
> index c12e9f79b0..7740fc613f 100644
> --- a/hw/virtio/virtio-mem.c
> +++ b/hw/virtio/virtio-mem.c
> @@ -36,7 +36,7 @@
> * Use QEMU_VMALLOC_ALIGN, so no THP will have to be split when unplugging
> * memory (e.g., 2MB on x86_64).
> */
> -#define VIRTIO_MEM_MIN_BLOCK_SIZE QEMU_VMALLOC_ALIGN
> +#define VIRTIO_MEM_MIN_BLOCK_SIZE ((uint32_t)QEMU_VMALLOC_ALIGN)
> /*
> * Size the usable region bigger than the requested size if possible. Esp.
> * Linux guests will only add (aligned) memory blocks in case they fully
Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-30 14:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 13:05 [PATCH] virtio-mem: Correct format specifier mismatch for RISC-V Bruce Rogers
2020-07-30 13:25 ` David Hildenbrand
2020-07-30 13:28 ` Stefano Garzarella
2020-07-30 14:13 ` Pankaj Gupta
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).