fix qemu crash with memory-backend-* prealloc=yes
cover fix qemu crash with memory-backend-* prealloc=yes
Igor Mammedov (2):
hostmem: set default prealloc_threads to valid value
tests: numa: test one backend with prealloc enabled
backends/hostmem.c | 1 + tests/qtest/numa-test.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.18.1
PATCH 1/2 hostmem: set default prealloc_threads to valid value
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.
--- backends/hostmem.c | 1 + 1 file changed, 1 insertion(+)
backends/hostmem.c +1 -0
@@ -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)
Signature · 1 line
2.18.1
Re: [PATCH for-5.0 1/2] hostmem: set default prealloc_threads to valid value
Quoted 21 lines · Igor Mammedov
Commit
4ebc74dbbfremoved defaultprealloc_threadsinitialization 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=128MReturn back initialization removed by
4ebc74dbbfto fix issue.Fixes 4ebc74dbbf7ad50e4101629f3f5da5fdc1544051Reported-by Raphael Norwitz <[email protected]>Signed-off-by Igor Mammedov <[email protected]>--- backends/hostmem.c | 1 + 1 file changed, 1 insertion(+)backends/hostmem.c +0
-0
backends/hostmem.c static void host_memory_backend_init(Object *obj) · line 286
Quoted 7 lines
backends/hostmem.c +1
-0@@ -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)
PATCH 2/2 tests: numa: test one backend with prealloc enabled
In reply to Igor Mammedovcanbalize one backend in hmat test to make sure that prealloc=y is tested
--- tests/qtest/numa-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/numa-test.c +1 -1
@@ -455,7 +455,7 @@ static void pc_hmat_off_cfg(const void *data) cli =make_cli (data,"-nodefaults --preconfig " "-smp 2,sockets=2 " "-m 128M,slots=2,maxmem=1G " -"-object memory-backend-ram,size=64M,id=m0 " +"-object memory-backend-ram,size=64M,id=m0,prealloc=y " "-object memory-backend-ram,size=64M,id=m1 " "-numa node,nodeid=0,memdev=m0" ); qs =qtest_init (cli);
Signature · 1 line
2.18.1
Quoted 8 lines · On Wed, 25 Mar 2020 05:44:21 -0400 Igor Mammedov <[email protected]> wrote:
Igor Mammedov (2):
hostmem: set defaultprealloc_threadsto valid value
tests: numa: test one backend with prealloc enabledbackends/hostmem.c | 1 + tests/qtest/numa-test.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
it looks like it's fallen through cracks.
Peter, Paolo
Could you pick it up for 5.0, pls?