mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
SMP: Enforce this rule: Tasks which are normally restored when sched_unlock() is called must remain pending (1) if we are in a critical section, i.e., g_cpu_irqlock is locked , or (2) other CPUs still have pre-emption disabled, i.e., g_cpu_schedlock is locked. In those cases, the release of the pending tasks must be deferred until those conditions are met.
This commit is contained in:
@@ -513,12 +513,9 @@ void leave_critical_section(irqstate_t flags)
|
||||
if (!spin_islocked(&g_cpu_irqlock))
|
||||
{
|
||||
/* Check if there are pending tasks and that pre-emption
|
||||
* is also enabled.
|
||||
*
|
||||
* REVISIT: Is there an issue here? up_release_pending()
|
||||
* must be called from within a critical section but here
|
||||
* we have just left the critical section. At least we
|
||||
* still have interrupts disabled on this CPU.
|
||||
* is also enabled. This is necessary becaue we may have
|
||||
* deferred the up_release_pending() call in sched_unlock()
|
||||
* because we were within a critical section then.
|
||||
*/
|
||||
|
||||
if (g_pendingtasks.head != NULL &&
|
||||
@@ -529,9 +526,6 @@ void leave_critical_section(irqstate_t flags)
|
||||
*
|
||||
* NOTE: This operation has a very high likelihood of
|
||||
* causing this task to be switched out!
|
||||
*
|
||||
* REVISIT: Should this not be done while we are in the
|
||||
* critical section.
|
||||
*/
|
||||
|
||||
up_release_pending();
|
||||
|
||||
Reference in New Issue
Block a user