Commit Graph

26580 Commits

Author SHA1 Message Date
Sebastian Huber
a0fb29fb80 termios: PR1279: Use first open status 2014-07-09 12:07:49 +02:00
Sebastian Huber
32fc6a3490 termios: PR1279: Use set attributes status 2014-07-09 12:07:49 +02:00
Sebastian Huber
ef8c00bc88 termios: PR2153: New low-level device API
Add a new low-level device API to Termios that passes the TTY structure
to the low-level device functions.  This greatly simplifies the
low-level device drivers since they are no longer forced to derive their
private data from the minor number.

It makes it possible to use the TTY low-level lock in the device driver
low-level functions which is necessary for proper SMP support.  For
example to set the attributes it is often necessary to perform a
read-modify-write operation on a control register used also by interrupt
routines.

A compatibility layer is provided to support device drivers using the
old callback functions so it is not necessary to modify existing device
drivers.
2014-07-09 11:55:00 +02:00
Sebastian Huber
c6048ee2c5 score: _Scheduler_Thread_get_own_node()
Provide this function also for uni-processor configurations.
2014-07-09 11:22:02 +02:00
Sebastian Huber
9f228beaa6 smptests/smpmrsp01: Add and update test cases 2014-07-09 10:05:21 +02:00
Sebastian Huber
5c3d250959 score: Implement scheduler helping protocol
The following scheduler operations return a thread in need for help

    - unblock,
    - change priority, and
    - yield.

A thread in need for help is a thread that encounters a scheduler state
change from scheduled to ready or a thread that cannot be scheduled in
an unblock operation.  Such a thread can ask threads which depend on
resources owned by this thread for help.

Add a new ask for help scheduler operation.  This operation is used by
_Scheduler_Ask_for_help() to help threads in need for help returned by
the operations mentioned above.  This operation is also used by
_Scheduler_Thread_change_resource_root() in case the root of a resource
sub-tree changes.  A use case is the ownership change of a resource.

In case it is not possible to schedule a thread in need for help, then
the corresponding scheduler node will be placed into the set of ready
scheduler nodes of the scheduler instance.  Once a state change from
ready to scheduled happens for this scheduler node it may be used to
schedule the thread in need for help.
2014-07-09 10:05:17 +02:00
Joel Sherrill
52f8e90d7f schedulerpriorityaffinitysmp.c: Add period at end of sentence 2014-07-08 11:42:57 -05:00
Sebastian Huber
8568341d69 score: Need for help indicator for scheduler ops
Return a thread in need for help for the following scheduler operations

- unblock,
- change priority, and
- yield.

A thread in need for help is a thread that encounters a scheduler state
change from scheduled to ready or a thread that cannot be scheduled in
an unblock operation.  Such a thread can ask threads which depend on
resources owned by this thread for help.
2014-07-08 16:30:48 +02:00
Sebastian Huber
ac532f3350 score: Add _Scheduler_Help()
Manage the help state of threads with respect to scheduling decisions.
2014-07-08 16:30:48 +02:00
Sebastian Huber
08d9760daf score: Rename *_Node_get() to *_Thread_get_node()
This emphasizes that the scheduler node of a thread is returned and this
is not a function working with scheduler nodes like the other *_Node_*()
functions.
2014-07-08 16:30:48 +02:00
Sebastian Huber
19e417678a score: Simplify SMP processor allocation
Avoid copy and paste and set the scheduler node state in one place.
2014-07-08 16:30:48 +02:00
Sebastian Huber
835b88b883 score: Rename _Scheduler_SMP_Update_heir()
Rename and move _Scheduler_SMP_Update_heir() to
_Thread_Dispatch_update_heir() since this function is not scheduler
specific.
2014-07-08 16:30:47 +02:00
Sebastian Huber
5c632c4a18 score: Fix warning 2014-07-07 13:56:18 +02:00
Sebastian Huber
46cd17a3be score: Fix MrsP resource root change
Use the root of the owner for the new root, since the owner may depend
on a resource as well.
2014-07-04 14:52:16 +02:00
Sebastian Huber
fbda4a8834 score: PR2183: Fix context switch on SMP
Fix context switch on SMP for ARM, PowerPC and SPARC.

