#4412 closed defect (fixed)

Unexpected rtems_task_restart() behaviour if called from within interrrupt context

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: rtems Version: 6
Severity: normal Keywords: qualification
Cc: Blocked By:
Blocking:

Description

In rtems_task_restart() there is a check if the executing thread is restarted. However, in interrupt context, this simple check results in an internal error INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL if the executing thread is restarted. Check also if an ISR is in progress to make sure the thread restart works within interrupt context.

Change History (5)

comment:1 Changed on May 14, 2021 at 1:01:36 PM by Joel Sherrill

This service is not documented as being allowed from an ISR. Only task suspend and resume are documented as allowed. I assume by "works" you mean that it returns an error without an internal error.

comment:2 Changed on May 14, 2021 at 1:08:57 PM by Sebastian Huber

The rtems_task_restart() works well if called from within interrupt context if you use _ISR_Is_in_progress() to determine a self restart. This directive doesn't use a mutex internally only ISR locks.

comment:3 Changed on May 14, 2021 at 3:05:31 PM by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In 73ebf9a/rtems:

rtems: Fix task restart within interrupt context

rtems_task_restart() may be called from within interrupt context. So
checking only that the thread to restart is equal to the executing
thread is insufficient to determine a self restart. We have to also
check that no ISR is in progress. Merge _Thread_Restart_other() and
_Thread_Restart_self() into one _Thread_Restart() since they share a lot
of common code.

Close #4412.

comment:4 Changed on May 26, 2021 at 12:41:27 PM by Sebastian Huber <sebastian.huber@…>

In de694b75/rtems:

score: Direct thread dispatch in a self restart

Commit 73ebf9a27ed5cd0fd3e0dc0da98345d7faa610a2 accidentally removed the
direct thread dispatch in a self thread restart. In case of a self
restart (always in task context) the directive shall not return. If
this is not possible due to a bad thread dispatch disable level, then a
fatal error shall occur.

Update #4412.

comment:5 Changed on Jun 23, 2021 at 7:07:55 AM by Sebastian Huber

Keywords: qualification added
Note: See TracTickets for help on using tickets.