[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Race condition between signal handler and cpu_exec()
From: |
malc |
Subject: |
Re: [Qemu-devel] Race condition between signal handler and cpu_exec() |
Date: |
Fri, 6 Mar 2009 15:30:38 +0300 (MSK) |
On Fri, 6 Mar 2009, Julian Seward wrote:
> 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.
Just for the record GCCs sync builtins involve full memory barriers which
are unnecessary here.
--
mailto:address@hidden