Hi Kevin,

On 29/07/2019 22:22, Kevin Smith wrote:
> Thanks for the explanation, Nikos! Let me ask about two specific
> (similar) examples which hopefully will clear it up for me.
>
> Let's say L1A sends out a read request r1 for some line. No L1s have the
> line. The L2 has the line in Exclusive state (Writable + !Dirty). The L2
> responds, correct? Does the L1A get the line back in Exclusive? Does the
> L2 move to a different coherent state?

L1A will send out an ReadSharedReq (not ReadExReq) but in this case L1A
will receive an exclusive copy of the block - while snooping, we didn't
discover any other sharers. This is really an optimization, in a simpler
implementation L1A will get back a shared copy of the line.

>
> Now a similar example with another reader L1B:
> Let's say L1A sends out a read request r1 for some line. No L1s have the
> line. The L2 has the line in Exclusive state (Writable + !Dirty), and
> queues up (but doesn't yet send) a response to r1. Then L1B sends a read
> request r2 (before the L2 sends the r1 response back to L1A). What
> happens? Does L1A or L2 respond to L1B's r2? What coherent state would
> the L2, L1A, and L1B have the line in?
>

If the L2 has the block and doesn't have an outstanding MSHR for the
same line it should respond immediately.

In this example, regardless of the exact order, neither the L1A nor L1B
will ever respond to any request for that line; they don't have a dirty
copy of the block or an outstanding request for that block that will
make it dirty (pendingModified() and inService MSHR).

If L1A, or L1B has an outstanding (inService) MSHR then a response from
L2 will indicate that there are sharers (your example). Otherwise, the
response from L2 will return an exclusive copy of the block.

For example, if r1 completes before r2 even starts, L1A will get an
exclusive copy of the block. When L1B sends out its r2 request, it will
snoop L1A and downgrade the line.

In your particular example:
* L1A, L1B will have end up with a shared copy of the block (writable =
false, dirty = false, valid = true).
* L2 will end up with an exclusive copy of the block (writable = true,
dirty = false, valid = true).

> It seems like L1A is not responsible for responding to r1, because it
> will not get the line back modified/won't modify it right away when it
> gets the response back, correct? So the L2 should respond. And so in
> this case L1A shouldn't get the line in Exclusive, because otherwise it
> would be free to write to the line even though it's shared with L1B. So
> does L1A setHasSharers() on r1 because it knows it will get the line
> eventually, and mark in the MSHR to ensure it doesn't have the line in
> Exclusive? Or does the L2 do this on the response packet back to L1A for r1?
>

Exactly, that is what the packet's hasSharers flag for.

Cheers,

Nikos

> Thanks again, this is very helpful as I try to learn gem5! :)
> Kevin
>
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to