Skip to content

Timebase and console internal tasks don't support OS event handler concept, default flags or other osal task behavior #1423

@skliper

Description

@skliper

Describe the bug
Both timebase and console start "internal" tasks, which skips the event handler support called from XXX and the default flags applied in OS_TaskCreate.

Note RTEMS examples shown but also applies to at least posix:

timebase internal task create/start:

rtems_sc = rtems_task_create(r_name, RTEMS_MINIMUM_PRIORITY + 1, 0,
RTEMS_PREEMPT | RTEMS_NO_ASR | RTEMS_NO_TIMESLICE | RTEMS_INTERRUPT_LEVEL(0),
RTEMS_LOCAL, &local->handler_task);
/* check if task_create failed */
if (rtems_sc != RTEMS_SUCCESSFUL)
{
/* Provide some feedback as to why this failed */
OS_printf("rtems_task_create failed: %s\n", rtems_status_text(rtems_sc));
return_code = OS_TIMER_ERR_INTERNAL;
}
else
{
/* will place the task in 'ready for scheduling' state */
rtems_sc = rtems_task_start(local->handler_task, /* rtems task id */
OS_TimeBase_CallbackThreadEntry, /* task entry point */
(rtems_task_argument)r_name); /* passed argument */

console internal task create/start:

status = rtems_task_create(r_name, OS_CONSOLE_TASK_PRIORITY, OS_CONSOLE_TASK_STACKSIZE,
RTEMS_PREEMPT | RTEMS_NO_ASR | RTEMS_NO_TIMESLICE | RTEMS_INTERRUPT_LEVEL(0),
RTEMS_LOCAL, &r_task_id);
/* check if task_create failed */
if (status != RTEMS_SUCCESSFUL)
{
/* Provide some feedback as to why this failed */
OS_DEBUG("rtems_task_create failed: %s\n", rtems_status_text(status));
rtems_semaphore_delete(local->data_sem);
return_code = OS_ERROR;
}
else
{
/* will place the task in 'ready for scheduling' state */
status = rtems_task_start(r_task_id, /*rtems task id*/
OS_ConsoleTask_Entry, /* task entry point */
(rtems_task_argument)r_name); /* passed argument */

Event handler called from OS_TaskCreate->OS_TaskCreate_Impl->rtems_task_start->OS_RtemsEntry->OS_TaskEntryPoint->OS_TaskPrepare->OS_NotifyEvent

Default flags are set in OS_TaskCreate:

/* Add default flags */
flags |= OS_ADD_TASK_FLAGS;

Noticed as part of #1421, since it also skipped adding the posix task names. This is somewhat unexpected and inflexible behavior as these two tasks become "special" in that they can't be assigned core affinity or other common behavior supported by the normal osal tasks.

To Reproduce
Code inspection, but easy to prove (task name not set, affinity not set, etc)

Expected behavior
Even though these are osal internal tasks, should support at least a subset of these common behaviors.

Code snips
See above

System observed on:
RTEMS

Additional context
None

Reporter Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions