RE: [git pull] ia64 changes

Luck, Tony
2009-09-28T23:01:50Z

>> ticket = ia64_fetchadd(1, p, acq);
>>
>> if (!(((ticket >> TICKET_SHIFT) ^ ticket) & ((1L << TICKET_BITS) - 1)))
>> return;
>
> I think the above is wrong.
>
> Doesn't 'fetchadd' return the _old_ value?

Yes, It does return the old value ... but that it what we want. When
we tear the ticket from the machine on the Deli counter, our ticket
number is the OLD value. The updated value becomes the ticket number
for the next person to come along.

I.e. we start the lock with value 0x00000000, so the ticket showing is
0, and the now serving number is 0. We fetchadd a ticket and the lock
goes to 0x00000001 ... and we own the lock because the ticket we pulled
matches the now-serving number. When we are done we bumb the now-serving
value, so the lock goes to 0x00020001 and the lock is free again.

Did I do this differently from x86?

-Tony