Commit Graph

98 Commits

Author SHA1 Message Date
Sebastian Huber
2dd098a635 score: Introduce Thread_Scheduler_control::home
Replace Thread_Scheduler_control::control and
Thread_Scheduler_control::own_control with new
Thread_Scheduler_control::home.

Update #2556.
2016-11-02 10:05:45 +01:00
Sebastian Huber
d271c3bb78 rtems: Add rtems_task_iterate()
Update #2423.
2016-11-02 08:46:47 +01:00
Sebastian Huber
300f6a481a score: Rework thread priority management
Add priority nodes which contribute to the overall thread priority.

The actual priority of a thread is now an aggregation of priority nodes.
The thread priority aggregation for the home scheduler instance of a
thread consists of at least one priority node, which is normally the
real priority of the thread.  The locking protocols (e.g. priority
ceiling and priority inheritance), rate-monotonic period objects and the
POSIX sporadic server add, change and remove priority nodes.

A thread changes its priority now immediately, e.g. priority changes are
not deferred until the thread releases its last resource.

Replace the _Thread_Change_priority() function with

 * _Thread_Priority_perform_actions(),
 * _Thread_Priority_add(),
 * _Thread_Priority_remove(),
 * _Thread_Priority_change(), and
 * _Thread_Priority_update().

Update #2412.
Update #2556.
2016-09-21 08:59:26 +02:00
Sebastian Huber
b20b736382 score: Introduce _Thread_Get_priority()
Avoid direct access to thread internal data fields.
2016-09-08 09:55:28 +02:00
Sebastian Huber
1dd8ffff9f capture: Use proper accessor functions 2016-09-06 10:52:19 +02:00
Sebastian Huber
7af6b58c5c capture: Workaround to avoid misaligned access
Move the 64-bit field to a not 64-bit aligned structure offset to stop
the compiler from generating 64-bit load/store operations.
2016-09-06 09:53:08 +02:00
Chris Johns
1c18ebf0d6 libmisc/capture: Remove the reserved _t in the types. 2016-09-01 11:11:45 +10:00
Chris Johns
6da06c559f libmisc/capture: Fix the capture engine on SMP.
This patches some issues with the capture engine:

 1. Check is the engine is open in ctrace commands.
 2. Check all record open and appends for overflow.
 3. Fix the record open to take the size of user data and
    not the record header.
 4. Use packed structs for data being written to the per
    cpu buffers.
 5. Remove direct struct access to the capture buffers to
    avoid misaligned accesses.
 6. Add support to extract records, no struct access to the
    capture buffers.
 7. Update ctrace to extract records from the capture buffers.
 8. Add support to ctrace to always print the task name if it
    has one.
 9. Add support to manage names or the lack of a name.
10. Range of minor fixes.
11. Fix a long standing bug in ctset's handling of args.

Closes #2780.
2016-09-01 11:11:22 +10:00
Sebastian Huber
c82835a231 rtems: Rework RTEMS API to SuperCore priority
Use same structure as POSIX API for thread priority conversion to/from
SuperCore.
2016-06-22 14:00:28 +02:00
Sebastian Huber
df23f464be capture: Fix use of per-processor data
Get the current processor index only once and with interrupts disabled.

Close #2707.
2016-05-12 13:24:43 +02:00
Sebastian Huber
d449c12df3 capture: Remove superfluous includes 2016-05-12 13:24:43 +02:00
Sebastian Huber
7bd18697f8 capture: Compact rtems_capture_record_t
Order fields according to alignment to reduce structure internal
padding.
2016-05-12 13:24:42 +02:00
Sebastian Huber
2f11d4a014 capture: Fix buffer allocation and free
Do not use function static variables.  Remove superfluous volatile
qualifiers.  Use proper integer types.

