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: Alex Bennée
Subject: Re: [RFC PATCH] chardev: don't exit() straight away on C-a x
Date: Mon, 18 Oct 2021 18:20:29 +0100
User-agent: mu4e 1.7.0; emacs 28.0.60

Paolo Bonzini <pbonzini@redhat.com> writes:

> 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;

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



reply via email to

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