sim: Fix Mempool overrides during checkpoint
This patch fixes the problem during checkpoing where the mempool is not restored, but using only the one specified in the config file as a new execution. In order to fix that this changes modifyies the serialize/unserialize functions for mempools and create new funcionts on se_workload to make sure mempools ends up in the m5.cpt. We change as well the unserialize mempool function to update according the checkpoint file so the execution starts with the same free pages and free pointers. JIRA: https://gem5.atlassian.net/browse/GEM5-1191 Change-Id: I289bf91eb4f01d9c01a31a39b968e30f8b8d2bdc Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/56969 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -169,6 +169,7 @@ MemPools::freeMemSize(int pool_id) const
|
||||
void
|
||||
MemPools::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
ScopedCheckpointSection sec(cp, "mempools");
|
||||
int num_pools = pools.size();
|
||||
SERIALIZE_SCALAR(num_pools);
|
||||
|
||||
@@ -179,6 +180,10 @@ MemPools::serialize(CheckpointOut &cp) const
|
||||
void
|
||||
MemPools::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
// Delete previous mem_pools
|
||||
pools.clear();
|
||||
|
||||
ScopedCheckpointSection sec(cp, "mempools");
|
||||
int num_pools = 0;
|
||||
UNSERIALIZE_SCALAR(num_pools);
|
||||
|
||||
|
||||
@@ -388,6 +388,7 @@ Process::unserialize(CheckpointIn &cp)
|
||||
memState->unserialize(cp);
|
||||
pTable->unserialize(cp);
|
||||
fds->unserialize(cp);
|
||||
|
||||
/**
|
||||
* Checkpoints for pipes, device drivers or sockets currently
|
||||
* do not work. Need to come back and fix them at a later date.
|
||||
|
||||
@@ -53,6 +53,18 @@ SEWorkload::setSystem(System *sys)
|
||||
memPools.populate(memories);
|
||||
}
|
||||
|
||||
void
|
||||
SEWorkload::serialize(CheckpointOut &cp) const
|
||||
{
|
||||
memPools.serialize(cp);
|
||||
}
|
||||
|
||||
void
|
||||
SEWorkload::unserialize(CheckpointIn &cp)
|
||||
{
|
||||
memPools.unserialize(cp);
|
||||
}
|
||||
|
||||
void
|
||||
SEWorkload::syscall(ThreadContext *tc)
|
||||
{
|
||||
|
||||
@@ -81,6 +81,9 @@ class SEWorkload : public Workload
|
||||
panic("No workload symbol table for syscall emulation mode.");
|
||||
}
|
||||
|
||||
void serialize(CheckpointOut &cp) const override;
|
||||
void unserialize(CheckpointIn &cp) override;
|
||||
|
||||
void syscall(ThreadContext *tc) override;
|
||||
|
||||
// For now, assume the only type of events are system calls.
|
||||
|
||||
Reference in New Issue
Block a user