[gem5-dev] Change in gem5/gem5[develop]: dev-arm: Verify number of CPUs when restoring Generic Timer Cpts.

2020-07-07 Thread Richard Cooper (Gerrit) via gem5-dev
Richard Cooper has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/30576 )


Change subject: dev-arm: Verify number of CPUs when restoring Generic Timer  
Cpts.

..

dev-arm: Verify number of CPUs when restoring Generic Timer Cpts.

When restoring a checkpoint containing a generic timer, the checkpoint
expects to connect the timer to the same number of CPUs that were
present when the checkpoint was taken. If the number of CPUs in the
new simulation is different, deserialization will fail. In the case
that the number of CPUs expected by the checkpoint is greater than the
number of CPUs present, this will cause a segmentation fault caused by
reading off the end of the list of Thread Contexts.

This commit fixes the problem by checking the number of CPUs present
in the simulation matches the number of CPUs expected by the generic
timer checkpoint. If there is a mismatch, a fatal error is triggered
with an informative message to the user.

Change-Id: Iff9ad68d64e67b3df51682b7e4e272e5f355bcd6
Reviewed-by: Giacomo Travaglini 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30576
Tested-by: kokoro 
Maintainer: Giacomo Travaglini 
---
M src/dev/arm/generic_timer.cc
1 file changed, 7 insertions(+), 0 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/dev/arm/generic_timer.cc b/src/dev/arm/generic_timer.cc
index 4f92dac..1b75728 100644
--- a/src/dev/arm/generic_timer.cc
+++ b/src/dev/arm/generic_timer.cc
@@ -415,6 +415,13 @@
 cpu_count = OLD_CPU_MAX;
 }

+if (cpu_count != system.threads.size()) {
+fatal("The simulated system has been initialized with %d CPUs, "
+  "but the Generic Timer checkpoint expects %d CPUs. Consider "
+  "restoring the checkpoint specifying %d CPUs.",
+  system.threads.size(), cpu_count, cpu_count);
+}
+
 for (int i = 0; i < cpu_count; ++i) {
 CoreTimers (getTimers(i));
 core.unserializeSection(cp, csprintf("pe_implementation%d", i));

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/30576
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: Iff9ad68d64e67b3df51682b7e4e272e5f355bcd6
Gerrit-Change-Number: 30576
Gerrit-PatchSet: 4
Gerrit-Owner: Richard Cooper 
Gerrit-Reviewer: Giacomo Travaglini 
Gerrit-Reviewer: Richard Cooper 
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]: dev-arm: Verify number of CPUs when restoring Generic Timer Cpts.

2020-06-24 Thread Richard Cooper (Gerrit) via gem5-dev

Hello Giacomo Travaglini,

I'd like you to do a code review. Please visit

https://gem5-review.googlesource.com/c/public/gem5/+/30576

to review the following change.


Change subject: dev-arm: Verify number of CPUs when restoring Generic Timer  
Cpts.

..

dev-arm: Verify number of CPUs when restoring Generic Timer Cpts.

When restoring a checkpoint containing a generic timer, the checkpoint
expects to connect the timer to the same number of CPUs that were
present when the checkpoint was taken. If the number of CPUs in the
new simulation is different, deserialization will fail. In the case
that the number of CPUs expected by the checkpoint is greater than the
number of CPUs present, this will cause a segmentation fault caused by
reading off the end of the list of Thread Contexts.

This commit fixes the problem by checking the number of CPUs present
in the simulation matches the number of CPUs expected by the generic
timer checkpoint. If there is a mismatch, a fatal error is triggered
with an informative message to the user.

Change-Id: Iff9ad68d64e67b3df51682b7e4e272e5f355bcd6
Reviewed-by: Giacomo Travaglini 
---
M src/dev/arm/generic_timer.cc
1 file changed, 7 insertions(+), 0 deletions(-)



diff --git a/src/dev/arm/generic_timer.cc b/src/dev/arm/generic_timer.cc
index 4f92dac..1701ccd 100644
--- a/src/dev/arm/generic_timer.cc
+++ b/src/dev/arm/generic_timer.cc
@@ -415,6 +415,13 @@
 cpu_count = OLD_CPU_MAX;
 }

+if (cpu_count != system.numContexts()) {
+fatal("The simulated system has been initialized with %d CPUs, "
+  "but the Generic Timer checkpoint expects %d CPUs. Consider "
+  "restoring the checkpoint specifying %d CPUs.",
+  system.numContexts(), cpu_count, cpu_count);
+}
+
 for (int i = 0; i < cpu_count; ++i) {
 CoreTimers (getTimers(i));
 core.unserializeSection(cp, csprintf("pe_implementation%d", i));

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/30576
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: Iff9ad68d64e67b3df51682b7e4e272e5f355bcd6
Gerrit-Change-Number: 30576
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Cooper 
Gerrit-Reviewer: Giacomo Travaglini 
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