[gem5-dev] Change in gem5/gem5[develop]: sim: Add checkpoint parameters for VMA list

2020-08-06 Thread Ian Jiang (Gerrit) via gem5-dev
Ian Jiang has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/31875 )


Change subject: sim: Add checkpoint parameters for VMA list
..

sim: Add checkpoint parameters for VMA list

Add checkpoint parameters (together with corresponding serialization
and unserialization) for VMA list of class MemState into a separate
section named 'vmalist'.

Without these VMA list parameters, a page table fault will occur when
running with --restore-simpoint-checkpoint, because of an empty VMA
list. For example:

  $ ./build/RISCV/gem5.debug --debug-flags=Exec configs/example/se.py \
  -c tests/test-progs/hello/bin/riscv/linux/hello \
  --cpu-type=NonCachingSimpleCPU --restore-simpoint-checkpoint \
  --checkpoint-dir m5out/ -r 2
  ...
  2404000: system.switch_cpus: T0 : @_int_malloc+3392: sd a5, 8(a0) \
  : MemWrite :  D=0x0001ed21 A=0x862e8
  panic: Page table fault when accessing virtual address 0x862e8
  ...

Example checkpoint output:

  [system.cpu.workload.vmalist]
  size=3

  [system.cpu.workload.vmalist.Vma0]
  name=stack
  addrRangeStart=...
  addrRangeEnd=...

  [system.cpu.workload.vmalist.Vma1]
  name=heap
  addrRangeStart=...
  addrRangeEnd=...

  [system.cpu.workload.vmalist.Vma2]
  ...

Change-Id: Ib2fa7ad2c34fe667ce95bc4b10a1affcf60d9c1f
Signed-off-by: Ian Jiang 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31875
Reviewed-by: Daniel Carvalho 
Reviewed-by: Bobby R. Bruce 
Reviewed-by: Alexandru Duțu 
Maintainer: Jason Lowe-Power 
Tested-by: kokoro 
---
M src/sim/mem_state.hh
1 file changed, 25 insertions(+), 0 deletions(-)

Approvals:
  Alexandru Duțu: Looks good to me, approved
  Daniel Carvalho: Looks good to me, but someone else must approve
  Bobby R. Bruce: Looks good to me, approved
  Jason Lowe-Power: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/sim/mem_state.hh b/src/sim/mem_state.hh
index 1ca80da..c052389 100644
--- a/src/sim/mem_state.hh
+++ b/src/sim/mem_state.hh
@@ -190,7 +190,18 @@
 paramOut(cp, "stackMin", _stackMin);
 paramOut(cp, "nextThreadStackBase", _nextThreadStackBase);
 paramOut(cp, "mmapEnd", _mmapEnd);
+
+ScopedCheckpointSection sec(cp, "vmalist");
+paramOut(cp, "size", _vmaList.size());
+int count = 0;
+for (auto vma : _vmaList) {
+ScopedCheckpointSection sec(cp, csprintf("Vma%d", count++));
+paramOut(cp, "name", vma.getName());
+paramOut(cp, "addrRangeStart", vma.start());
+paramOut(cp, "addrRangeEnd", vma.end());
+}
 }
