Messages in this thread | | | From | "David Schwartz" <> | Subject | RE: spin_unlock optimization(i386) | Date | Tue, 30 Nov 1999 02:34:44 -0800 |
| |
> That wasn't my understanding. > > read B read A (<- speculative) > A = 1 > B = 0 > read A (*) > > Here read B=?, but read A=1. A is read speculatively, but because > write B=0 is seen *after* the write A=1, the speculative read on A is > thrown away. The speculative read for B is accepted because there > were no writes to B before the write to A.
A speculative read is never "thrown away" if it's needed. It's only thrown away if it's not executed (say, due to a conditional branch instruction).
> Just flip the diagram to get the case for B. > > It is my understanding that a read for A that follows a write to B on > one processor can move *before* that write, but the read result on A > isn't retired until after the write to B occurs (in processor order).
Correct, the read isn't retired, but the value read earlier is the value that will be retired when the retire takes place.
> The processor sees all writes before it's own that have occurred after > the read (so it sees A=1), and if any of them touch A, it will > invalidated the read on A, *before* its result is retired. The read > is redone, and it gets the correct value for A.
The read is never redone. How would the processor possibly know to redo the read? And why would it? Are you suggesting that every speculative read be redone if any chunk of memory is written to by any processor?
DS
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |