qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Race condition between signal handler and cpu_exec()


From: Julian Seward
Subject: Re: [Qemu-devel] Race condition between signal handler and cpu_exec()
Date: Fri, 6 Mar 2009 12:49:28 +0100
User-agent: KMail/1.9.9

On Friday 06 March 2009, Jamie Lokier wrote:
> Aurelien Jarno wrote:
> > I am currently too tired to find a proper solution (which should only
> > use read/write to a variable to keep the operations atomic), I'll look
> > at that tomorrow, but patches are welcome in the meanwhile.
>
> The theoretically right thing in C is read/write a "volatile
> sig_atomic_t".

It looks to me like this requires to atomically test that a bit in a
byte is set, and if so clear it.  That would require a lock;cmpxchg
sequence on x86 and lwarx/stwcx on ppc.  I wonder if it can be done
with gcc's __sync_bool_compare_and_swap builtin, in order to make
it portable.

J




reply via email to

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