On Fri, 6 Mar 2020 03:50:14 -0500 Christian Borntraeger <[email protected]> wrote:
> Guests with mem-prealloc do fail with > qemu-system-s390x: /home/cborntra/REPOS/qemu/util/qemu-thread-posix.c:76: > qemu_mutex_lock_impl: Assertion `mutex->initialized' failed. > qemu-system-s390x: /home/cborntra/REPOS/qemu/util/qemu-thread-posix.c:161: > qemu_cond_broadcast: Assertion `cond->initialized' failed. > > Let us initialize cond and mutex. > > Cc: bauerchen <[email protected]> > Cc: Paolo Bonzini <[email protected]> > Reported-by: Marc Hartmayer <[email protected]> > Fixes: 037fb5eb3941 ("mem-prealloc: optimize large guest startup") > Signed-off-by: Christian Borntraeger <[email protected]> > --- > util/oslib-posix.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/util/oslib-posix.c b/util/oslib-posix.c > index 897e8f3ba6..52650183d3 100644 > --- a/util/oslib-posix.c > +++ b/util/oslib-posix.c > @@ -470,6 +470,8 @@ static bool touch_all_pages(char *area, size_t hpagesize, > size_t numpages, > char *addr = area; > int i = 0; > > + qemu_cond_init(&page_cond); > + qemu_mutex_init(&page_mutex); Is it possible for touch_all_pages to be called several times? If it's then it probably needs a guard against that to make sure it won't explode, something like: static bool page_mutex_inited; if(page_mutex_inited) page_mutex_inited = true qemu_mutex_init(&page_mutex) ... > memset_thread_failed = false; > threads_created_flag = false; > memset_num_threads = get_memset_num_threads(smp_cpus);
