qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] chardev: don't exit() straight away on C-a x


From: Paolo Bonzini
Subject: Re: [RFC PATCH] chardev: don't exit() straight away on C-a x
Date: Mon, 18 Oct 2021 16:59:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 18/10/21 16:53, Alex Bennée wrote:

Paolo Bonzini <pbonzini@redhat.com> 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 <alex.bennee@linaro.org>
Reported-by: Lukas Jünger <lukas.junger@greensocs.com>

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;
    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP_QUIT);
}

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]