Re: Intermediate report for AIX 5L port

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Intermediate report for AIX 5L port
Date: 2001-12-11 01:07:55
Message-ID: 20011211100755V.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Got it. The AIX compiler apparently feels free to rearrange the
> sequence
>
> proc->lwWaiting = true;
> proc->lwExclusive = (mode == LW_EXCLUSIVE);
> proc->lwWaitLink = NULL;
> if (lock->head == NULL)
> lock->head = proc;
> else
> lock->tail->lwWaitLink = proc;
> lock->tail = proc;
>
> /* Can release the mutex now */
> SpinLockRelease_NoHoldoff(&lock->mutex);
>
> into something wherein the SpinLockRelease (which is just "x = 0")
> occurs before the last two assignments into the lock structure.
> Boo, hiss. Evidently, on your multiprocessor machine, there may be
> another CPU that is able to obtain the spinlock and then read the
> un-updated lock values before the stores occur.
>
> Declaring the lock pointer "volatile" seems to prevent this misbehavior.
>
> Personally I'd call this a compiler bug; isn't it supposed to consider
> semicolons as sequence points? I never heard that rearranging the order
> of stores into memory was considered a kosher optimization of C code.

Looks funny to me too. I will let the IBM engineers know what you have
found. Thanks.
--
Tatsuo Ishii

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-12-11 01:10:35 Re: Third call for platform testing
Previous Message Tom Lane 2001-12-11 01:06:31 Re: Intermediate report for AIX 5L port