Atomically test and set the is executing indicator of the heir context
to ensure that at most one processor uses the heir context.  Break the
busy wait loop also due to heir updates.
2014-07-04 13:17:19 +02:00
Sebastian Huber
f28f5c4a1d arm: Use local label in _CPU_Context_restore() 2014-07-01 17:02:41 +02:00
Sebastian Huber
bec4730901 score: Add PER_CPU_OFFSET_EXECUTING
Add PER_CPU_OFFSET_HEIR.  Move Per_CPU_Control::executing and
Per_CPU_Control::heir for easy offset calculation.
2014-07-01 17:02:41 +02:00
Sebastian Huber
7ab6046a62 bsp/altera-cyclone-v: Move MMU configuration table
This makes it possible to use application specific version.
2014-07-01 15:30:07 +02:00
Sebastian Huber
9eb1994fd2 bsps/arm: Rename bsp_mm_config_table
Rename bsp_mm_config_table to arm_cp15_start_mmu_config_table and
rename bsp_mm_config_table_size to arm_cp15_start_mmu_config_table_size
to be in line with the other names in <bsp/arm-cp15-start.h>.
2014-07-01 15:23:04 +02:00
Sebastian Huber
88525944f3 sptests/spcontext01: Avoid NULL pointer access 2014-07-01 12:03:12 +02:00
Sebastian Huber
516a60a6f8 bsps/sparc: Reduce copy and paste 2014-07-01 10:25:27 +02:00
Daniel Hellstrom
47cf1adda9 LEON3: devfs free nodes must be sized
.. according to the maximum number of termios ports which is
8. Since LEON3 uses PnP to find how many UARTs there are
present we must make sure worst case work.

The current maximum of 4 free nodes caused for example the
GR712RC with its 6 UARTs to fail during devfs02 test.
2014-06-30 15:45:02 +02:00
Daniel Hellstrom
9f99232e4b LEON3: fix console close handling
On SMP rtems_interrupt_lock_context must be used. Most tests fail with a
NULL pointer exception when exiting, except on NGMP where main memory is
at 0x00000000.
2014-06-30 15:45:02 +02:00
Sebastian Huber
0b4ec4d74e smptests/smpfatal08: Support RTEMS_PARAVIRT 2014-06-30 12:30:12 +02:00
Sebastian Huber
f6b1e0630b termios: Make tty list static 2014-06-30 11:18:42 +02:00
Sebastian Huber
dd510a0b09 rtems: Delete unused <rtems/rtems/atomic.h> 2014-06-30 09:56:28 +02:00
Sebastian Huber
89f8eab582 score: Workaround for GCC 4.9 for atomic ops
The GCC 4.9 ships its own <stdatomic.h> which is not C++ compatible.
The suggested solution was to include <atomic> in case C++ is used.
This works at least with GCC 4.9.  See also:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60940
2014-06-30 09:56:23 +02:00
Sebastian Huber
b42e148587 smptests/smpmigration02: PR2183: Add test case 2014-06-24 09:53:11 +02:00
Sebastian Huber
152ad7d1cc score: Fix _Thread_Start_multitasking() on SMP
The _CPU_Context_Restart_self() implementations usually assume that self
context is executing.

FIXME: We have a race condition in _Thread_Start_multitasking() in case
another thread already performed scheduler operations and moved the heir
thread to another processor.  The time frame for this is likely too
small to be practically relevant.
2014-06-24 09:31:14 +02:00
Sebastian Huber
a92989a8bd score: Fix thread deletion on SMP
Close the thread object in _Thread_Make_zombie() so that all blocking
operations that use _Thread_Get() in the corresponding release directive
can find a terminating thread and can complete the operation.
2014-06-23 09:54:05 +02:00
Sebastian Huber
8f0c7a46ed score: Decouple thread and scheduler nodes on SMP
Add a chain node to the scheduler node to decouple the thread and
scheduler nodes.  It is now possible to enqueue a thread in a thread
wait queue and use its scheduler node at the same for other threads,
e.g. a resouce owner.
2014-06-23 09:53:59 +02:00
Sebastian Huber
647b95df9f score: Use chain nodes for ready queue support
This reduces the API to the minimum data structures to maximize the
re-usability.
2014-06-23 09:13:00 +02:00
Sebastian Huber
2d36931823 score: Collect scheduler related fields in TCB
Add Thread_Scheduler_control to collect scheduler related fields of the
TCB.
2014-06-23 09:13:00 +02:00
Sebastian Huber
92635cb36d score: Remove scheduler parameter from most ops
Remove the scheduler parameter from most high level scheduler operations
like
  - _Scheduler_Block(),
  - _Scheduler_Unblock(),
  - _Scheduler_Change_priority(),
  - _Scheduler_Update_priority(),
  - _Scheduler_Release_job(), and
  - _Scheduler_Yield().

