Commit Graph
29898 Commits
Author SHA1 Message Date
Sebastian Huber bd0d585807 arm: Fix _CPU_ISR_Is_enabled() for ARMv7-M
Update #2811.
2016-11-24 11:53:59 +01:00
Sebastian Huber 620b23ece5 score: Optimize _Thread_queue_Enqueue()
Move thread state for _Thread_queue_Enqueue() to the thread queue
context.  This reduces the parameter count of _Thread_queue_Enqueue()
from five to four (ARM for example has only four function parameter
registers).  Since the thread state is used after several function calls
inside _Thread_queue_Enqueue() this parameter was saved on the stack
previously.
2016-11-24 08:46:20 +01:00
Sebastian Huber 4b5ff47d15 score: Fix interrupt profiling
Callers of _Thread_Do_dispatch() must have a valid
Per_CPU_Control::Stats::thread_dispatch_disabled_instant.

Call _Profiling_Outer_most_interrupt_entry_and_exit() with the interrupt
stack to not exceed Per_CPU_Control::Interrupt_frame.

Update #2751.
2016-11-24 08:46:20 +01:00
Sebastian Huber 01ac1db824 powerpc: Fix interrupt profiling for e6500 2016-11-24 08:46:20 +01:00
Sebastian Huber d42cf3388e posix: Fix typo
Update #2674.
2016-11-23 15:12:28 +01:00
Sebastian Huber f6edd88079 score: Explicitly define the fatal source numbers
Update #2825.
2016-11-23 13:44:46 +01:00
Sebastian Huber 73f9c2c27b smptests/smpfatal03: Use timer to provoke error
Avoid use of internal _Thread_Dispatch_disable() function.

Update #2825.
2016-11-23 13:44:22 +01:00
Sebastian Huber bee0323279 score: Uncomment unused internal error codes
Update #2825.
2016-11-23 12:52:07 +01:00
Sebastian Huber c42be504c9 posix: Add self-contained pthread spinlock
Turn pthread_spinlock_t into a self-contained object.  On uni-processor
configurations, interrupts are disabled in the lock/trylock operations
and the previous interrupt status is restored in the corresponding
unlock operations.  On SMP configurations, a ticket lock is a acquired
and released in addition.

The self-contained pthread_spinlock_t object is defined by Newlib in
<sys/_pthreadtypes.h>.

typedef struct {
  struct _Ticket_lock_Control _lock;
  __uint32_t                  _interrupt_state;
} pthread_spinlock_t;

This implementation is simple and efficient.  However, this test case of
the Linux Test Project would fail due to call of printf() and sleep()
during spin lock ownership:

https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c

There is only limited support for profiling on SMP configurations.

Delete CORE spinlock implementation.

Update #2674.
2016-11-23 12:52:06 +01:00
Sebastian Huber 520e07db86 score: Add RTEMS_ALIAS() 2016-11-23 12:52:06 +01:00
Sebastian Huber a4217c674d score: Rename _Thread_queue_Enqueue_critical()
Delete unused _Thread_queue_Enqueue() and rename
_Thread_queue_Enqueue_critical() to _Thread_queue_Enqueue().
2016-11-23 12:52:06 +01:00
Sebastian Huber 125f248231 score: Add thread queue enqueue callout
Replace the expected thread dispatch disable level with a thread queue
enqueue callout.  This enables the use of _Thread_Dispatch_direct() in
the thread queue enqueue procedure.  This avoids impossible exection
paths, e.g. Per_CPU_Control::dispatch_necessary is always true.
2016-11-23 12:52:06 +01:00
Sebastian Huber 84e6f15c82 score: Robust thread dispatch
On SMP configurations, it is a fatal error to call blocking operating
system with interrupts disabled, since this prevents delivery of
inter-processor interrupts. This could lead to executing threads which
are not allowed to execute resulting in undefined behaviour.

