Bus: Replace tickNextIdle and inRetry with a state variable
Review Request #1264 - Created June 8, 2012 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9079:cb20403fc3be --------------------------- Bus: Replace tickNextIdle and inRetry with a state variable This patch adds a state enum and member variable in the bus, tracking the bus state, thus eliminating the need for tickNextIdle and inRetry, and fixing an issue that allowed the bus to be occupied by multiple packets at once (hopefully it also makes it easier to understand the code). The bus, in its current form, uses tickNextIdle and inRetry to keep track of the state of the bus. However, it only updates tickNextIdle _after_ forwarding a packet using sendTiming, and the result is that the bus is still seen as idle, and a module that receives the packet and starts transmitting new packets in zero time will still see the bus as idle (and this is done by a number of DMA devices). The issue can also be seen in isOccupied where the bus calls reschedule on an event instead of schedule. This patch addresses the problem by marking the bus as _not_ idle already by the time we conclude that the bus is not occupied and we will deal with the packet. As a result of not allowing multiple packets to occupy the bus, some regressions have slight changes in their statistics. A separate patch updates these accordingly. Further ahead, a follow-on patch will introduce a separate state variable for request/responses/snoop responses, and thus implement a split request/response bus with separate flow control for the different message types (even further ahead it will introduce a multi-layer bus).
util/regress all passing (disregarding t1000 and eio) with a few exception that exhibit stat differences, e.g. 10.linux-boot/alpha/linux/tsunami-simple-timing with a magnitude of <0.4%, fs/10.linux-boot/arm/linux/realview-simple-timing with <0.01%, and 10.linux-boot/x86/linux/pc-simple-timing with a max magnitude of +38%(!)
Issue Summary
| Description | From | Last Updated | Status |
|---|---|---|---|
| It is right. in succeededTiming before the assert state == BUSY there is also an if block if (state == ... | Andreas Hansson | June 19, 2012, 11:41 p.m. | Open |
| It is required to know if the neighbouring module calls sendTiming in 0 time and we end up in "our ... | Andreas Hansson | June 19, 2012, 11:41 p.m. | Open |
| Done! | Andreas Hansson | June 19, 2012, 11:41 p.m. | Open |
Ship It!
-
src/mem/bus.cc (Diff revision 1) -
I strongly suggest that either a. the name of function isOccupied() be changed, or b. the code be organised in a different fashion. As is the normal practice, a function named isOccupied() should not change anything at all.
-
src/mem/bus.cc (Diff revision 1) -
This comment does not seem correct. In succeededTiming() there is an assert that state should be BUSY.
-
src/mem/bus.cc (Diff revision 1) -
From the implementation of recvRetry() below, it seems that this check is not required.
-
src/mem/bus.cc (Diff revision 1) -
You might want to remove the modulo operation here. You can replace the entire if block by -- now = ((now + clock - 1) / clock) * clock;
-
src/mem/bus.cc (Diff revision 1) -
It is right. in succeededTiming before the assert state == BUSY there is also an if block if (state == RETRY) :)
-
src/mem/bus.cc (Diff revision 1) -
It is required to know if the neighbouring module calls sendTiming in 0 time and we end up in "our own" recvTiming.
-
src/mem/bus.cc (Diff revision 1) -
Done!
-
src/mem/bus.cc (Diff revision 1) -
This assert also seems unnecessary. Whenever occupyBus() is called, either the state was set to or was asserted to be BUSY before the call.
-
src/mem/bus.cc (Diff revision 1) -
I am guessing the check here on state is also due to some future use.
-
src/mem/bus.cc (Diff revision 1) -
It can be removed. It used to be a separate if rather than else if. I'll prune it.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+143 -104) |
Thanks! Overall this is much clearer IMO. Sorry for the nit-picking.
-
src/mem/bus.hh (Diff revision 2) -
I think tryTiming() goes well with succeededTiming()/failedTiming()
-
src/mem/bus.cc (Diff revision 2) -
There's a divCeil() function in src/base/intmath.hh that can replace the first subexpression in this equation. I thought we had some utility functions for clocks that could replace this whole expression (didn't Nate do some work on this?) but I can't find them.
-
src/mem/bus.cc (Diff revision 2) -
Same comment here. We really should have a roundToNextMultiple() method, or better yet some cleaner way of dealing with clocks (again, I thought Nate had done some work on this). For now just using divCeil() is fine though.
-
src/mem/coherent_bus.cc (Diff revision 2) -
The logic here is just a bit confusing... in fact you don't want/need to call either failedTiming() or succeededTiming() on express snoops, but no explicit check is needed for the former because they can't fail. It would be nice for the control flow to be a little more symmetric. How about: if (!is_express_snoop) { if (success) { succeededTiming(...); } else { // existing fail case code } } or if you don't like the extra indentation: if (is_express_snoop) { assert(success); return true; } if (success) { succeededTiming(...); } else { // existing fail case code } in the latter version, you could even factor the return statements out and just put a "return success;" at the end.
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+163 -119) |
Ship It!
