Subject: Re: For your edification...
To: Monroe Williams <monroe@pobox.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: port-macppc
Date: 02/15/2003 16:29:48
On Thu, 13 Feb 2003, Monroe Williams wrote:

> on 2/13/03 5:03 PM, Bill Studenmund at wrstuden@netbsd.org wrote:
>
> > I think Cliff's comment was different. I think he was saying make sure
> > that all writes to this variable use this code. It does not good if one
> > (or most) writer does this while others don't.
> >
> > I think reads are fine, since I gather that ipending is an int, so it can
> > be read atomicly.
>
> Aha...
>
> I see that I had misread the section on lwarx/stwcx.  I didn't realize that
> normal stores to the reserved address didn't clear the reservation.  This
> fact isn't clearly called out in section 4.2.6 of the PowerPC Enviromnents
> book, although it can be inferred from a careful reading of the bulleted
> list of things that may clear a reservation.

?? Wow. I didn't know that. I was more aluding to the fact that of these
things to work, you have to get all of them. i.e. This may fix 95% of the
possible race conditions (or 99.99%), but as long as there's any other
code that may write this variable, you aren't safe.

Normal writes won't clear the reservation? Weird.

> I was further confused by the fact that stores by any _other_ CPU or
> mechanism in the system would clear the reservation.
>
> Well, so much for that idea...

No, I think this is the right idea. My point was more that there needs to
also be a code audit to make sure there are no other writers to the
variable, or that they get the same treatment.

Take care,

Bill