qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] char: do not use atexit cleanup handler


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] char: do not use atexit cleanup handler
Date: Mon, 4 Jul 2016 18:46:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1


On 04/07/2016 18:31, Daniel P. Berrange wrote:
>> > Instead of using a atexit() handler, only run the chardev cleanup as
>> > initially proposed at the end of main(), where there are less chances
>> > (hic) of conflicts or other races.
> This doesn't really seem all that much safer. There's still plenty of
> chance that threads are running in the background at the end of the
> main() method, so plenty of scope for the qemu_chr_cleanup() call to
> cause threads to segv by destroying the chardevs they're using behind
> their back.

At this point you have stopped all CPUs and block devices.  There is not
much else that is going on in QEMU at all, at this point.  The solution
would be to stop those threads.

Paolo

> IIUC, the original intent here was that we call unlink() on the UNIX
> socket paths when QEMU exits.
> 
> Surely we can come up with a way to that, and only that, upon exit,
> without actually having to free the chardev memory with all the risks
> that entails.
> 
> eg, have a qemu_chr_close() method that closes & cleans up resources,
> separately from actually free'ing the Chardev struct with all the
> risk of crashing concurrent threads that entails.
> 



reply via email to

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