You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/04/11 15:44:36 UTC

[GitHub] [incubator-nuttx] patacongo edited a comment on issue #765: sched/sched_setpriority.c: DEBUGVERIFY, not DEBUGASSERT.

patacongo edited a comment on issue #765: sched/sched_setpriority.c:  DEBUGVERIFY, not DEBUGASSERT.
URL: https://github.com/apache/incubator-nuttx/pull/765#issuecomment-612447768
 
 
   Good find.  Yes that is a serious problem for anyone using priority with assertions disabled.  In this case, the macro DEBUGVERIFY was intended, not DEBUGASSERT.
   
   The end result is that that if DEBUG assertions were not enabled and priority inheritance is enabled,  then the ordering of task is the ready-to-run list wills be screwed up.  That is is ordered from highest priority to lowest.  If DEBUG assertions are not enabled, then this sequence of code changes:
   
       251       /* Remove the TCB from the ready-to-run task list that it resides in */
       252
       253       DEBUGASSERT(!sched_removereadytorun(tcb));
       254
       255       /* Change the task priority */
       256
       257       tcb->sched_priority = (uint8_t)sched_priority;
       258
       259       /* Put it back into the correct ready-to-run task list */
       260
       261       DEBUGASSERT(!sched_addreadytorun(tcb));
   
   So, statements at lines 253 and 261 would not be executed; the TCB is not placed in a new location in the prioritized list but is, instead, its priority is changes at its existing location in the prioritized list.  This could have subtle effects on real-time performance and could lead to other prioritization issues when other TCBs are merged into the list.  I think this would not be fatal and a busy system should recover in some period of time.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services