mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-07-08 20:17:27 +00:00
machine, hostmem: improve error messages for unsupported features
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>
This commit is contained in:
parent
5d9a9a6170
commit
a2b6a96505
|
@ -170,6 +170,14 @@ static void host_memory_backend_set_merge(Object *obj, bool value, Error **errp)
|
||||||
{
|
{
|
||||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
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)) {
|
if (!host_memory_backend_mr_inited(backend)) {
|
||||||
backend->merge = value;
|
backend->merge = value;
|
||||||
return;
|
return;
|
||||||
|
@ -196,6 +204,14 @@ static void host_memory_backend_set_dump(Object *obj, bool value, Error **errp)
|
||||||
{
|
{
|
||||||
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
|
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)) {
|
if (!host_memory_backend_mr_inited(backend)) {
|
||||||
backend->dump = value;
|
backend->dump = value;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -428,6 +428,10 @@ static void machine_set_dump_guest_core(Object *obj, bool value, Error **errp)
|
||||||
{
|
{
|
||||||
MachineState *ms = MACHINE(obj);
|
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;
|
ms->dump_guest_core = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,6 +446,10 @@ static void machine_set_mem_merge(Object *obj, bool value, Error **errp)
|
||||||
{
|
{
|
||||||
MachineState *ms = MACHINE(obj);
|
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;
|
ms->mem_merge = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user