Close #2706.
2016-05-12 13:24:42 +02:00
Sebastian Huber
f97536dcd3 basdefs.h: Add and use RTEMS_UNUSED 2015-10-26 09:13:19 +01:00
Sebastian Huber
504e042d86 capture: Define __rtld_tbg_lock 2015-04-02 08:28:12 +02:00
Chris Johns
a300920de1 libmisc/shell: Add the rtrace command for buffered tracing support.
The rtrace command interfaces to the RTEMS Trace Linker's trace
buffering data allowing users to capture and report trace data.
2015-03-31 17:04:43 +11:00
Joel Sherrill
735efe7e6d capture/capture_support.c: Fix printf() warning and formatting 2015-03-24 08:16:27 -05:00
Chris Johns
da30417b24 libmisc/capture: Clean up formatting on ARM.
The printing of 64bit diff's for the timestamp did not work on ARM
so I have changed this to 32bit. A 32bit nano-second diff between
events should be more than enough time.

Print '____' for POSIX thread output.
2015-03-19 18:25:51 +11:00
Gedare Bloom
ed152a0c4b capture: fix warnings in print 2015-03-16 12:49:47 -04:00
Joel Sherrill
bdf23b6cd4 cpukit: Remove old DESCRIPTION: in comments
These were remnants of pre-Doxygen comment style.
2015-03-11 16:18:29 -05:00
Joel Sherrill
cc69334f42 Fix a number of minor Doxygen formatting issues 2015-03-06 10:37:55 -06:00
Sebastian Huber
16b2de3545 capture: Fix warnings 2015-03-05 11:33:57 +01:00
Sebastian Huber
cfe6d05e3b capture: Fix lock initialization 2015-01-09 14:03:32 +01:00
Jennifer Averett
0a0ded702a capture: Resolve failure path memory leak. 2014-11-25 12:50:17 -06:00
Jennifer Averett
c577500023 capture: Remove whitespace and fix copyrights. 2014-11-24 14:04:54 -06:00
Jennifer Averett
66bf2af278 capture: Add SMP support.
To support smp data was broken into global and percpu capture data.
Capture control must be disabled prior to printing or setting of
watch points.
2014-11-24 14:04:54 -06:00
Jennifer Averett
04a13bdf74 capture: Move print methods out of cli for reuse.
Methods to print the data were moved from capture-cli into
a support area and are no longer static so that they can
be shared by test routines, or application code that wants
to use the capture engine without the shell interface.
2014-11-24 14:04:53 -06:00
Jennifer Averett
3d5bcdedfd capture: Move logging of task record to occur after filter check.
The catpture task record is now logged just prior to the first
log entry using that task instead of the first time the task
is seen.  This involved splitting the record task method into
an initialize task and a record task.
2014-11-24 14:04:53 -06:00
Jennifer Averett
8b11ff67a8 capture: Remove ctload command.
rtems_cpu_usage_top should be used for this information.
2014-10-28 07:58:28 -05:00
Jennifer Averett
05e4e59984 capture: Removal of capture task tracking.
This patch removes functionality for stack checking from
the capture engine and requiresi the use of existing rtems
functions for this information.  It modifies ctload to use
functionality similar to rtems cpuusage.  It removes the
capture task and stores a new capture task record the first
time the task is seen.  The per task data that was still
needed is scaled down and stored in the tcb.
2014-10-27 14:01:13 -05:00
Jennifer Averett
2a86615b98 capture: Add support for variable length records. 2014-09-05 06:50:29 -05:00
Jennifer Averett
133962bf2f capture: Split user extension methods out. 2014-09-05 06:50:29 -05:00
Jennifer Averett
463de590f0 capture: Fix capture engine to handle new extensions. 2014-07-11 09:48:50 -05:00
Jennifer Averett
1af8634a84 capture: Update comment block style in capture engine.
Doxygen added and comment blocks standardized.
2014-07-11 09:48:35 -05:00
Sebastian Huber
f39f667a69 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.
2014-05-15 12:18:44 +02:00
Sebastian Huber
2ca0a7be22 capture: Use ISR lock for SMP support 2014-04-14 08:37:04 +02:00
Chris Johns
6a26e9bbf5 cpukit/capture: Print the uptime and diff in ctrace.
Print the uptime and difference in nanoseconds to the previous
record in the ctrace output. For example:

    0:00:59.474927121     14760 0a01000c TNTD 235 235 CREATED_BY
    0:00:59.474927418       297 0a010012 /dev 235 235 CREATED
    0:00:59.474930799      3381 0a01000c TNTD 235 235 STARTED_BY
    0:00:59.474931105       306 0a010012 /dev 235 235 STARTED
    0:00:59.475072297    141192 0a01000c TNTD 235 235 SWITCHED_OUT
