pussuw opened a new pull request, #16262:
URL: https://github.com/apache/nuttx/pull/16262

   ## Summary
   
   For some SMP calls it is necessary to lock the current CPU for the process 
receiving the SMP call. This is done by setting the CPU affinity to the current 
CPU and preventing the CPU selection algorithm from switching CPUs.
   
     dtcb->flags |= TCB_FLAG_CPU_LOCKED;
     CPU_SET(dtcb->cpu, &dtcb->affinity);
   
   However, this logic is currently broken, as CPU_SET is defined as:
   
     #define CPU_SET(c,s) do { *(s) |= (1u << (c)); } while (0)
   
   In order to assign tcb->cpu (the current CPU) to the affinity mask, the mask 
must be cleared first by calling CPU_ZERO.
   
   ## Impact
   
   This fixes a bug in SMP mode where the kernel attempts to lock CPU for a 
process, but the CPU can still change. Impact
   is a bug fix in the kernel. No user / documentation / API changes and so 
forth.
   
   ## Testing
   
   Testing and bug hunting was done by @jlaitine by running ostest with SMP 
enabled.
   
   Issues related:
   https://github.com/apache/nuttx/issues/16193
   
   
   


-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to