This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: DB_THREAD support in Berkeley DB/glibc
- To: Daniel Jacobowitz <drow at false dot org>
- Subject: Re: DB_THREAD support in Berkeley DB/glibc
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Tue, 28 Dec 1999 17:28:23 -0500
- Cc: linuxppc-dev at lists dot linuxppc dot org, libc-alpha at sourceware dot cygnus dot com
The TSL_UNSET still does not look sufficient to me. It needs to
use lwarx/stwcx as well:
#define TSL_UNSET(tsl) ({
register tsl_t *__l = (tsl);
register tsl_t __r1;
__asm__ __volatile__ ("
sync
10: lwarx %0,0,%1
stwcx. %2,0,%1
bne- 10b
isync"
: "=&r" (__r1) : "r" (__l), "r" (0));
})
As I mentioned privately to David Huggins-Daines, the order I normally use
is: 1) sync, 2) perform the atomic update, 3) isync. This ensures that
the cached copy of the memory location is consistent, performs the update,
and the ensures that no later instructions which depend on the atomicity
are moved ahead of the atomic operation. I am not sure how that maps to
the Alpha "memory barrier" instruction as I have seen some discussion
about it on the Linux/PPC mailinglists in the past. As long as all
threads using the macro sync first, there is should be no need to sync
after.
David