On 20 February 2013 14:59, Paolo Bonzini <pbonz...@redhat.com> wrote:
> Il 20/02/2013 15:49, Peter Maydell ha scritto:
>> On 20 February 2013 14:43, Laszlo Ersek <ler...@redhat.com> wrote:
>>> On 02/20/13 14:43, Paolo Bonzini wrote:
>>>> QEMU system emulation has been thread-safe for a long time
>>
>> Says who? cpu_interrupt() calls tcg_handle_interrupt()
>> which calls cpu_unlink_tb() which makes changes to the
>> TB datastructure with no kind of locking at all.
>
> But in system emulation mode, cpu_interrupt is always running under the
> iothread lock.

Mmm, true (and in any case tcg_handle_interrupt() does kick-and-return
if it's not the cputhread).

> cpu_exit is more interesting because it calls cpu_unlink_tb() outside
> the iothread lock.  However, it does this in a signal handler running in
> the CPU thread (or, in Windows, wrapped with
> SuspendThread/ResumeThread).  So it "only" needs to be
> async-signal-safe, not thread-safe.

It's not async-signal-safe, though :-)

-- PMM

Reply via email to