sim: Refactor and simplify the drain API
Review Request #2875 - Created June 8, 2015 and submitted
| Information | |
|---|---|
| Andreas Sandberg | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10886:4969b5772d13 --------------------------- sim: Refactor and simplify the drain API The drain() call currently passes around a DrainManager pointer, which is now completely pointless since there is only ever one global DrainManager in the system. It also contains vestiges from the time when SimObjects had to keep track of their child objects that needed draining. This changeset moves all of the DrainState handling to the Drainable base class and changes the drain() and drainResume() calls to reflect this. Particularly, the drain() call has been updated to take no parameters (the DrainManager argument isn't needed) and return a DrainState instead of an unsigned integer (there is no point returning anything other than 0 or 1 any more). Drainable objects should return either DrainState::Draining (equivalent to returning 1 in the old system) if they need more time to drain or DrainState::Drained (equivalent to returning 0 in the old system) if they are already in a consistent state. Returning DrainState::Running is considered an error. Drain done signalling is now done through the signalDrainDone() method in the Drainable class instead of using the DrainManager directly. The new call checks if the state of the object is DrainState::Draining before notifying the drain manager. This means that it is safe to call signalDrainDone() without first checking if the simulator has requested draining. The intention here is to reduce the code needed to implement draining in simple objects.
Regressions pass. Minor stats difference (due to changes in drain call order) in one of the pc switcheroo tests.
-
src/dev/dma_device.cc (Diff revision 1) -
Check drainState() == Draining?
-
src/dev/i8254xGBe.cc (Diff revision 1) -
We can drop the true &&.
-
src/dev/i8254xGBe.cc (Diff revision 1) -
Same as above.
-
src/dev/i8254xGBe.cc (Diff revision 1) -
Same as above.
-
src/mem/dramsim2.cc (Diff revision 1) -
Check drainState == draining?
-
src/mem/dramsim2.cc (Diff revision 1) -
Same as above.
-
src/mem/ruby/system/RubyPort.cc (Diff revision 1) -
drainState() == Draining
-
src/mem/simple_mem.cc (Diff revision 1) -
drainState() == Draining
-
src/mem/simple_mem.cc (Diff revision 1) -
Correct the spelling here? Draining not drainng
-
src/sim/drain.hh (Diff revision 1) -
I think there is slight incorrect grammar here. May be replace "consequently be stop being drained" with "consequently may need to be drained again."
-
src/sim/drain.cc (Diff revision 1) -
This seems strange. Should this not be _drainState = DrainState::Draining.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+343 -543) |
Ship It!
See my comments on 2874.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+344 -536) |
Ship It!
