Detect early unsupported MADV_MERGEABLE and MADV_DONTDUMP, and print a clearer
error message that points to the deficiency of the host.
Cc: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+ if (QEMU_MADV_MERGEABLE == QEMU_MADV_INVALID) {
+ if (value) {
+ error_setg(errp, "Memory merging is not supported on this host");
+ }
+ assert(!backend->merge);
+ return;
+ }
+
if (!host_memory_backend_mr_inited(backend)) {
backend->merge = value;
return;
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+ if (QEMU_MADV_DONTDUMP == QEMU_MADV_INVALID) {
+ if (!value) {
+ error_setg(errp, "Dumping guest memory cannot be disabled on this host");
+ }
+ assert(backend->dump);
+ return;
+ }
+
if (!host_memory_backend_mr_inited(backend)) {
backend->dump = value;
return;
{
MachineState *ms = MACHINE(obj);
+ if (!value && QEMU_MADV_DONTDUMP == QEMU_MADV_INVALID) {
+ error_setg(errp, "Dumping guest memory cannot be disabled on this host");
+ return;
+ }
ms->dump_guest_core = value;
}
{
MachineState *ms = MACHINE(obj);
+ if (value && QEMU_MADV_MERGEABLE == QEMU_MADV_INVALID) {
+ error_setg(errp, "Memory merging is not supported on this host");
+ return;
+ }
ms->mem_merge = value;
}