Cache Coherency problem on i5-520 and Xeon multi core

Cache Coherency problem on i5-520 and Xeon multi core

Greetings,

We have some lock free code which use atomic CAS. That translates to "lock+cmpxchgl" instruction for x86 architecture. The code operates on multiple cores. We see that at times cache on different cores has stale entries, i.e., Core 0 has X but Core 1 has a previous value X'. At other times a transaction was lost as if the lock+cmpxchgl never happened. Has anyone faced such issues?

The ASM primitives used are:

#define LOCK_PREFIX "lock;"
#define atomic_cmpxchgl(mem, newval, oldval)                 

  ({ __typeof (*mem) ret;                                   

__asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1"            

                       : "=a" (ret), "=m" (*mem)            

                       : "r" ((uint32_t) (newval)), "m" (*mem), 

                         "0" ((uint32_t) (oldval)));            

     ret; })

Usage in C code ...

        do {

	} while (atomic_cmpxchgl(&elem->hdr, CONSUMER_FREE,

                    PRODUCER_BUSY) != PRODUCER_BUSY);


Any comments or pointers shall be appreciated.

Thanks,
Somnath Mitra.

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Microsoft Office 2010 is actually the newest software from microsoft office 2010 keys Microsoft Corporation introduced in the last year. Its leading aims tend to be to catch the present business requirements and to be on top of every competition with regard to the international market criteria. This can be a very good idea to obtain Microsoft Office 2010 Key immediately to maintain norton antivirus keys yourself up-to-date and to present you with the vast qualified progress opportunities for success. Microsoft Office 2010 is available in both 32-bit and 64-bit editions, but attention please the two are not able to co-exist on the very same personal computer. All of the Office 2010 editions are kaspersky antivirus keys suitable for Windows XP SP3, Windows Vista and Windows 7.

www.keyyeah.com

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen