[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [ANNOUNCEMENT] DRD, a Thread Error Detector
From:       "Bart Van Assche" <bart.vanassche () gmail ! com>
Date:       2008-07-09 10:41:13
Message-ID: e2e108260807090341s2266e0b5l76e8ca2373c1fd82 () mail ! gmail ! com
[Download RAW message or body]

On Tue, Jul 8, 2008 at 7:41 PM, Thiago Macieira <thiago@kde.org> wrote:
> Bart Van Assche wrote:
>>Neither DRD nor Helgrind reports data races on atomic variables as
>>long as all modifications of these variables happen via atomic
>>load-modify-store instructions instead of regular stores. Valgrind
>>3.3.x supports the atomic instructions of the i386 and x86_64
>>instructions sets, and Valgrind 3.4.0 will support the PPC lwarx /
>>stwcx instructions too.
>
> Qt uses the atomic, wait-free operations available on the x86-64 and i386
> architectures, which always operate on a full memory barrier (inc, dec,
> cmpxchg, xchg, xadd). On PowerPC, it uses the load-linked
> store-conditional instructions. All of that is provided via inline
> assembly.
>
> However, on PowerPC and some other architectures, the primitives provided
> do differ on memory barrier semantics. In the specific case of PowerPC,
> the instructions isync and lwsync are used and it's important that DRD
> detects the difference in meaning of those calls.
>
> It would be interesting if we could cooperate then to indicate the memory
> barrier semantic that was *meant* instead of that which was actually
> implemented due to hardware limitations. This is future-proofing the
> code, since using the wrong call on a platform may work, but may fail
> under unpredictable conditions on another platform.

Deriving memory barrier semantics from instructions like isync /
lwsync is possible, but this would result in platform-dependent
analysis results. IMHO a better approach with regard to analyzing the
use of Qt4's atomic operations is to let Valgrind intercept functions
like QBasicAtomicInt::testAndSetAcquire() /
QBasicAtomicInt::testAndSetRelease() / ... This will require a
separate build of Qt4 where the atomic functions are regular functions
and not inline functions.

Bart.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic