[parisc-linux] atomic_t

Matthew Wilcox willy@debian.org
Mon, 14 Jan 2002 04:43:37 +0000


On Sun, Jan 13, 2002 at 09:09:09PM -0700, Grant Grundler wrote:
> You are only looking at interactions between atomic_set
> and atomic_add_return. Aren't there potentialially other
> types of interactions with other atomic operations?
> But I don't know. Alan Cox?

Not on PA... look at <asm/atomic.h>.  There's only 3 primitives, all
other atomic ops are defined in terms of those.

> > Before step b leads to case 2.  after step d leads to case 1.  between
> > steps b and d, it's as if the atomic_set _never_happened_.  It results
> > in v=4, a_a_r returns 4.
> 
> I agree with the analysis.
> 
> But someone thought it was time to reset the counter. And if
> it "never happened", then whoever is looking for 'v == 1' will
> never see it.

It's a race though; they can't guarantee to see it anyway.

> Even if that code doesn't exist today, it might exist in the future.
> I don't want to bet on corner cases with the semantics.
> Those types of bugs are hard to reproduce and hard to debug.

yeah, wasn't planning on committing.

-- 
Revolutions do not require corporate support.