diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-05-14 13:50:48 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-05-15 12:18:44 +0200 |
commit | f39f667a69cf5c4bc0dd4555537615022767f0f9 (patch) | |
tree | f8a48b3c7bf443001b036ddcab6ed104210e6134 /testsuites | |
parent | score: Add and use _Scheduler_Get_context() (diff) | |
download | rtems-f39f667a69cf5c4bc0dd4555537615022767f0f9.tar.bz2 |
score: Simplify _Thread_Change_priority()
The function to change a thread priority was too complex. Simplify it
with a new scheduler operation. This increases the average case
performance due to the simplified logic. The interrupt disabled
critical section is a bit prolonged since now the extract, update and
enqueue steps are executed atomically. This should however not impact
the worst-case interrupt latency since at least for the Deterministic
Priority Scheduler this sequence can be carried out with a wee bit of
instructions and no loops.
Add _Scheduler_Change_priority() to replace the sequence of
- _Thread_Set_transient(),
- _Scheduler_Extract(),
- _Scheduler_Enqueue(), and
- _Scheduler_Enqueue_first().
Delete STATES_TRANSIENT, _States_Is_transient() and
_Thread_Set_transient() since this state is now superfluous.
With this change it is possible to get rid of the
SCHEDULER_SMP_NODE_IN_THE_AIR state. This considerably simplifies the
implementation of the new SMP locking protocols.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/sptests/Makefile.am | 1 | ||||
-rw-r--r-- | testsuites/sptests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/sptests/spintrcritical19/Makefile.am | 20 | ||||
-rw-r--r-- | testsuites/sptests/spintrcritical19/init.c | 136 | ||||
-rw-r--r-- | testsuites/sptests/spintrcritical19/spintrcritical19.doc | 13 | ||||
-rw-r--r-- | testsuites/sptests/spintrcritical19/spintrcritical19.scn | 4 |
6 files changed, 0 insertions, 175 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 999c7582f9..ef25b25568 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -50,7 +50,6 @@ _SUBDIRS += sptls02 endif _SUBDIRS += sptls01 _SUBDIRS += spintrcritical20 -_SUBDIRS += spintrcritical19 _SUBDIRS += spcontext01 _SUBDIRS += spfatal26 _SUBDIRS += speventtransient01 diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index 6be14e4626..b40d4dd6fd 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -50,7 +50,6 @@ spcpucounter01/Makefile sptls02/Makefile sptls01/Makefile spintrcritical20/Makefile -spintrcritical19/Makefile spcontext01/Makefile spfatal26/Makefile spinternalerror02/Makefile diff --git a/testsuites/sptests/spintrcritical19/Makefile.am b/testsuites/sptests/spintrcritical19/Makefile.am deleted file mode 100644 index a2350ca8b1..0000000000 --- a/testsuites/sptests/spintrcritical19/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -rtems_tests_PROGRAMS = spintrcritical19 -spintrcritical19_SOURCES = init.c ../spintrcritical_support/intrcritical.c - -dist_rtems_tests_DATA = spintrcritical19.scn spintrcritical19.doc - -include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/leaf.am - -AM_CPPFLAGS += -I$(top_srcdir)/../support/include -AM_CPPFLAGS += -I$(top_srcdir)/spintrcritical_support - -LINK_OBJS = $(spintrcritical19_OBJECTS) -LINK_LIBS = $(spintrcritical19_LDLIBS) - -spintrcritical19$(EXEEXT): $(spintrcritical19_OBJECTS) $(spintrcritical19_DEPENDENCIES) - @rm -f spintrcritical19$(EXEEXT) - $(make-exe) - -include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spintrcritical19/init.c b/testsuites/sptests/spintrcritical19/init.c deleted file mode 100644 index 4d2eca8622..0000000000 --- a/testsuites/sptests/spintrcritical19/init.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2013 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H - #include "config.h" -#endif - -#include <tmacros.h> -#include <intrcritical.h> -#include <rtems/score/statesimpl.h> - -const char rtems_test_name[] = "SPINTRCRITICAL 19"; - -#define PRIORITY_RED 1 - -#define PRIORITY_GREEN 2 - -#define PRIORITY_RESUMER 3 - -typedef struct { - rtems_id master_task; - rtems_id resumer_task; - Thread_Control *master_task_tcb; - bool test_case_hit; -} test_context; - -static test_context ctx_instance; - -static void resumer_task(rtems_task_argument arg) -{ - test_context *ctx = (test_context *) arg; - - while (true) { - rtems_status_code sc = rtems_task_resume(ctx->master_task); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - } -} - -static void suspend_master_task(rtems_id timer, void *arg) -{ - /* The arg is NULL */ - test_context *ctx = &ctx_instance; - rtems_status_code sc; - - if (_States_Is_transient(ctx->master_task_tcb->current_state)) { - ctx->test_case_hit = true; - } - - sc = rtems_task_suspend(ctx->master_task); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); -} - -static void Init(rtems_task_argument ignored) -{ - test_context *ctx = &ctx_instance; - rtems_task_priority priority = PRIORITY_RED; - int resets = 0; - rtems_status_code sc; - - TEST_BEGIN(); - - ctx->master_task = rtems_task_self(); - ctx->master_task_tcb = _Thread_Get_executing(); - - sc = rtems_task_create( - rtems_build_name('R', 'E', 'S', 'U'), - PRIORITY_RESUMER, - RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, - RTEMS_DEFAULT_ATTRIBUTES, - &ctx->resumer_task - ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - - sc = rtems_task_start( - ctx->resumer_task, - resumer_task, - (rtems_task_argument) ctx - ); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - - interrupt_critical_section_test_support_initialize( - suspend_master_task - ); - - while (resets < 3 && !ctx->test_case_hit) { - if (interrupt_critical_section_test_support_delay()) { - ++resets; - } - - sc = rtems_task_set_priority(RTEMS_SELF, priority, &priority); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - - rtems_test_assert(_States_Is_ready(ctx->master_task_tcb->current_state)); - } - - rtems_test_assert(ctx->test_case_hit); - - sc = rtems_task_delete(ctx->resumer_task); - rtems_test_assert(sc == RTEMS_SUCCESSFUL); - - TEST_END(); - - rtems_test_exit(0); -} - -#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - -#define CONFIGURE_MICROSECONDS_PER_TICK 1000 - -#define CONFIGURE_MAXIMUM_TASKS 2 -#define CONFIGURE_MAXIMUM_TIMERS 1 - -#define CONFIGURE_INIT_TASK_PRIORITY PRIORITY_GREEN -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES -#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES - -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE - -#define CONFIGURE_INIT - -#include <rtems/confdefs.h> diff --git a/testsuites/sptests/spintrcritical19/spintrcritical19.doc b/testsuites/sptests/spintrcritical19/spintrcritical19.doc deleted file mode 100644 index 4228ff2fb7..0000000000 --- a/testsuites/sptests/spintrcritical19/spintrcritical19.doc +++ /dev/null @@ -1,13 +0,0 @@ -This file describes the directives and concepts tested by this test set. - -test set name: spintrcritical19 - -directives: - - - rtems_task_suspend() - - rtems_task_set_priority() - -concepts: - - - Ensure that a priority change works during suspend requests from an - interrupt service routine. diff --git a/testsuites/sptests/spintrcritical19/spintrcritical19.scn b/testsuites/sptests/spintrcritical19/spintrcritical19.scn deleted file mode 100644 index 3d7d209211..0000000000 --- a/testsuites/sptests/spintrcritical19/spintrcritical19.scn +++ /dev/null @@ -1,4 +0,0 @@ -*** TEST INTERRUPT CRITICAL SECTION 19 *** - -Support - rtems_timer_create - creating timer 1 -*** END OF TEST INTERRUPT CRITICAL SECTION 19 *** |