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:
Gregory Nutt
2016-12-26 08:15:02 -06:00
parent d45a81d643
commit 849a5dc2a9
3 changed files with 29 additions and 12 deletions
+3 -9
View File
@@ -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();