2013-12-24 18:08:29 +11:00
Chris Johns
9f9c0bbf47 cpukit/capture: Use the new RTEMS API to get the uptime in nanoseconds.
Use the new API to get the uptime in nanoseconds and update the capture
engine.
2013-12-24 16:46:19 +11:00
Daniel Ramirez
2bafb96037 rtems: classic api to/from core priority conversions 2013-12-21 20:09:02 -05:00
Chris Johns
db8a89e212 cpukit/capture: Update the capture engine.
The capture did not work due to changes in the workspace allocator.
The engine now scans all existing tasks when enabled and does any
allocations then.

Fixed a bug in the ctset commandi in the CLI.

Updated the capture engine to use 64bit nanosec timestamps.

Fixed the CLI showing the stack usage.
2013-12-19 19:01:23 +11:00
Sebastian Huber
fe6c170cf5 score: Create states implementation header
Move implementation specific parts of states.h and states.inl into new
header file statesimpl.h.  The states.h contains now only the
application visible API.
2013-07-26 11:55:45 +02:00
Sebastian Huber
1cb75cc4c2 score: Merge wkspace API into one file 2013-07-23 17:19:07 +02:00
Sebastian Huber
4b48ece07d score: Create watchdog implementation header
Move implementation specific parts of watchdog.h and watchdog.inl into
new header file watchdogimpl.h.  The watchdog.h contains now only the
application visible API.
2013-07-22 16:57:25 +02:00
Mathew Kallada
c5782a26b3 Header File Doxygen Enhancement Task #7 2012-12-28 11:17:49 -06:00
Sebastian Huber
5e86086f1e sapi: Use rtems_config*_get_microseconds_per_tick 2012-11-07 15:08:43 +01:00
Joel Sherrill
721fe34aae Fix C files which had two semi-colons at EOL 2012-05-31 15:34:36 -05:00
Joel Sherrill
9b4422a251 Remove All CVS Id Strings Possible Using a Script
Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines
  next to each other after Id string line removed.
+ remove entire comment blocks which only exited to
  contain CVS Ids
+ If the processing left a blank line at the top of
  a file, it was removed.
2012-05-11 08:44:13 -05:00
Ralf Corsepius
e8f0541c34 2011-12-05 Ralf Corsépius <ralf.corsepius@rtems.org>
* libmisc/capture/capture.c:
	Make RTEMS_CAPTURE_* defines unsigned (Avoid implicit
	sign-conversions).
	Make rtems_capture_trigger static (Missing prototypes).
	Make rtems_capture_trigger static (Missing prototypes).
	* libmisc/capture/capture.h:
	Make RTEMS_CAPTURE_WATCH, RTEMS_CAPTURE_TRACED unsigned (Avoid
	implicit sign conversions).
