jerpelea opened a new pull request, #20074:
URL: https://github.com/apache/nuttx/pull/20074
## Summary
This PR fixes two bugs in the SCHED_SPORADIC handling of the scheduler, both
found while testing sporadic policy switching:
sched_setscheduler(): The policy flag bits were cleared before the
switch (policy) statement. Since TCB_FLAG_SCHED_FIFO is 0, the checks for "was
the task previously SCHED_SPORADIC" inside the SCHED_FIFO/SCHED_RR cases could
never be true. As a result nxsched_stop_sporadic() was never called when a
sporadic task switched to another policy, leaking the sporadic state and its
replenishment timers; a sporadic-to-sporadic reconfiguration ran
nxsched_initialize_sporadic() instead of reset, leaking the old state. The
flags are now cleared only after the previous policy has been evaluated.
sched_setparam(): set_sporadic_param() tested rtcb (the calling task)
instead of tcb (the task being modified). A cross-task sched_setparam()
therefore never updated the target's sporadic parameters, and if the caller was
itself sporadic while the target was not, it would reset a task with no
sporadic state (NULL-pointer / assertion failure) and write parameters into the
caller's own sporadic state.
## Impact
RELEASE
## Testing
CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]