* [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t @ 2020-07-30 14:12 Philippe Mathieu-Daudé 2020-07-30 14:12 ` [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long Philippe Mathieu-Daudé ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Philippe Mathieu-Daudé @ 2020-07-30 14:12 UTC (permalink / raw) To: qemu-devel Cc: Kevin Wolf, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, Dr. David Alan Gilbert, Max Reitz, qemu-ppc, David Gibson, Paolo Bonzini, Stefano Garzarella, Philippe Mathieu-Daudé, Richard Henderson Since v1: Make QEMU_VMALLOC_ALIGN unsigned in a previous patch Philippe Mathieu-Daudé (2): qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long util/pagesize: Make qemu_real_host_page_size of type size_t include/exec/ram_addr.h | 4 ++-- include/qemu/osdep.h | 6 +++--- accel/kvm/kvm-all.c | 3 ++- block/qcow2-cache.c | 2 +- exec.c | 8 ++++---- hw/ppc/spapr_pci.c | 2 +- hw/virtio/virtio-mem.c | 2 +- migration/migration.c | 2 +- migration/postcopy-ram.c | 2 +- monitor/misc.c | 2 +- util/pagesize.c | 2 +- 11 files changed, 18 insertions(+), 17 deletions(-) -- 2.21.3 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long 2020-07-30 14:12 [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé @ 2020-07-30 14:12 ` Philippe Mathieu-Daudé 2020-07-31 0:09 ` David Gibson 2020-07-30 14:12 ` [PATCH-for-5.1? v2 2/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé 2020-07-30 14:22 ` [PATCH-for-5.1? v2 0/2] " Dr. David Alan Gilbert 2 siblings, 1 reply; 7+ messages in thread From: Philippe Mathieu-Daudé @ 2020-07-30 14:12 UTC (permalink / raw) To: qemu-devel Cc: Kevin Wolf, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, Dr. David Alan Gilbert, Max Reitz, qemu-ppc, David Gibson, Paolo Bonzini, Stefano Garzarella, Philippe Mathieu-Daudé, Richard Henderson QEMU_VMALLOC_ALIGN is sometimes expanded to signed type, other times to unsigned. Unify using unsigned. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- include/qemu/osdep.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 20872e793e..085df8d508 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -454,10 +454,10 @@ void qemu_anon_ram_free(void *ptr, size_t size); /* Use 2 MiB alignment so transparent hugepages can be used by KVM. Valgrind does not support alignments larger than 1 MiB, therefore we need special code which handles running on Valgrind. */ -# define QEMU_VMALLOC_ALIGN (512 * 4096) +# define QEMU_VMALLOC_ALIGN (512 * 4096UL) #elif defined(__linux__) && defined(__s390x__) /* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */ -# define QEMU_VMALLOC_ALIGN (256 * 4096) +# define QEMU_VMALLOC_ALIGN (256 * 4096UL) #elif defined(__linux__) && defined(__sparc__) #include <sys/shm.h> # define QEMU_VMALLOC_ALIGN MAX(qemu_real_host_page_size, SHMLBA) -- 2.21.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long 2020-07-30 14:12 ` [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long Philippe Mathieu-Daudé @ 2020-07-31 0:09 ` David Gibson 0 siblings, 0 replies; 7+ messages in thread From: David Gibson @ 2020-07-31 0:09 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Kevin Wolf, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, qemu-devel, Max Reitz, qemu-ppc, Paolo Bonzini, Richard Henderson, Dr. David Alan Gilbert, Stefano Garzarella [-- Attachment #1: Type: text/plain, Size: 1517 bytes --] On Thu, Jul 30, 2020 at 04:12:44PM +0200, Philippe Mathieu-Daudé wrote: > QEMU_VMALLOC_ALIGN is sometimes expanded to signed type, > other times to unsigned. Unify using unsigned. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > include/qemu/osdep.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h > index 20872e793e..085df8d508 100644 > --- a/include/qemu/osdep.h > +++ b/include/qemu/osdep.h > @@ -454,10 +454,10 @@ void qemu_anon_ram_free(void *ptr, size_t size); > /* Use 2 MiB alignment so transparent hugepages can be used by KVM. > Valgrind does not support alignments larger than 1 MiB, > therefore we need special code which handles running on Valgrind. */ > -# define QEMU_VMALLOC_ALIGN (512 * 4096) > +# define QEMU_VMALLOC_ALIGN (512 * 4096UL) > #elif defined(__linux__) && defined(__s390x__) > /* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */ > -# define QEMU_VMALLOC_ALIGN (256 * 4096) > +# define QEMU_VMALLOC_ALIGN (256 * 4096UL) > #elif defined(__linux__) && defined(__sparc__) > #include <sys/shm.h> > # define QEMU_VMALLOC_ALIGN MAX(qemu_real_host_page_size, SHMLBA) -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH-for-5.1? v2 2/2] util/pagesize: Make qemu_real_host_page_size of type size_t 2020-07-30 14:12 [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé 2020-07-30 14:12 ` [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long Philippe Mathieu-Daudé @ 2020-07-30 14:12 ` Philippe Mathieu-Daudé 2020-07-31 0:10 ` David Gibson 2020-07-30 14:22 ` [PATCH-for-5.1? v2 0/2] " Dr. David Alan Gilbert 2 siblings, 1 reply; 7+ messages in thread From: Philippe Mathieu-Daudé @ 2020-07-30 14:12 UTC (permalink / raw) To: qemu-devel Cc: Kevin Wolf, Bruce Rogers, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, Dr. David Alan Gilbert, Max Reitz, qemu-ppc, David Gibson, Paolo Bonzini, Stefano Garzarella, Philippe Mathieu-Daudé, Richard Henderson We use different types to hold 'qemu_real_host_page_size'. Unify picking 'size_t' which seems the best candidate. Doing so fix a format string issue in hw/virtio/virtio-mem.c reported when building with GCC 4.9.4: hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, ^ Fixes: 910b25766b ("virtio-mem: Paravirtualized memory hot(un)plug") Reported-by: Bruce Rogers <brogers@suse.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- include/exec/ram_addr.h | 4 ++-- include/qemu/osdep.h | 2 +- accel/kvm/kvm-all.c | 3 ++- block/qcow2-cache.c | 2 +- exec.c | 8 ++++---- hw/ppc/spapr_pci.c | 2 +- hw/virtio/virtio-mem.c | 2 +- migration/migration.c | 2 +- migration/postcopy-ram.c | 2 +- monitor/misc.c | 2 +- util/pagesize.c | 2 +- 11 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 3ef729a23c..e07532266e 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -93,8 +93,8 @@ static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr, bool ramblock_is_pmem(RAMBlock *rb); -long qemu_minrampagesize(void); -long qemu_maxrampagesize(void); +size_t qemu_minrampagesize(void); +size_t qemu_maxrampagesize(void); /** * qemu_ram_alloc_from_file, diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 085df8d508..77115a8270 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -635,10 +635,10 @@ char *qemu_get_pid_name(pid_t pid); */ pid_t qemu_fork(Error **errp); +extern size_t qemu_real_host_page_size; /* Using intptr_t ensures that qemu_*_page_mask is sign-extended even * when intptr_t is 32-bit and we are aligning a long long. */ -extern uintptr_t qemu_real_host_page_size; extern intptr_t qemu_real_host_page_mask; extern int qemu_icache_linesize; diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 63ef6af9a1..59becfbd6c 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -674,7 +674,8 @@ static int kvm_log_clear_one_slot(KVMSlot *mem, int as_id, uint64_t start, KVMState *s = kvm_state; uint64_t end, bmap_start, start_delta, bmap_npages; struct kvm_clear_dirty_log d; - unsigned long *bmap_clear = NULL, psize = qemu_real_host_page_size; + unsigned long *bmap_clear = NULL; + size_t psize = qemu_real_host_page_size; int ret; /* diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 7444b9c4ab..4ad9f5929f 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -74,7 +74,7 @@ static void qcow2_cache_table_release(Qcow2Cache *c, int i, int num_tables) /* Using MADV_DONTNEED to discard memory is a Linux-specific feature */ #ifdef CONFIG_LINUX void *t = qcow2_cache_get_table_addr(c, i); - int align = qemu_real_host_page_size; + size_t align = qemu_real_host_page_size; size_t mem_size = (size_t) c->table_size * num_tables; size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t; size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align); diff --git a/exec.c b/exec.c index 6f381f98e2..4b6d52e01f 100644 --- a/exec.c +++ b/exec.c @@ -1657,7 +1657,7 @@ static int find_max_backend_pagesize(Object *obj, void *opaque) * TODO: We assume right now that all mapped host memory backends are * used as RAM, however some might be used for different purposes. */ -long qemu_minrampagesize(void) +size_t qemu_minrampagesize(void) { long hpsize = LONG_MAX; Object *memdev_root = object_resolve_path("/objects", NULL); @@ -1666,7 +1666,7 @@ long qemu_minrampagesize(void) return hpsize; } -long qemu_maxrampagesize(void) +size_t qemu_maxrampagesize(void) { long pagesize = 0; Object *memdev_root = object_resolve_path("/objects", NULL); @@ -1675,11 +1675,11 @@ long qemu_maxrampagesize(void) return pagesize; } #else -long qemu_minrampagesize(void) +size_t qemu_minrampagesize(void) { return qemu_real_host_page_size; } -long qemu_maxrampagesize(void) +size_t qemu_maxrampagesize(void) { return qemu_real_host_page_size; } diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 363cdb3f7b..a9da84fe30 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1810,7 +1810,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) char *namebuf; int i; PCIBus *bus; - uint64_t msi_window_size = 4096; + size_t msi_window_size = 4096; SpaprTceTable *tcet; const unsigned windows_supported = spapr_phb_windows_supported(sphb); Error *local_err = NULL; diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index c12e9f79b0..34344cec39 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, } if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, + error_setg(errp, "'%s' property has to be at least 0x%zx", name, VIRTIO_MEM_MIN_BLOCK_SIZE); return; } else if (!is_power_of_2(value)) { diff --git a/migration/migration.c b/migration/migration.c index 8fe36339db..b8abbbeabb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2433,7 +2433,7 @@ static struct rp_cmd_args { static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname, ram_addr_t start, size_t len) { - long our_host_ps = qemu_real_host_page_size; + size_t our_host_ps = qemu_real_host_page_size; trace_migrate_handle_rp_req_pages(rbname, start, len); diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 1bb22f2b6c..f296efd612 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -345,7 +345,7 @@ static int test_ramblock_postcopiable(RAMBlock *rb, void *opaque) */ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) { - long pagesize = qemu_real_host_page_size; + size_t pagesize = qemu_real_host_page_size; int ufd = -1; bool ret = false; /* Error unless we change it */ void *testarea = NULL; diff --git a/monitor/misc.c b/monitor/misc.c index e847b58a8c..7970f4ff72 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -740,7 +740,7 @@ static uint64_t vtop(void *ptr, Error **errp) uint64_t pinfo; uint64_t ret = -1; uintptr_t addr = (uintptr_t) ptr; - uintptr_t pagesize = qemu_real_host_page_size; + size_t pagesize = qemu_real_host_page_size; off_t offset = addr / pagesize * sizeof(pinfo); int fd; diff --git a/util/pagesize.c b/util/pagesize.c index 998632cf6e..a08bf1717a 100644 --- a/util/pagesize.c +++ b/util/pagesize.c @@ -8,7 +8,7 @@ #include "qemu/osdep.h" -uintptr_t qemu_real_host_page_size; +size_t qemu_real_host_page_size; intptr_t qemu_real_host_page_mask; static void __attribute__((constructor)) init_real_host_page_size(void) -- 2.21.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH-for-5.1? v2 2/2] util/pagesize: Make qemu_real_host_page_size of type size_t 2020-07-30 14:12 ` [PATCH-for-5.1? v2 2/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé @ 2020-07-31 0:10 ` David Gibson 0 siblings, 0 replies; 7+ messages in thread From: David Gibson @ 2020-07-31 0:10 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Kevin Wolf, Bruce Rogers, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, qemu-devel, Max Reitz, qemu-ppc, Paolo Bonzini, Richard Henderson, Dr. David Alan Gilbert, Stefano Garzarella [-- Attachment #1: Type: text/plain, Size: 8279 bytes --] On Thu, Jul 30, 2020 at 04:12:45PM +0200, Philippe Mathieu-Daudé wrote: > We use different types to hold 'qemu_real_host_page_size'. > Unify picking 'size_t' which seems the best candidate. > > Doing so fix a format string issue in hw/virtio/virtio-mem.c > reported when building with GCC 4.9.4: > > hw/virtio/virtio-mem.c: In function ‘virtio_mem_set_block_size’: > hw/virtio/virtio-mem.c:756:9: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘uintptr_t’ [-Werror=format=] > error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, > ^ > > Fixes: 910b25766b ("virtio-mem: Paravirtualized memory hot(un)plug") > Reported-by: Bruce Rogers <brogers@suse.com> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> and ppc parts Acked-by: David Gibson <david@gibson.dropbear.id.au> > --- > include/exec/ram_addr.h | 4 ++-- > include/qemu/osdep.h | 2 +- > accel/kvm/kvm-all.c | 3 ++- > block/qcow2-cache.c | 2 +- > exec.c | 8 ++++---- > hw/ppc/spapr_pci.c | 2 +- > hw/virtio/virtio-mem.c | 2 +- > migration/migration.c | 2 +- > migration/postcopy-ram.c | 2 +- > monitor/misc.c | 2 +- > util/pagesize.c | 2 +- > 11 files changed, 16 insertions(+), 15 deletions(-) > > diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h > index 3ef729a23c..e07532266e 100644 > --- a/include/exec/ram_addr.h > +++ b/include/exec/ram_addr.h > @@ -93,8 +93,8 @@ static inline unsigned long int ramblock_recv_bitmap_offset(void *host_addr, > > bool ramblock_is_pmem(RAMBlock *rb); > > -long qemu_minrampagesize(void); > -long qemu_maxrampagesize(void); > +size_t qemu_minrampagesize(void); > +size_t qemu_maxrampagesize(void); > > /** > * qemu_ram_alloc_from_file, > diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h > index 085df8d508..77115a8270 100644 > --- a/include/qemu/osdep.h > +++ b/include/qemu/osdep.h > @@ -635,10 +635,10 @@ char *qemu_get_pid_name(pid_t pid); > */ > pid_t qemu_fork(Error **errp); > > +extern size_t qemu_real_host_page_size; > /* Using intptr_t ensures that qemu_*_page_mask is sign-extended even > * when intptr_t is 32-bit and we are aligning a long long. > */ > -extern uintptr_t qemu_real_host_page_size; > extern intptr_t qemu_real_host_page_mask; > > extern int qemu_icache_linesize; > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c > index 63ef6af9a1..59becfbd6c 100644 > --- a/accel/kvm/kvm-all.c > +++ b/accel/kvm/kvm-all.c > @@ -674,7 +674,8 @@ static int kvm_log_clear_one_slot(KVMSlot *mem, int as_id, uint64_t start, > KVMState *s = kvm_state; > uint64_t end, bmap_start, start_delta, bmap_npages; > struct kvm_clear_dirty_log d; > - unsigned long *bmap_clear = NULL, psize = qemu_real_host_page_size; > + unsigned long *bmap_clear = NULL; > + size_t psize = qemu_real_host_page_size; > int ret; > > /* > diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c > index 7444b9c4ab..4ad9f5929f 100644 > --- a/block/qcow2-cache.c > +++ b/block/qcow2-cache.c > @@ -74,7 +74,7 @@ static void qcow2_cache_table_release(Qcow2Cache *c, int i, int num_tables) > /* Using MADV_DONTNEED to discard memory is a Linux-specific feature */ > #ifdef CONFIG_LINUX > void *t = qcow2_cache_get_table_addr(c, i); > - int align = qemu_real_host_page_size; > + size_t align = qemu_real_host_page_size; > size_t mem_size = (size_t) c->table_size * num_tables; > size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t; > size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align); > diff --git a/exec.c b/exec.c > index 6f381f98e2..4b6d52e01f 100644 > --- a/exec.c > +++ b/exec.c > @@ -1657,7 +1657,7 @@ static int find_max_backend_pagesize(Object *obj, void *opaque) > * TODO: We assume right now that all mapped host memory backends are > * used as RAM, however some might be used for different purposes. > */ > -long qemu_minrampagesize(void) > +size_t qemu_minrampagesize(void) > { > long hpsize = LONG_MAX; > Object *memdev_root = object_resolve_path("/objects", NULL); > @@ -1666,7 +1666,7 @@ long qemu_minrampagesize(void) > return hpsize; > } > > -long qemu_maxrampagesize(void) > +size_t qemu_maxrampagesize(void) > { > long pagesize = 0; > Object *memdev_root = object_resolve_path("/objects", NULL); > @@ -1675,11 +1675,11 @@ long qemu_maxrampagesize(void) > return pagesize; > } > #else > -long qemu_minrampagesize(void) > +size_t qemu_minrampagesize(void) > { > return qemu_real_host_page_size; > } > -long qemu_maxrampagesize(void) > +size_t qemu_maxrampagesize(void) > { > return qemu_real_host_page_size; > } > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 363cdb3f7b..a9da84fe30 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -1810,7 +1810,7 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp) > char *namebuf; > int i; > PCIBus *bus; > - uint64_t msi_window_size = 4096; > + size_t msi_window_size = 4096; > SpaprTceTable *tcet; > const unsigned windows_supported = spapr_phb_windows_supported(sphb); > Error *local_err = NULL; > diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c > index c12e9f79b0..34344cec39 100644 > --- a/hw/virtio/virtio-mem.c > +++ b/hw/virtio/virtio-mem.c > @@ -753,7 +753,7 @@ static void virtio_mem_set_block_size(Object *obj, Visitor *v, const char *name, > } > > if (value < VIRTIO_MEM_MIN_BLOCK_SIZE) { > - error_setg(errp, "'%s' property has to be at least 0x%" PRIx32, name, > + error_setg(errp, "'%s' property has to be at least 0x%zx", name, > VIRTIO_MEM_MIN_BLOCK_SIZE); > return; > } else if (!is_power_of_2(value)) { > diff --git a/migration/migration.c b/migration/migration.c > index 8fe36339db..b8abbbeabb 100644 > --- a/migration/migration.c > +++ b/migration/migration.c > @@ -2433,7 +2433,7 @@ static struct rp_cmd_args { > static void migrate_handle_rp_req_pages(MigrationState *ms, const char* rbname, > ram_addr_t start, size_t len) > { > - long our_host_ps = qemu_real_host_page_size; > + size_t our_host_ps = qemu_real_host_page_size; > > trace_migrate_handle_rp_req_pages(rbname, start, len); > > diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c > index 1bb22f2b6c..f296efd612 100644 > --- a/migration/postcopy-ram.c > +++ b/migration/postcopy-ram.c > @@ -345,7 +345,7 @@ static int test_ramblock_postcopiable(RAMBlock *rb, void *opaque) > */ > bool postcopy_ram_supported_by_host(MigrationIncomingState *mis) > { > - long pagesize = qemu_real_host_page_size; > + size_t pagesize = qemu_real_host_page_size; > int ufd = -1; > bool ret = false; /* Error unless we change it */ > void *testarea = NULL; > diff --git a/monitor/misc.c b/monitor/misc.c > index e847b58a8c..7970f4ff72 100644 > --- a/monitor/misc.c > +++ b/monitor/misc.c > @@ -740,7 +740,7 @@ static uint64_t vtop(void *ptr, Error **errp) > uint64_t pinfo; > uint64_t ret = -1; > uintptr_t addr = (uintptr_t) ptr; > - uintptr_t pagesize = qemu_real_host_page_size; > + size_t pagesize = qemu_real_host_page_size; > off_t offset = addr / pagesize * sizeof(pinfo); > int fd; > > diff --git a/util/pagesize.c b/util/pagesize.c > index 998632cf6e..a08bf1717a 100644 > --- a/util/pagesize.c > +++ b/util/pagesize.c > @@ -8,7 +8,7 @@ > > #include "qemu/osdep.h" > > -uintptr_t qemu_real_host_page_size; > +size_t qemu_real_host_page_size; > intptr_t qemu_real_host_page_mask; > > static void __attribute__((constructor)) init_real_host_page_size(void) -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t 2020-07-30 14:12 [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé 2020-07-30 14:12 ` [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long Philippe Mathieu-Daudé 2020-07-30 14:12 ` [PATCH-for-5.1? v2 2/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé @ 2020-07-30 14:22 ` Dr. David Alan Gilbert 2020-07-30 14:29 ` Philippe Mathieu-Daudé 2 siblings, 1 reply; 7+ messages in thread From: Dr. David Alan Gilbert @ 2020-07-30 14:22 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Kevin Wolf, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, qemu-devel, Max Reitz, qemu-ppc, David Gibson, Paolo Bonzini, Richard Henderson, Stefano Garzarella * Philippe Mathieu-Daudé (philmd@redhat.com) wrote: > Since v1: > Make QEMU_VMALLOC_ALIGN unsigned in a previous patch Nah, not for 5.1 - it feels like the type of thing that might on a really bad day create a really subtle bug. Dave > Philippe Mathieu-Daudé (2): > qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long > util/pagesize: Make qemu_real_host_page_size of type size_t > > include/exec/ram_addr.h | 4 ++-- > include/qemu/osdep.h | 6 +++--- > accel/kvm/kvm-all.c | 3 ++- > block/qcow2-cache.c | 2 +- > exec.c | 8 ++++---- > hw/ppc/spapr_pci.c | 2 +- > hw/virtio/virtio-mem.c | 2 +- > migration/migration.c | 2 +- > migration/postcopy-ram.c | 2 +- > monitor/misc.c | 2 +- > util/pagesize.c | 2 +- > 11 files changed, 18 insertions(+), 17 deletions(-) > > -- > 2.21.3 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t 2020-07-30 14:22 ` [PATCH-for-5.1? v2 0/2] " Dr. David Alan Gilbert @ 2020-07-30 14:29 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 7+ messages in thread From: Philippe Mathieu-Daudé @ 2020-07-30 14:29 UTC (permalink / raw) To: Dr. David Alan Gilbert Cc: Kevin Wolf, Kaige Li, kvm, qemu-block, Michael S. Tsirkin, Markus Armbruster, Juan Quintela, David Hildenbrand, qemu-devel, Max Reitz, qemu-ppc, David Gibson, Paolo Bonzini, Richard Henderson, Stefano Garzarella On 7/30/20 4:22 PM, Dr. David Alan Gilbert wrote: > * Philippe Mathieu-Daudé (philmd@redhat.com) wrote: >> Since v1: >> Make QEMU_VMALLOC_ALIGN unsigned in a previous patch > > Nah, not for 5.1 - it feels like the type of thing that might on a > really bad day create a really subtle bug. Ack :) ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-31 1:11 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-07-30 14:12 [PATCH-for-5.1? v2 0/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé 2020-07-30 14:12 ` [PATCH-for-5.1? v2 1/2] qemu/osdep: Make QEMU_VMALLOC_ALIGN unsigned long Philippe Mathieu-Daudé 2020-07-31 0:09 ` David Gibson 2020-07-30 14:12 ` [PATCH-for-5.1? v2 2/2] util/pagesize: Make qemu_real_host_page_size of type size_t Philippe Mathieu-Daudé 2020-07-31 0:10 ` David Gibson 2020-07-30 14:22 ` [PATCH-for-5.1? v2 0/2] " Dr. David Alan Gilbert 2020-07-30 14:29 ` Philippe Mathieu-Daudé
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).