+
 void
 unserialize(CheckpointIn ) override
 {
@@ -201,6 +212,20 @@
 paramIn(cp, "stackMin", _stackMin);
 paramIn(cp, "nextThreadStackBase", _nextThreadStackBase);
 paramIn(cp, "mmapEnd", _mmapEnd);
+
+int count;
+ScopedCheckpointSection sec(cp, "vmalist");
+paramIn(cp, "size", count);
+for (int i = 0; i < count; ++i) {
+ScopedCheckpointSection sec(cp, csprintf("Vma%d", i));
+std::string name;
+Addr start;
+Addr end;
+paramIn(cp, "name", name);
+paramIn(cp, "addrRangeStart", start);
+paramIn(cp, "addrRangeEnd", end);
+_vmaList.emplace_back(AddrRange(start, end), _pageBytes, name);
+}
 }

 /**

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/31875
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib2fa7ad2c34fe667ce95bc4b10a1affcf60d9c1f
Gerrit-Change-Number: 31875
Gerrit-PatchSet: 3
Gerrit-Owner: Ian Jiang 
Gerrit-Reviewer: Alexandru Duțu 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Ian Jiang 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: sim: Add checkpoint parameters for VMA list

2020-07-28 Thread Ian Jiang (Gerrit) via gem5-dev
Ian Jiang has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/31875 )



Change subject: sim: Add checkpoint parameters for VMA list
..

sim: Add checkpoint parameters for VMA list

Add checkpoint parameters (together with corresponding serialization
and unserialization) for VMA list of class MemState into a separate
section named 'vmalist'.

Without these VMA list parameters, a page table fault will occur when
running with --restore-simpoint-checkpoint, because of an empty VMA
list. For example:

  $ ./build/RISCV/gem5.debug --debug-flags=Exec configs/example/se.py \
  -c tests/test-progs/hello/bin/riscv/linux/hello \
  --cpu-type=NonCachingSimpleCPU --restore-simpoint-checkpoint \
  --checkpoint-dir m5out/ -r 2
  ...
  2404000: system.switch_cpus: T0 : @_int_malloc+3392: sd a5, 8(a0) \
  : MemWrite :  D=0x0001ed21 A=0x862e8
  panic: Page table fault when accessing virtual address 0x862e8
  ...

Example checkpoint output:

  [system.cpu.workload.vmalist]
  size=3

  [system.cpu.workload.vmalist.Vma0]
  vmaName=stack
  addrRangeStart=...
  addrRangeEnd=...

  [system.cpu.workload.vmalist.Vma1]
  vmaName=heap
  addrRangeStart=...
  addrRangeEnd=...

  [system.cpu.workload.vmalist.Vma2]
  ...

Change-Id: Ib2fa7ad2c34fe667ce95bc4b10a1affcf60d9c1f
Signed-off-by: Ian Jiang 
---
M src/sim/mem_state.hh
1 file changed, 25 insertions(+), 0 deletions(-)



diff --git a/src/sim/mem_state.hh b/src/sim/mem_state.hh
index 1ca80da..bb4fab3 100644
--- a/src/sim/mem_state.hh
+++ b/src/sim/mem_state.hh
@@ -190,7 +190,18 @@
 paramOut(cp, "stackMin", _stackMin);
 paramOut(cp, "nextThreadStackBase", _nextThreadStackBase);
 paramOut(cp, "mmapEnd", _mmapEnd);
+
+ScopedCheckpointSection sec(cp, csprintf("vmalist"));
+paramOut(cp, "size", _vmaList.size());
+int count = 0;
+for (auto vma : _vmaList) {
+ScopedCheckpointSection sec(cp, csprintf("Vma%d", count++));
+paramOut(cp, "vmaName", vma.getName());
+paramOut(cp, "addrRangeStart", vma.start());
+paramOut(cp, "addrRangeEnd", vma.end());
+}
 }
+
 void
 unserialize(CheckpointIn ) override
 {
@@ -201,6 +212,20 @@
 paramIn(cp, "stackMin", _stackMin);
 paramIn(cp, "nextThreadStackBase", _nextThreadStackBase);
 paramIn(cp, "mmapEnd", _mmapEnd);
+
+int count;
+ScopedCheckpointSection sec(cp, csprintf("vmalist"));
+paramIn(cp, "size", count);
+for (int i = 0; i < count; ++i) {
+ScopedCheckpointSection sec(cp, csprintf("Vma%d", i));
+std::string name;
+Addr start;
+Addr end;
+paramIn(cp, "vmaName", name);
+paramIn(cp, "addrRangeStart", start);
+paramIn(cp, "addrRangeEnd", end);
+_vmaList.emplace_back(AddrRange(start, end), _pageBytes, name);
+}
 }

 /**

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/31875
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ib2fa7ad2c34fe667ce95bc4b10a1affcf60d9c1f
Gerrit-Change-Number: 31875
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Jiang 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s