This simplifies the scheduler operations usage.
2014-06-23 09:13:00 +02:00
Sebastian Huber
bd1431ab29 score: Use default get/set affinity operation
Add and use SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY.
2014-06-20 12:40:24 +02:00
Sebastian Huber
2803c8cec0 score: Fix statement with no effect 2014-06-20 09:59:05 +02:00
Sebastian Huber
f6b7b7ba0a score: Fix _Thread_Delay_ended() on SMP
Suppose we have two tasks A and B and two processors.  Task A is about
to delete task B.  Now task B calls rtems_task_wake_after(1) on the
other processor.  Task B will block on the Giant lock.  Task A
progresses with the task B deletion until it has to wait for
termination.  Now task B obtains the Giant lock, sets its state to
STATES_DELAYING, initializes its watchdog timer and waits.  Eventually
_Thread_Delay_ended() is called, but now _Thread_Get() returned NULL
since the thread is already marked as deleted.  Thus task B remained
forever in the STATES_DELAYING state.

Instead of passing the thread identifier use the thread control block
directly via the watchdog user argument.  This makes
_Thread_Delay_ended() also a bit more efficient.
2014-06-20 08:24:46 +02:00
Sebastian Huber
bd56356b58 smptests/smpwakeafter01: New test 2014-06-18 14:03:59 +02:00
Sebastian Huber
11947299a0 smptests: Avoid use of uninitialized data 2014-06-13 16:07:47 +02:00
Sebastian Huber
73bf499ce7 JFFS2: Add device identifier for the flash device
It is used in combination with the inode number to uniquely identify a
file system node in the system.
2014-06-13 16:07:46 +02:00
Sebastian Huber
2ba2743f06 score: Delete _Thread_Set_transient() 2014-06-13 09:29:43 +02:00
Sebastian Huber
a80c3b67ca score: _Scheduler_priority_Get_scheduler_info()
Delete _Scheduler_priority_Get_scheduler_info().
2014-06-13 09:29:32 +02:00
Sebastian Huber
701dd96f59 score: PR2181: Add _Thread_Yield()
The _Scheduler_Yield() was called by the executing thread with thread
dispatching disabled and interrupts enabled.  The rtems_task_suspend()
is explicitly allowed in ISRs:

http://rtems.org/onlinedocs/doc-current/share/rtems/html/c_user/Interrupt-Manager-Directives-Allowed-from-an-ISR.html#Interrupt-Manager-Directives-Allowed-from-an-ISR

Unlike the other scheduler operations the locking was performed inside
the operation.  This lead to the following race condition.  Suppose a
ISR suspends the executing thread right before the yield scheduler
operation.  Now the executing thread is not longer in the set of ready
threads.  The typical scheduler operations did not check the thread
state and will now extract the thread again and enqueue it.  This
corrupted data structures.

Add _Thread_Yield() and do the scheduler yield operation with interrupts
disabled.  This has a negligible effect on the interrupt latency.
2014-06-12 16:13:26 +02:00
Sebastian Huber
970aa80fe1 bsp/realview-pbx-a9: Fix SMP startup 2014-06-12 13:00:47 +02:00
Sebastian Huber
4962d24d62 smptests/smpscheduler03: Test all SMP schedulers 2014-06-12 10:02:10 +02:00
Sebastian Huber
46390027c7 score: Make functions inline
These functions are used only via the function pointers in the generic
SMP scheduler implementation.  Provide them as static inline so that the
compiler can optimize more easily.
2014-06-12 10:00:39 +02:00
Sebastian Huber
82df6f347b score: Move NULL pointer check to order function
This helps to avoid untestable code for the normal SMP schedulers.
2014-06-12 09:06:53 +02:00
Sebastian Huber
65006149b9 score: Fix warnings 2014-06-12 08:49:08 +02:00
Sebastian Huber
d9b54da8c5 score: Format 2014-06-12 08:48:02 +02:00
Sebastian Huber
6f4993e21a score: Add missing inline 2014-06-12 08:43:25 +02:00