]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hostmem: set default prealloc_threads to valid value
authorIgor Mammedov <imammedo@redhat.com>
Wed, 25 Mar 2020 09:44:22 +0000 (05:44 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Apr 2020 14:35:08 +0000 (10:35 -0400)
Commit 4ebc74dbbf removed default prealloc_threads initialization
by mistake, and that makes QEMU crash with division on zero at
  numpages_per_thread = numpages / memset_num_threads;
when QEMU is started with following backend
  -object memory-backend-ram,id=ram-node0,prealloc=yes,size=128M

Return back initialization removed by 4ebc74dbbf to fix issue.

Fixes: 4ebc74dbbf7ad50e4101629f3f5da5fdc1544051
Reported-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20200325094423.24293-2-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
backends/hostmem.c

index a70867b255d8bdf7db143ff507e3833b5127b39c..327f9eebc3c7fe9236db575f75031944df14f9a9 100644 (file)
@@ -280,6 +280,7 @@ static void host_memory_backend_init(Object *obj)
     /* TODO: convert access to globals to compat properties */
     backend->merge = machine_mem_merge(machine);
     backend->dump = machine_dump_guest_core(machine);
+    backend->prealloc_threads = 1;
 }
 
 static void host_memory_backend_post_init(Object *obj)