[rtems-testing commit] sim-scripts: Add initial support for specifying number of cores

Joel Sherrill joel at rtems.org
Wed May 29 20:38:54 UTC 2013


Module:    rtems-testing
Branch:    master
Commit:    4856251217b0c51f50c9fc508f51a7cbf7984e1c
Changeset: http://git.rtems.org/rtems-testing/commit/?id=4856251217b0c51f50c9fc508f51a7cbf7984e1c

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Wed May 29 15:24:31 2013 -0500

sim-scripts: Add initial support for specifying number of cores

Attempted to add support to pc386 (untested).

---

 sim-scripts/gdb-sim-run.in |   28 ++++++++++++++++++++++++----
 sim-scripts/pc386.in       |   13 ++++++++++---
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/sim-scripts/gdb-sim-run.in b/sim-scripts/gdb-sim-run.in
index 9da325d..1870b0a 100755
--- a/sim-scripts/gdb-sim-run.in
+++ b/sim-scripts/gdb-sim-run.in
@@ -29,13 +29,14 @@ USAGE=\
 	-N	   -- enable use of network adapter (default=no)
 	-G	   -- put simulator in GDB server mode (default=no)
 	-i	   -- interactive (default=no time limit)
+	-p cores   -- number of cores for SMP (default=1)
 	-s	   -- force System V IPC support (default=no)
 	-S	   -- skip Interrupt Critical Section Tests (default=no)
         -l limit   -- specify time limit (default is 'BSP dependent')
         -L dir     -- specify log directory (default is 'log')
-        -T         -- rtems-test command mode
 
 NOTES:
+  + Most simulators do not support multicore support.
   + System V IPC and Coverage are not supported by all BSPs or simulators.
   + GDB Server mode is only supported by stand-along simulators.
   + When you generate a device tree and exit, remember to specify an
@@ -86,10 +87,10 @@ logdir="log"
 doTrace="no"
 enable_display_adapter="no"
 enable_network="no"
-rtems_test="no"
 skip_interrupt_critical_section_tests="no"
+number_of_cores=1
 
-while getopts "vcCgGil:L:DsNT" OPT
+while getopts "vcCgGil:L:p:DsNT" OPT
 do
  case "$OPT" in
    v) verbose="yes";;
@@ -102,10 +103,10 @@ do
    i) interactive="yes";;
    l) defaultLimit="$OPTARG";;
    L) logdir="$OPTARG";;
+   p) number_of_cores="$OPTARG";;
    s) use_sysv_ipc="yes";;
    S) skip_interrupt_critical_section_tests="yes";;
    t) doTrace="yes";;
-   T) rtems_test="yes";;
    *) fatal;;
  esac
 done
@@ -115,6 +116,18 @@ shift $shiftcount
 
 args=$*
 
+case ${number_of_cores} in
+  [1-9]) ;;
+  0)
+    echo "Zero cores does not make sense"
+    exit 1
+    ;;
+  *)  
+    echo "Cores specified (${number_of_cores}) is either not a valid"
+    echo "  number or supported quantity."
+    exit 1
+esac 
+
 if [ ${interactive} = "yes" ] ; then
   defaultLimit=0
 else
@@ -138,6 +151,7 @@ bspRunsFailRandomly="no"
 bspInputDevice=/dev/console
 bspRedirectInput=no
 bspSkipInterruptCriticalSectionTests="no"
+bspSupportsSMP="no"
 
 for v in 4.11 4.10 4.9 4.8 4.7 ""
 do
@@ -168,12 +182,18 @@ if [ ${bspSupportsNIC} = "no" -a ${enable_network} = "yes"  ]; then
   echo "Simulator does not support a Network Interface Controller."
   exit 1
 fi
+
 if [ ${bspSupportsDisplayAdapter} = "no" -a \
      ${enable_display_adapter} = "yes"  ]; then
   echo "Simulator does not support Graphics Display Adapter."
   exit 1
 fi
 
+if [ ${bspSupportsSMP} = "no" -a ${number_of_cores} != 1 ] ; then
+  echo "Simulator does not support multiple cores."
+  exit 1
+fi
+
 if [ X${runBSP} = X ] ; then
   echo "Unable to find a way to run @CPU_TARGET@/@BSP@"
   exit 1
diff --git a/sim-scripts/pc386.in b/sim-scripts/pc386.in
index 40998c0..d0c4472 100644
--- a/sim-scripts/pc386.in
+++ b/sim-scripts/pc386.in
@@ -3,6 +3,7 @@
 #
 
 bspUsesGDBSimulator="no"
+bspSupportsSMP="yes"
 runBSP=NOT_OVERRIDDEN
 if [ ! -r ${runBSP} ] ; then
   runBSP=notset
@@ -75,9 +76,15 @@ runARGS()
   else
      GRAPHIC_ARG="-vga cirrus"
   fi
-# core2duo with newer qemu for smp support
-# 486 or pentium for older qemu
-  echo "-m 512 -boot a -cpu 486 \
+
+  # core2duo with newer qemu for SMP support
+  # 486 or pentium for non-SMP
+  if [ ${number_of_cores} = 1 ] ; then
+    CPUARGS="-cpu 486"
+  else
+    CPUARGS="-cpu core2duo -smp ${number_of_cores}"
+  fi
+  echo "-m 512 -boot a ${CPUARGS} \
        -fda ${fd0Image} -hda fat:${hd0Dir} ${COVERAGE_ARG} \
        -monitor null ${GRAPHIC_ARG} -serial ${SERIAL_ARG} --no-reboot"
 }




More information about the vc mailing list