The ARM Cortex-M port has a similar problem, since the interrupt state
is not a part of the thread context.

Update #2811.
2016-11-23 12:52:06 +01:00
Sebastian Huber a6283671f3 smptests/smplock01: Test TAS and TTAS locks
Cache align locks in the context.
2016-11-23 12:52:05 +01:00
Sebastian Huber 46b534388f libtests/cpuuse: Check status only
We may own the allocator mutex during context switches.
2016-11-23 12:52:05 +01:00
Sebastian Huber db20706d5a smptests/smpscheduler02: Fix task initialization
Set scheduler before the task start.
2016-11-23 12:52:05 +01:00
Sebastian Huber ec17ad4c24 score: Delete obsolete scheduler debug aid 2016-11-23 12:52:05 +01:00
Sebastian Huber 1d18a9027d arm: Fix _ARMV4_Exception_interrupt
Use the right register to determine if a thread dispatch is allowed and
necessary.

Update #2751.
2016-11-23 12:52:05 +01:00
Sebastian Huber 8954368f49 psxtests/psxkey08: Avoid rtems_semaphore_flush()
Avoid rtems_semaphore_flush() to reduce the maximum thread dispatch
disabled time of this test.  Remove superfluous yield and malloc().
Ensure that no resource leak occurs.
2016-11-23 11:54:29 +01:00
Sebastian Huber a550b3f35a score: Force Per_CPU_Control::executing alignment
This fixes the CPU ports with relaxed alignment restrictions, e.g. type
alignment is less than the type size.

Close #2822.
Close #2823.
2016-11-23 07:52:42 +01:00
Sebastian Huber 3142727602 bsp/lpc23xx_tli800: Disable tar01 test
Close #2824.
2016-11-23 07:47:00 +01:00
Sebastian Huber 4e2bc0a308 arm: Fix Thumb-1 targets
We cannot use the MRS or MSR instructions in Thumb-1 mode.  Stay in ARM
mode for the Thumb-1 targets during interrupt low-level processing.

Update #2751.
2016-11-21 13:15:35 +01:00
Sebastian Huber f730c25b70 powerpc/mpc5xx: Rename CPU_Interrupt_frame
The MPC5XX support uses a legacy interrupt/exception infrastructure.

Close #2819.
2016-11-21 11:19:37 +01:00
Sebastian Huber ccc92b81c9 score: Group Per_CPU_Control members by alignment
Close #2820.
2016-11-21 10:26:32 +01:00
Sebastian Huber 27eccdad87 sparc64: Fix _CPU_ISR_Is_enabled()
Update #2820.
2016-11-21 10:25:58 +01:00
Sebastian Huber fd6d3f1f03 nios2: Fix _CPU_ISR_Is_enabled()
Close #2818.
2016-11-21 10:13:37 +01:00
Sebastian Huber 9f225dea19 arm: Fix ARM_CONTEXT_CONTROL_ISR_DISPATCH_DISABLE
Close #2816.
2016-11-21 10:11:18 +01:00
Sebastian Huber c6f446bd70 bfin: ASM compatibility for <rtems/score/cpu.h>
Close #2817.
2016-11-21 10:06:36 +01:00
Sebastian Huber 142628edcd score: Optimize self-contained objects
Avoid use of the stack for the hot paths.
2016-11-18 07:30:36 +01:00
Sebastian Huber 1b87f27cac score: Constify _MRSP_Get_owner() 2016-11-18 07:30:35 +01:00
Sebastian Huber 408609f6b9 score: Add _ISR_Is_enabled()
In contrast to _ISR_Get_level() the _ISR_Is_enabled() function evaluates
a level parameter and returns a boolean value.

