Re: [HACKERS] Re: Hack to make postgres compile on Dec 4.0f with GCC

Lists: pgsql-hackerspgsql-patches
From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Richards <miker(at)fastmail(dot)ca>
Cc: pgsql-patches(at)postgreSQL(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Hack to make postgres compile on Dec 4.0f with GCC
Date: 2000-06-09 17:33:00
Message-ID: 200006091733.NAA19468@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Adriaan Joubert <a(dot)joubert(at)albourne(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Michael Richards <miker(at)fastmail(dot)ca>, pgsql-patches(at)postgreSQL(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: Hack to make postgres compile on Dec 4.0f with GCC
Date: 2000-06-12 05:15:18
Message-ID: 394471E6.83E067BF@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

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