Can someone make a suggestion here?

> Hi.
> 
> Here is a patch I hacked together. I didn't understand the TAS thing, and
> it appeared to be the cause of the problem. I hacked the code up by
> commenting out the assembly TAS provided and inserting the semaphore
> macros for the non-gcc alpha version. Perhaps someone with expertise in
> this area could assist in fixing the provided TAS.
> 
> Here is the patch:
> 
> -Michael
> 
> *** include/storage/s_lock.h    Tue Mar 14 23:01:08 2000
> --- include/storage/s_lock.h.bak        Sat Mar 11 19:21:30 2000
> ***************
> *** 79,85 ****
>    */
>   
>   #if defined(__alpha__)
> ! /*#define TAS(lock) tas(lock)
>   #define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
>   
>   static __inline__ int
> --- 79,85 ----
>    */
>   
>   #if defined(__alpha__)
> ! #define TAS(lock) tas(lock)
>   #define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
>   
>   static __inline__ int
> ***************
> *** 102,118 ****
>                 4: nop      ": "=m"(*lock), "=r"(_res): :"0");
>   
>         return (int) _res;
> ! }*/
> ! /*
> !  * OSF/1 (Alpha AXP)
> !  *
> !  * Note that slock_t on the Alpha AXP is msemaphore instead of char
> !  * (see storage/ipc.h).
> !  */
> ! #define TAS(lock)       (msem_lock((lock), MSEM_IF_NOWAIT) < 0)
> ! #define S_UNLOCK(lock)  msem_unlock((lock), 0)
> ! #define S_INIT_LOCK(lock)       msem_init((lock), MSEM_UNLOCKED)
> ! #define S_LOCK_FREE(lock)       (!(lock)->msem_state)
>   
>   #endif         /* __alpha__ */
>   
> --- 102,108 ----
>                 4: nop      ": "=m"(*lock), "=r"(_res): :"0");
>   
>         return (int) _res;
> ! }
>   
>   #endif         /* __alpha__ */
>   
> 
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Fri, 9 Jun 2000 13:33:00 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: Hack to make postgres compile on Dec 4.0f with GCC
Bruce Momjian wrote:

> Can someone make a suggestion here?
>
> > Hi.
> >
> > Here is a patch I hacked together. I didn't understand the TAS thing, and
> > it appeared to be the cause of the problem. I hacked the code up by
> > commenting out the assembly TAS provided and inserting the semaphore
> > macros for the non-gcc alpha version. Perhaps someone with expertise in
> > this area could assist in fixing the provided TAS.

Yep, Arrigo looked at the TAS code for Alpha-Linux (it is commented out for
DEC Unix) and came to the conclusion that it probably only worked on specific
configurations and definitely not on multi-processor machines. He has been
trying to write the code himself, but it turns out to be extraordinarily hard
to get this working properly on Alpha (espec. multi-processor machines). I
believe he is currently trying to interest somebody in Digital in this
problem. Until a proper solution has been found, it is probably safer to just
stick to the semaphores.

Adriaan


Mon, 12 Jun 2000 08:15:18 +0300
Adriaan Joubert <a.joubert@albourne.com>
Re: [HACKERS] Re: Hack to make postgres compile on Dec 4.0f with GCC