* [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 @ 2024-02-06 7:14 David Hildenbrand 2024-02-06 7:14 ` [PULL v2 1/3] hv-balloon: use get_min_alignment() to express 32 GiB alignment David Hildenbrand 2024-02-06 7:20 ` [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 David Hildenbrand 0 siblings, 2 replies; 3+ messages in thread From: David Hildenbrand @ 2024-02-06 7:14 UTC (permalink / raw) To: qemu-devel; +Cc: Peter Maydell, Paolo Bonzini, David Hildenbrand The following changes since commit 39a6e4f87e7b75a45b08d6dc8b8b7c2954c87440: Merge tag 'pull-qapi-2024-02-03' of https://repo.or.cz/qemu/armbru into staging (2024-02-03 13:31:58 +0000) are available in the Git repository at: https://github.com/davidhildenbrand/qemu.git tags/mem-2024-02-06-v2 for you to fetch changes up to 8eb38ab662e74d618d473a9a52d71c644926c3c0: oslib-posix: initialize backend memory objects in parallel (2024-02-06 08:09:55 +0100) ---------------------------------------------------------------- Hi, "Host Memory Backends" and "Memory devices" queue ("mem"): - Reintroduce memory region size checks for memory devices; the removal lead to some undesired side effects - Preallocate memory of memory backends in selected configurations asynchronously (so we preallocate concurrently), to speed up QEMU startup time. ---------------------------------------------------------------- David Hildenbrand (2): hv-balloon: use get_min_alignment() to express 32 GiB alignment memory-device: reintroduce memory region size check Mark Kanda (1): oslib-posix: initialize backend memory objects in parallel backends/hostmem.c | 7 ++- hw/hyperv/hv-balloon.c | 37 +++++++----- hw/mem/memory-device.c | 14 +++++ hw/virtio/virtio-mem.c | 4 +- include/hw/qdev-core.h | 5 ++ include/qemu/osdep.h | 18 +++++- system/vl.c | 9 +++ util/oslib-posix.c | 131 +++++++++++++++++++++++++++++++---------- util/oslib-win32.c | 8 ++- 9 files changed, 180 insertions(+), 53 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PULL v2 1/3] hv-balloon: use get_min_alignment() to express 32 GiB alignment 2024-02-06 7:14 [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 David Hildenbrand @ 2024-02-06 7:14 ` David Hildenbrand 2024-02-06 7:20 ` [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 David Hildenbrand 1 sibling, 0 replies; 3+ messages in thread From: David Hildenbrand @ 2024-02-06 7:14 UTC (permalink / raw) To: qemu-devel Cc: Peter Maydell, Paolo Bonzini, David Hildenbrand, Maciej S . Szmigiero Let's implement the get_min_alignment() callback for memory devices, and copy for the device memory region the alignment of the host memory region. This mimics what virtio-mem does, and allows for re-introducing proper alignment checks for the memory region size (where we don't care about additional device requirements) in memory device core. Message-ID: <20240117135554.787344-2-david@redhat.com> Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Signed-off-by: David Hildenbrand <david@redhat.com> --- hw/hyperv/hv-balloon.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/hw/hyperv/hv-balloon.c b/hw/hyperv/hv-balloon.c index 0238365712..ade283335a 100644 --- a/hw/hyperv/hv-balloon.c +++ b/hw/hyperv/hv-balloon.c @@ -1477,22 +1477,7 @@ static void hv_balloon_ensure_mr(HvBalloon *balloon) balloon->mr = g_new0(MemoryRegion, 1); memory_region_init(balloon->mr, OBJECT(balloon), TYPE_HV_BALLOON, memory_region_size(hostmem_mr)); - - /* - * The VM can indicate an alignment up to 32 GiB. Memory device core can - * usually only handle/guarantee 1 GiB alignment. The user will have to - * specify a larger maxmem eventually. - * - * The memory device core will warn the user in case maxmem might have to be - * increased and will fail plugging the device if there is not sufficient - * space after alignment. - * - * TODO: we could do the alignment ourselves in a slightly bigger region. - * But this feels better, although the warning might be annoying. Maybe - * we can optimize that in the future (e.g., with such a device on the - * cmdline place/size the device memory region differently. - */ - balloon->mr->align = MAX(32 * GiB, memory_region_get_alignment(hostmem_mr)); + balloon->mr->align = memory_region_get_alignment(hostmem_mr); } static void hv_balloon_free_mr(HvBalloon *balloon) @@ -1654,6 +1639,25 @@ static MemoryRegion *hv_balloon_md_get_memory_region(MemoryDeviceState *md, return balloon->mr; } +static uint64_t hv_balloon_md_get_min_alignment(const MemoryDeviceState *md) +{ + /* + * The VM can indicate an alignment up to 32 GiB. Memory device core can + * usually only handle/guarantee 1 GiB alignment. The user will have to + * specify a larger maxmem eventually. + * + * The memory device core will warn the user in case maxmem might have to be + * increased and will fail plugging the device if there is not sufficient + * space after alignment. + * + * TODO: we could do the alignment ourselves in a slightly bigger region. + * But this feels better, although the warning might be annoying. Maybe + * we can optimize that in the future (e.g., with such a device on the + * cmdline place/size the device memory region differently. + */ + return 32 * GiB; +} + static void hv_balloon_md_fill_device_info(const MemoryDeviceState *md, MemoryDeviceInfo *info) { @@ -1766,5 +1770,6 @@ static void hv_balloon_class_init(ObjectClass *klass, void *data) mdc->get_memory_region = hv_balloon_md_get_memory_region; mdc->decide_memslots = hv_balloon_decide_memslots; mdc->get_memslots = hv_balloon_get_memslots; + mdc->get_min_alignment = hv_balloon_md_get_min_alignment; mdc->fill_device_info = hv_balloon_md_fill_device_info; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 2024-02-06 7:14 [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 David Hildenbrand 2024-02-06 7:14 ` [PULL v2 1/3] hv-balloon: use get_min_alignment() to express 32 GiB alignment David Hildenbrand @ 2024-02-06 7:20 ` David Hildenbrand 1 sibling, 0 replies; 3+ messages in thread From: David Hildenbrand @ 2024-02-06 7:20 UTC (permalink / raw) To: qemu-devel; +Cc: Peter Maydell, Paolo Bonzini On 06.02.24 08:14, David Hildenbrand wrote: > The following changes since commit 39a6e4f87e7b75a45b08d6dc8b8b7c2954c87440: > > Merge tag 'pull-qapi-2024-02-03' of https://repo.or.cz/qemu/armbru into staging (2024-02-03 13:31:58 +0000) > > are available in the Git repository at: > > https://github.com/davidhildenbrand/qemu.git tags/mem-2024-02-06-v2 > > for you to fetch changes up to 8eb38ab662e74d618d473a9a52d71c644926c3c0: > > oslib-posix: initialize backend memory objects in parallel (2024-02-06 08:09:55 +0100) > > ---------------------------------------------------------------- > Hi, > > "Host Memory Backends" and "Memory devices" queue ("mem"): > - Reintroduce memory region size checks for memory devices; the removal > lead to some undesired side effects > - Preallocate memory of memory backends in selected configurations > asynchronously (so we preallocate concurrently), to speed up QEMU > startup time. ... and yet another instance of the same mail address is wrong. Gah. Maybe v3 will do ... -- Cheers, David / dhildenb ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-06 7:20 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-02-06 7:14 [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 David Hildenbrand 2024-02-06 7:14 ` [PULL v2 1/3] hv-balloon: use get_min_alignment() to express 32 GiB alignment David Hildenbrand 2024-02-06 7:20 ` [PULL v2 0/3] Host Memory Backends and Memory devices queue 2024-02-06 David Hildenbrand
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).