2011-12-05 17:31:19 +00:00
Joel Sherrill
21242c252a 2011-06-24 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/rtems/bspIo.h, include/rtems/concat.h,
	include/rtems/endian.h, include/rtems/fs.h, include/rtems/irq.h,
	include/rtems/pci.h, include/rtems/userenv.h,
	libblock/include/rtems/flashdisk.h,
	libblock/include/rtems/nvdisk-sram.h,
	libblock/include/rtems/nvdisk.h, libcsupport/include/clockdrv.h,
	libcsupport/include/console.h, libcsupport/include/iosupp.h,
	libcsupport/include/spurious.h,
	libcsupport/include/motorola/mc68230.h,
	libcsupport/include/rtems/assoc.h, libcsupport/include/rtems/error.h,
	libcsupport/include/rtems/framebuffer.h,
	libcsupport/include/rtems/gxx_wrappers.h,
	libcsupport/include/rtems/libcsupport.h,
	libcsupport/include/rtems/libio_.h,
	libcsupport/include/rtems/malloc.h,
	libcsupport/include/rtems/termiostypes.h,
	libcsupport/include/sys/statvfs.h, libcsupport/include/sys/termios.h,
	libcsupport/include/sys/utsname.h, libcsupport/include/zilog/z8036.h,
	libcsupport/include/zilog/z8530.h, libcsupport/include/zilog/z8536.h,
	libfs/src/imfs/imfs.h, libfs/src/pipe/pipe.h,
	libmisc/capture/capture-cli.h, libmisc/capture/capture.h,
	libmisc/cpuuse/cpuuse.h, libmisc/devnull/devnull.h,
	libmisc/devnull/devzero.h, libmisc/dumpbuf/dumpbuf.h,
	libmisc/fb/fb.h, libmisc/fb/mw_uid.h, libmisc/mouse/mouse_parser.h,
	libmisc/shell/shellconfig.h, libmisc/stringto/stringto.h,
	libmisc/untar/untar.h, libnetworking/memory.h, posix/include/aio.h,
	posix/include/mqueue.h, posix/include/semaphore.h,
	posix/include/rtems/posix/aio_misc.h,
	posix/include/rtems/posix/barrier.h,
	posix/include/rtems/posix/cond.h, posix/include/rtems/posix/config.h,
	posix/include/rtems/posix/key.h, posix/include/rtems/posix/mqueue.h,
	posix/include/rtems/posix/mutex.h,
	posix/include/rtems/posix/posixapi.h,
	posix/include/rtems/posix/priority.h,
	posix/include/rtems/posix/psignal.h,
	posix/include/rtems/posix/pthread.h,
	posix/include/rtems/posix/ptimer.h,
	posix/include/rtems/posix/rwlock.h,
	posix/include/rtems/posix/semaphore.h,
	posix/include/rtems/posix/sigset.h,
	posix/include/rtems/posix/spinlock.h,
	posix/include/rtems/posix/threadsup.h,
	posix/include/rtems/posix/time.h, posix/include/rtems/posix/timer.h,
	posix/inline/rtems/posix/barrier.inl,
	posix/inline/rtems/posix/cond.inl,
	posix/inline/rtems/posix/mqueue.inl,
	posix/inline/rtems/posix/mutex.inl,
	posix/inline/rtems/posix/priority.inl,
	posix/inline/rtems/posix/pthread.inl,
	posix/inline/rtems/posix/rwlock.inl,
	posix/inline/rtems/posix/semaphore.inl,
	posix/inline/rtems/posix/spinlock.inl,
	posix/inline/rtems/posix/timer.inl, rtems/mainpage.h,
	rtems/include/rtems/rtems/barrier.h,
	rtems/include/rtems/rtems/object.h,
	rtems/include/rtems/rtems/timer.h,
	rtems/inline/rtems/rtems/barrier.inl,
	rtems/inline/rtems/rtems/timer.inl,
	rtems/src/semtranslatereturncode.c, sapi/include/rtems/config.h,
	sapi/include/rtems/fatal.h, sapi/include/rtems/mptables.h,
	score/include/rtems/score/object.h,
	score/include/rtems/score/priority.h,
	score/inline/rtems/score/object.inl,
	score/inline/rtems/score/priority.inl: Add @file Doxygen directives
	and descriptions to files which originated with RTEMS. This improves
	the file list page generated by Doxygen.
2011-06-24 17:52:58 +00:00
Joel Sherrill
a0323a9f8f 2011-02-15 Joel Sherrill <joel.sherrilL@OARcorp.com>
* libmisc/capture/capture.c, posix/src/keyfreememory.c,
	posix/src/pthread.c, score/include/rtems/score/wkspace.h,
	score/src/objectextendinformation.c,
	score/src/objectnamespaceremove.c, score/src/objectsetname.c,
	score/src/threadclose.c, score/src/threadinitialize.c,
	score/src/wkspace.c: Many places were checking for a NULL pointer
	before calling _Workspace_Free. By moving the check into
	_Workspace_Free, we eliminate a number of conditional paths and make
	it harder to return a NULL pointer.
2011-02-16 00:24:49 +00:00