Update #2811.
2016-11-18 07:30:35 +01:00
Sebastian Huber 537f00ebe8 score: Restrict task interrupt level to 0 on SMP
Update #2811.
2016-11-18 07:30:35 +01:00
Sebastian Huber 7ce60b378d powerpc: Use Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:35 +01:00
Sebastian Huber d59585db26 arm: Use Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:35 +01:00
Sebastian Huber 2668e4f639 arm: Simplify _ARMV4_Exception_interrupt
Move profiling code closer to bsp_interrupt_disable() to allow re-use of
r9 later.
2016-11-18 07:30:34 +01:00
Sebastian Huber 4924756f69 arm: Use local labels 2016-11-18 07:30:34 +01:00
Sebastian Huber c11ac2d59d sparc: Use Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:34 +01:00
Sebastian Huber d5e073cde7 score: Allow interrupts during thread dispatch
Use a processor-specific interrupt frame during context switches in case
the executing thread is longer executes on the processor and the heir
thread is about to start execution.  During this period we must not use
a thread stack for interrupt processing.

Update #2809.
2016-11-18 07:30:34 +01:00
Sebastian Huber f9aa34ddd9 score: Add Per_CPU_Control::Interrupt_frame
Update #2809.
2016-11-18 07:30:34 +01:00
Sebastian Huber 2072dd242f score: Add Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:33 +01:00
Sebastian Huber dbeccf0ec0 arm: Provide CPU_Interrupt_frame for ARMv4
Update #2809.
2016-11-18 07:30:33 +01:00
Sebastian Huber 2599c8e63e powerpc: Add up to date CPU_Interrupt_frame
Rename ppc_exc_min_frame to CPU_Interrupt_frame.  Move it and the
corresponding defines to <rtems/score/cpuimpl.h>.

Update #2809.
2016-11-18 07:30:33 +01:00
Sebastian Huber bf4fdb1f1d powerpc: Move legacy CPU_Interrupt_frame
The only remaining user of CPU_Interrupt_frame on PowerPC is the mpc5xx
support.  Move it to here.

Update #2809.
2016-11-18 07:30:33 +01:00
Sebastian Huber 40d592eb3e bsps/powerpc: Avoid use of CPU_Interrupt_frame
This type is not relevant for the code since only a pointer is passed
around.

Update #2809.
2016-11-18 07:30:33 +01:00
Sebastian Huber c539a865f4 sparc: Move CPU_Interrupt_frame related defines
Move CPU_Interrupt_frame related defines to <rtems/score/cpuimpl.h>.

Update #2809.
2016-11-18 07:30:33 +01:00
Sebastian Huber 427dcee837 sparc: Rename CPU_Minimum_stack_frame
Rename SPARC-specific CPU_Minimum_stack_frame to
SPARC_Minimum_stack_frame.  Rename SPARC-specific
CPU_MINIMUM_STACK_FRAME_SIZE to SPARC_MINIMUM_STACK_FRAME_SIZE.

Update #2809.
2016-11-18 07:30:32 +01:00
Sebastian Huber d18560ae05 sparc64: Rename CPU_Minimum_stack_frame
Rename SPARC64-specific CPU_Minimum_stack_frame to
SPARC64_Minimum_stack_frame.  Rename SPARC64-specific
CPU_MINIMUM_STACK_FRAME_SIZE to SPARC64_MINIMUM_STACK_FRAME_SIZE.

Update #2809.
2016-11-18 07:30:32 +01:00
Sebastian Huber 141e16d225 rtems: Conditionally define rtems_interrupt_frame
Update #2808.
2016-11-18 07:30:32 +01:00
Sebastian Huber 8ef8a32d00 bsps/mips: Use <libcpu/isr_entries.h>
Avoid duplicate mips_vector_isr_handlers() declarations.
2016-11-18 07:30:32 +01:00
Sebastian Huber 82d30a310c score: Move CPU_PER_CPU_CONTROL_SIZE
Move CPU_PER_CPU_CONTROL_SIZE and the optional CPU_Per_CPU_control to
<rtems/score/cpuimpl.h> to hide it from <rtems.h>.
2016-11-18 07:30:32 +01:00