gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::Drainable Class Referenceabstract

Interface for objects that might require draining before checkpointing. More...

#include <drain.hh>

Inheritance diagram for gem5::Drainable:
gem5::BaseXBar::Layer< ResponsePort, RequestPort > gem5::BaseXBar::Layer< RequestPort, ResponsePort > gem5::Queue< MSHR > gem5::Queue< WriteQueueEntry > gem5::ArchTimer gem5::BasePixelPump::PixelEvent gem5::BaseXBar::Layer< SrcType, DstType > gem5::CopyEngine::CopyEngineChannel gem5::DistIface gem5::DmaCallback gem5::DmaPort gem5::DmaReadFifo gem5::PacketQueue gem5::Queue< Entry > gem5::SimObject

Public Member Functions

DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 

Protected Member Functions

 Drainable ()
 
virtual ~Drainable ()
 
virtual DrainState drain ()=0
 Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.
 
virtual void drainResume ()
 Resume execution after a successful drain.
 
void signalDrainDone () const
 Signal that an object is drained.
 

Private Member Functions

DrainState dmDrain ()
 DrainManager interface to request a drain operation.
 
void dmDrainResume ()
 DrainManager interface to request a resume operation.
 

Private Attributes

DrainManager_drainManager
 Convenience reference to the drain manager.
 
DrainState _drainState
 Current drain state of the object.
 

Friends

class DrainManager
 This class coordinates draining of a System.
 

Detailed Description

Interface for objects that might require draining before checkpointing.

An object's internal state needs to be drained when creating a checkpoint, switching between CPU models, or switching between timing models. Once the internal state has been drained from all objects in the simulator, the objects are serialized to disc or the configuration change takes place. The process works as follows (see simulate.py for details):

  1. DrainManager::tryDrain() calls Drainable::drain() for every object in the system. Draining has completed if all of them return true. Otherwise, the drain manager keeps track of the objects that requested draining and waits for them to signal that they are done draining using the signalDrainDone() method.

  2. Continue simulation. When an object has finished draining its internal state, it calls DrainManager::signalDrainDone() on the manager. The drain manager keeps track of the objects that haven't drained yet, simulation stops when the set of non-drained objects becomes empty.

  3. Check if any object still needs draining (DrainManager::tryDrain()), if so repeat the process above.

  4. Serialize objects, switch CPU model, or change timing model.

  5. Call DrainManager::resume(), which in turn calls Drainable::drainResume() for all objects, and then continue the simulation.

Definition at line 234 of file drain.hh.

Constructor & Destructor Documentation

◆ Drainable()

gem5::Drainable::Drainable ( )
protected

Definition at line 197 of file drain.cc.

References _drainManager, and gem5::DrainManager::registerDrainable().

◆ ~Drainable()

gem5::Drainable::~Drainable ( )
protectedvirtual

Definition at line 204 of file drain.cc.

References _drainManager, and gem5::DrainManager::unregisterDrainable().

Member Function Documentation

◆ dmDrain()

DrainState gem5::Drainable::dmDrain ( )
private

DrainManager interface to request a drain operation.

Definition at line 210 of file drain.cc.

References _drainState, drain(), gem5::Drained, and gem5::Draining.

◆ dmDrainResume()

void gem5::Drainable::dmDrainResume ( )
private

DrainManager interface to request a resume operation.

Definition at line 221 of file drain.cc.

References _drainState, gem5::Drained, drainResume(), panic_if, gem5::Resuming, and gem5::Running.

Friends And Related Symbol Documentation

◆ DrainManager

friend class DrainManager
friend

This class coordinates draining of a System.

When draining the simulator, we need to make sure that all Drainable objects within the system have ended up in the drained state before declaring the operation to be successful. This class keeps track of how many objects are still in the process of draining. Once it determines that all objects have drained their state, it exits the simulation loop.

Note
A System might not be completely drained even though the DrainManager has caused the simulation loop to exit. Draining needs to be restarted until all Drainable objects declare that they don't need further simulation to be completely drained. See Drainable for more information.

Definition at line 252 of file drain.hh.

Member Data Documentation

◆ _drainManager

DrainManager& gem5::Drainable::_drainManager
private

Convenience reference to the drain manager.

Definition at line 353 of file drain.hh.

Referenced by Drainable(), signalDrainDone(), and ~Drainable().

◆ _drainState

DrainState gem5::Drainable::_drainState
mutableprivate

Current drain state of the object.

Needs to be mutable since objects need to be able to signal that they have transitioned into a Drained state even if the calling method is const.

Definition at line 360 of file drain.hh.

Referenced by dmDrain(), dmDrainResume(), drainState(), and signalDrainDone().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:10 for gem5 by doxygen 1.11.0