Paolo Bonzini <[email protected]> writes:
> On 18/10/21 16:53, Alex Bennée wrote: >> Paolo Bonzini <[email protected]> writes: >> >>> On 18/10/21 16:02, Alex Bennée wrote: >>>> While there are a number of uses in the code-base of the exit(0) >>>> pattern it gets in the way of clean exit which can do all of it's >>>> house-keeping. In particular it was reported that you can crash >>>> plugins this way because TCG can still be running on other threads >>>> when the atexit callback is called. >>>> Use qemu_system_shutdown_request() instead. I did a gentle rename of >>>> the runstate stub seeing as it now contains two functions. >>>> Signed-off-by: Alex Bennée <[email protected]> >>>> Reported-by: Lukas Jünger <[email protected]> >>> >>> That won't work with -no-shutdown, but you can just call qmp_quit() >>> instead. >> How does calling qmp_quit() fix --no-shutdown? Isn't it just a thin >> wrapper around the qemu_system_shutdown_request()? > > It first undoes the effect of -no-shutdown: > > void qmp_quit(Error **errp) > { > shutdown_action = SHUTDOWN_ACTION_POWEROFF; I guess this is it? I couldn't follow the chain of qemu_opts to find what sort of change -no-shutdown made to the shutdown_action. > qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP_QUIT); > } > > Paolo -- Alex Bennée
