diff options
Diffstat (limited to 'schedsim/shell')
-rw-r--r-- | schedsim/shell/schedsim_smppriority/Makefile.am | 1 | ||||
-rw-r--r-- | schedsim/shell/schedsim_smppriority_affinity/Makefile.am | 1 | ||||
-rw-r--r-- | schedsim/shell/schedsim_smpsimple/Makefile.am | 1 | ||||
-rw-r--r-- | schedsim/shell/schedsim_smpsimple/add_commands.c | 9 | ||||
-rw-r--r-- | schedsim/shell/shared/Makefile.am | 1 | ||||
-rw-r--r-- | schedsim/shell/shared/commands.c | 3 | ||||
-rw-r--r-- | schedsim/shell/shared/main_dump_all_cpus.c | 49 | ||||
-rw-r--r-- | schedsim/shell/shared/main_taskcreate.c | 15 |
8 files changed, 62 insertions, 18 deletions
diff --git a/schedsim/shell/schedsim_smppriority/Makefile.am b/schedsim/shell/schedsim_smppriority/Makefile.am index 28ec6cf..4596b85 100644 --- a/schedsim/shell/schedsim_smppriority/Makefile.am +++ b/schedsim/shell/schedsim_smppriority/Makefile.am @@ -4,7 +4,6 @@ SOURCES = config.c SOURCES += $(srcdir)/../schedsim_smpsimple/add_commands.c SOURCES += $(srcdir)/../schedsim_smpsimple/main_current_cpu.c SOURCES += $(srcdir)/../schedsim_smpsimple/main_dispatch.c -SOURCES += $(srcdir)/../schedsim_smpsimple/main_dump_all_cpus.c SOURCES += $(srcdir)/../schedsim_smpsimple/main_dump_ready_tasks.c SOURCES += $(srcdir)/../schedsim_smpsimple/printheir_executing.c SOURCES += $(srcdir)/../schedsim_smpsimple/smp_stub.c diff --git a/schedsim/shell/schedsim_smppriority_affinity/Makefile.am b/schedsim/shell/schedsim_smppriority_affinity/Makefile.am index 1c65cf2..7f25c34 100644 --- a/schedsim/shell/schedsim_smppriority_affinity/Makefile.am +++ b/schedsim/shell/schedsim_smppriority_affinity/Makefile.am @@ -4,7 +4,6 @@ SOURCES = config.c SOURCES += $(srcdir)/../schedsim_smpsimple/add_commands.c SOURCES += $(srcdir)/../schedsim_smpsimple/main_current_cpu.c SOURCES += $(srcdir)/../schedsim_smpsimple/main_dispatch.c -SOURCES += $(srcdir)/../schedsim_smpsimple/main_dump_all_cpus.c SOURCES += $(srcdir)/../schedsim_smpsimple/main_dump_ready_tasks.c SOURCES += $(srcdir)/../schedsim_smpsimple/printheir_executing.c SOURCES += $(srcdir)/../schedsim_smpsimple/smp_stub.c diff --git a/schedsim/shell/schedsim_smpsimple/Makefile.am b/schedsim/shell/schedsim_smpsimple/Makefile.am index 48902b9..a931b05 100644 --- a/schedsim/shell/schedsim_smpsimple/Makefile.am +++ b/schedsim/shell/schedsim_smpsimple/Makefile.am @@ -4,7 +4,6 @@ schedsim_smpsimple_SOURCES += add_commands.c schedsim_smpsimple_SOURCES += config.c schedsim_smpsimple_SOURCES += main_current_cpu.c schedsim_smpsimple_SOURCES += main_dispatch.c -schedsim_smpsimple_SOURCES += main_dump_all_cpus.c schedsim_smpsimple_SOURCES += main_dump_ready_tasks.c schedsim_smpsimple_SOURCES += printheir_executing.c schedsim_smpsimple_SOURCES += smp_stub.c diff --git a/schedsim/shell/schedsim_smpsimple/add_commands.c b/schedsim/shell/schedsim_smpsimple/add_commands.c index e95f395..ad1dde2 100644 --- a/schedsim/shell/schedsim_smpsimple/add_commands.c +++ b/schedsim/shell/schedsim_smpsimple/add_commands.c @@ -18,7 +18,6 @@ #include "rtems_sched.h" extern int main_dump_ready_tasks(int argc, char **argv); -extern int main_dump_all_cpus(int argc, char **argv); extern int main_set_current_cpu(int argc, char **argv); extern int main_dispatch(int argc, char **argv); @@ -35,14 +34,6 @@ void add_commands(void) assert( cmd ); cmd = rtems_shell_add_cmd( - "cpus", - "rtems", - "no args", - main_dump_all_cpus - ); - assert( cmd ); - - cmd = rtems_shell_add_cmd( "current_cpu", "rtems", "number", diff --git a/schedsim/shell/shared/Makefile.am b/schedsim/shell/shared/Makefile.am index 85b58af..eb41f4f 100644 --- a/schedsim/shell/shared/Makefile.am +++ b/schedsim/shell/shared/Makefile.am @@ -28,6 +28,7 @@ libschedsim_a_SOURCES += commands.c libschedsim_a_SOURCES += getopt.c libschedsim_a_SOURCES += lookup_semaphore.c libschedsim_a_SOURCES += lookup_task.c +libschedsim_a_SOURCES += main_dump_all_cpus.c libschedsim_a_SOURCES += main_echo.c libschedsim_a_SOURCES += main_executing.c libschedsim_a_SOURCES += main_heir.c diff --git a/schedsim/shell/shared/commands.c b/schedsim/shell/shared/commands.c index 0c5ae48..7132841 100644 --- a/schedsim/shell/shared/commands.c +++ b/schedsim/shell/shared/commands.c @@ -30,7 +30,6 @@ extern rtems_shell_cmd_t rtems_shell_TASK_WAKE_AFTER_Command; extern rtems_shell_cmd_t rtems_shell_CLOCK_TICK_Command; - extern rtems_shell_cmd_t rtems_shell_SEMAPHORE_CREATE_Command; extern rtems_shell_cmd_t rtems_shell_SEMAPHORE_DELETE_Command; extern rtems_shell_cmd_t rtems_shell_SEMAPHORE_OBTAIN_Command; @@ -39,6 +38,7 @@ extern rtems_shell_cmd_t rtems_shell_SEMAPHORE_FLUSH_Command; extern rtems_shell_cmd_t rtems_shell_TASK_EXECUTING_Command; extern rtems_shell_cmd_t rtems_shell_TASK_HEIR_Command; +extern rtems_shell_cmd_t rtems_shell_CPUS_Command; rtems_shell_cmd_t *rtems_shell_Initial_commands[] = { /* Generic Commands */ @@ -70,6 +70,7 @@ rtems_shell_cmd_t *rtems_shell_Initial_commands[] = { /* RTEMS Helper Commands */ &rtems_shell_TASK_EXECUTING_Command, &rtems_shell_TASK_HEIR_Command, + &rtems_shell_CPUS_Command, NULL }; diff --git a/schedsim/shell/shared/main_dump_all_cpus.c b/schedsim/shell/shared/main_dump_all_cpus.c index dfe3bc6..1c141e1 100644 --- a/schedsim/shell/shared/main_dump_all_cpus.c +++ b/schedsim/shell/shared/main_dump_all_cpus.c @@ -15,8 +15,8 @@ #include "shell.h" #include "rtems_sched.h" +#include "schedsim_shell.h" -// #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ #include <rtems.h> #include <rtems/score/percpu.h> #include <rtems/score/smp.h> @@ -28,12 +28,14 @@ int main_dump_all_cpus(int argc, char **argv) Thread_Control *h; Thread_Control *i; Thread_Control *e; + rtems_id id; + bool mismatch; printf( "=== CPU Status\n" " EXECUTING / HEIR / SWITCH NEEDED\n" ); - for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) { + for ( cpu=0 ; cpu < rtems_get_processor_count() ; cpu++ ) { e = _Per_CPU_Information[cpu].per_cpu.executing; h = _Per_CPU_Information[cpu].per_cpu.heir; printf( @@ -47,5 +49,48 @@ int main_dump_all_cpus(int argc, char **argv) } printf( "=== End of Ready Set of Threads\n" ); + /* + * If no arguments, then we were not requested to verify task placement. + */ + if ( argc == 1 ) + return 0; + + /* + * Now verify the thread on each processor. + */ + mismatch = false; + for ( cpu=0 ; cpu < rtems_get_processor_count() ; cpu++ ) { + e = _Per_CPU_Information[cpu].per_cpu.executing; + + if ( argv[cpu + 1][ 0 ] == '-' ) + continue; + + if ( lookup_task( argv[cpu + 1], &id ) ) + return -1; + + if ( e->Object.id != id ) { + mismatch = true; + printf( + "*** ERROR on CPU %d Expected 0x%08x found 0x%08x executing\n", + cpu, + id, + e->Object.id + ); + } + } + if ( mismatch ) { + printf( "Exiting test scenario due to scheduling failure\n" ); + exit( 1 ); + } + return 0; } + +rtems_shell_cmd_t rtems_shell_CPUS_Command = { + "cpus", /* name */ + "cpus [tasks expected on cores]", /* usage */ + "rtems", /* topic */ + main_dump_all_cpus, /* command */ + NULL, /* alias */ + NULL /* next */ +}; diff --git a/schedsim/shell/shared/main_taskcreate.c b/schedsim/shell/shared/main_taskcreate.c index 8bd8819..6f82092 100644 --- a/schedsim/shell/shared/main_taskcreate.c +++ b/schedsim/shell/shared/main_taskcreate.c @@ -13,8 +13,10 @@ #include "config.h" #endif +#if defined(RTEMS_SMP) #define _GNU_SOURCE #include <sys/cpuset.h> +#endif #include <stdio.h> @@ -62,18 +64,20 @@ int rtems_shell_main_task_create( char option; int arg; unsigned long affinity; +#if defined(RTEMS_SMP) cpu_set_t cpuset; - bool do_affinity; + bool do_affinity = false; +#endif CHECK_RTEMS_IS_UP(); mode = 0; mask = 0; - do_affinity = false; memset(&getopt_reent, 0, sizeof(getopt_data)); while ( (option = getopt_r( argc, argv, "a:tTpP", &getopt_reent)) != -1 ) { switch (option) { case 'a': +#if defined(RTEMS_SMP) c_p = getopt_reent.optarg; if ( rtems_string_to_unsigned_long( c_p, &affinity, NULL, 0) ) { fprintf( stderr, "Affinity (%s) is not a number\n", argv[2] ); @@ -83,6 +87,9 @@ int rtems_shell_main_task_create( CPU_ZERO( &cpuset ); cpuset.__bits[0] = affinity; +#else + printf( "Ignoring affinity request on uniprocessor\n" ); +#endif break; case 't': @@ -102,7 +109,7 @@ int rtems_shell_main_task_create( mode = (mode & ~RTEMS_PREEMPT_MASK) | RTEMS_PREEMPT; break; default: - fprintf( stderr, "%s: Usage [-tTpP]\n", argv[0] ); + fprintf( stderr, "%s: Usage [-a:tTpP]\n", argv[0] ); return -1; } } @@ -154,6 +161,7 @@ int rtems_shell_main_task_create( priority ); +#if defined(RTEMS_SMP) /* * If specified, set the affinity */ @@ -173,6 +181,7 @@ int rtems_shell_main_task_create( } printf("Task (0x%08x) Set affinity=0x%08x\n", id, cpuset.__bits[0] ); } +#endif /* * Starting the task |