[PATCH]: powerpc documentation: Clarify why twi appears in the i/o macros.

Segher Boessenkool segher at kernel.crashing.org
Sat Dec 9 20:32:13 EST 2006


> isync is context synchronizing.  In the definition of context
> synchronization, it says "2.  The operation is not initiated, or in
> the case of isync, does not complete, until all instructions already
> in execution have completed to a point at which they have reported all
> exceptions they will cause".

> The twi conditionally causes an exception

Except we use a trap with TO=0 so the CPU could optimise the
dependency away -- or where does it say this is prohibited?

For conditional branches, this behaviour (not optimising away
branches, even if they have a result independent on the data)
is explicitly documented.

> depending on the data from the previous load, therefore it
> cannot complete to a point at which is has reported all exceptions it
> will cause until it sees the data from the load.  Therefore the isync
> cannot complete (and allow following instructions to start) until the
> data from the load has returned.
>
> I once asked Ed Silha (one of the PowerPC architects) whether this
> reasoning was good, and he agreed it was.

My only nit is I can't find a guarantee that the trap instruction will
have to get the read data as input before it can "report the exceptions
it caused".  Would you have anything on that?  I'll sleep so much better
if I know it's safe :-)


Segher




More information about the Linuxppc-dev mailing list