Re: want to clarify powerpc assembly conventions in head.S and entry.S

From: Segher Boessenkool
Date: Tue Apr 13 2004 - 10:12:11 EST


stwcx. r0,0,r1 /* to clear the reservation */

I don't see the corresponding lwarx instruction. What reservation is it
referring to?

This is to clear any possible pending reservation if any. The problem is
that the reservation mecanism only works accross multiple CPUs. A normal
store at an address covered by a reservation on the same CPU will not break
the reservation. Thus, to protect from that, any interrupt or exception
makes sure to return to the normal code flow with any pending reservation
cleared.

Worse, it is allowed for a PowerPC implementation to not check if stwcx. and
stdcx. refer to the same address as the preceding lwarx or ldarx . So, a store
conditional insn can succeed because the cpu holds some *other* reservation.
Therefore, the kernel has to clear any reservation that might not have been
generated by the user code it is returning to.


Segher

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/