mem: implement x86 locked accesses in timing-mode classic cache
Review Request #2691 - Created March 14, 2015 and updated
Information | |
---|---|
Steve Reinhardt | |
gem5 | |
default | |
Reviewers | |
Default | |
Changeset 11444:8a1419dbbfa6 --------------------------- mem: implement x86 locked accesses in timing-mode classic cache Add LockedRMW(Read|Write)(Req|Resp) commands. In timing mode, use a combination of clearing permission bits and leaving an MSHR in place to prevent accesses & snoops from touching a locked block between the read and write parts of an locked RMW sequence.
Issue Summary
Description | From | Last Updated | Status |
---|---|---|---|
This should really be: if (!mshr.hasTargets()) and all the stuff below has too deep an (or two) indentation level, IMHO. ... | Stephan Diestelhorst | April 8, 2015, 1:43 p.m. | Open |
status should be 0 even, or could it still have the dirty flag set? the readable flag is essentially valid, ... | Andreas Hansson | May 7, 2015, 12:55 a.m. | Open |
Why is this MSHR needed? It was faked, was it not? | Andreas Hansson | May 7, 2015, 12:55 a.m. | Open |
potentially still dirty, or always came from "Exclusive", i.e. Readable | Writeable? | Andreas Hansson | May 7, 2015, 12:55 a.m. | Open |
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
the changed order of the write buffer allocation and dealing with the writebacks is important?
Great to see this functionality added. I am not 100% convinced of the way it is done, but perhaps there is no "neater" way of doing it. Especially the new creation of requests and packets is making me nervous. Who is deleting these?
Also, how does this interact with existing MSHRs? Targets and deferred targets? Similarly, now we fake an MSHR even if the block is present in the cache. Would it make sense to flush/downgrade somehow and then treat this like a miss?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
Spelling mistake.
Get the idea, but I am burnt when it comes to debugging request + packet deep copies.
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
Since I just spent a few good hours hunting memory allocation bugs... where will these get deallocated again? It is not obvious, so maybe chuck in a comment, here?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
Again.. I'd like to see a comment of where these guys (or the originals) are deallocated.
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
Why don't you break and drop the early_exit?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
This should really be:
if (!mshr.hasTargets())
and all the stuff below has too deep an (or two) indentation level, IMHO. I seriously consider goto an appropriate way to improve readability here.
Change Summary:
Updated to tip of tree. Fixed memory leak and spelling error.
Note that I had to remove the recently added 'const' modifier from the pkt field of the MSHR::Target object as part of the update. As mentioned in the comment, we really need to use the existing Packet object for the response and substitute in a dummy packet, since the former has the allocated data pointer for the response data. I tried the option of creating a new packet for the response, but there's no clean way to move an dynamically allocated data pointer from an existing packet to a new one. We could add methods to Packet to do this, but since it's all just to avoid removing 'const' from the pkt field, it seemed easier just to remove 'const'. If anyone has a better idea on how to handle this, I'm listening.
Diff: |
Revision 2 (+178 -45) |
---|
Change Summary:
This is an alternative version of the patch that uses a goto to narrow the scope of the early_exit flag and reduce indentation levels. I'm not necessarily replacing the prior patch with this one; I really just want to post two alternatives, and this seemed easier than creating a whole new patch to review. You probably want to focus just on the diff between this revision and the previous one.
Diff: |
Revision 3 (+149 -14) |
---|
I vote for the non-goto verison.
Is there really no way we can achieve this without the extra packets going back and forth? It seems the shortcircuiting we do with packets we should be able to do without them if we tapped in one level below the recvTimingReq/recvTimingResp.
-
src/mem/cache/cache_impl.hh (Diff revision 3) -
later on we test pkt->isLockedRMW and then read or write. Could we not do the same here rather and avoid looking at the actual command, i.e.
pkt->isLockedRMW() && pkt->isWrite()
-
src/mem/cache/cache_impl.hh (Diff revision 3) -
status should be 0 even, or could it still have the dirty flag set?
the readable flag is essentially valid, so here we invent a new state
Readable = 0
Dirty = ?
Writeable = 0Still the block is "valid".
This scares me a bit. Partly because the binary encoding of cache states is not that easy to follow, and partly because we now have MOESI + some new state.
-
src/mem/cache/cache_impl.hh (Diff revision 3) -
Why is this MSHR needed? It was faked, was it not?
-
src/mem/cache/cache_impl.hh (Diff revision 3) -
Is it safe to call this here and ignore the return value?
It would be nice if we do not assume that the response is always accepted.
Perhaps schedule an event and put it in a queue rather?
-
src/mem/cache/cache_impl.hh (Diff revision 3) -
potentially still dirty, or always came from "Exclusive", i.e. Readable | Writeable?
-
src/mem/packet.hh (Diff revision 3) -
Do we need the actual LockedRMW... or could if just be a flag on the existing read and write req/resp?
Change Summary:
This revision doesn't address any reviewer concerns, but it does update the old implementation to work with the latest tree (for those who are still downloading this manually). It may also fix a bug; there was a bug in one of our internal versions but I'm not sure if that bug made it out onto reviewboard or not.
Diff: |
Revision 4 (+192 -59) |
---|
Can you please update it?
It neither applies cleanly nor does it compile afterwards.
Change Summary:
Updated again to work with latest head (rev 11443:df24b9af42c7)
Description: |
|
||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+192 -59) |