diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2024-06-05 12:44:58 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-06-08 10:33:38 +0200 |
commit | 5d9a9a617053a97a76ef332896c386d8fc895631 (patch) | |
tree | df6cf71038ce21301f4e579c836e860ac5940881 /include/sysemu | |
parent | 210b7b2b3cdef01a15ebabf02dd1a9d8a51743ba (diff) | |
download | qemu-5d9a9a617053a97a76ef332896c386d8fc895631.zip qemu-5d9a9a617053a97a76ef332896c386d8fc895631.tar.gz qemu-5d9a9a617053a97a76ef332896c386d8fc895631.tar.bz2 |
backends/hostmem: Report error when memory size is unaligned
If memory-backend-{file,ram} has a size that's not aligned to
underlying page size it is not only wasteful, but also may lead
to hard to debug behaviour. For instance, in case
memory-backend-file and hugepages, madvise() and mbind() fail.
Rightfully so, page is the smallest unit they can work with. And
even though an error is reported, the root cause it not very
clear:
qemu-system-x86_64: Couldn't set property 'dump' on 'memory-backend-file': Invalid argument
After this commit:
qemu-system-x86_64: backend 'memory-backend-file' memory size must be multiple of 2 MiB
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Mario Casquero <mcasquer@redhat.com>
Message-ID: <b5b9f9c6bba07879fb43f3c6f496c69867ae3716.1717584048.git.mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/sysemu')
-rw-r--r-- | include/sysemu/hostmem.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 04b884b..de47ae5 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -74,7 +74,7 @@ struct HostMemoryBackend { uint64_t size; bool merge, dump, use_canonical_path; bool prealloc, is_mapped, share, reserve; - bool guest_memfd; + bool guest_memfd, aligned; uint32_t prealloc_threads; ThreadContext *prealloc_context; DECLARE_BITMAP(host_nodes, MAX_NODES + 1); |