mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
sched/irq/irq_csection: Fix a bad DEBUG assertion when SMP is enabled.
This commit is contained in:
@@ -129,10 +129,26 @@ irqstate_t enter_critical_section(void)
|
|||||||
/* We are in an interrupt handler. How can this happen?
|
/* We are in an interrupt handler. How can this happen?
|
||||||
*
|
*
|
||||||
* 1. We were not in a critical section when the interrupt
|
* 1. We were not in a critical section when the interrupt
|
||||||
* occurred, OR
|
* occurred. In this case:
|
||||||
|
*
|
||||||
|
* g_cpu_irqlock = SP_UNLOCKED.
|
||||||
|
* g_cpu_nestcount = 0
|
||||||
|
* All CPU bits in g_cpu_irqset should be zero
|
||||||
|
*
|
||||||
* 2. We were in critical section, but up_irq_restore only
|
* 2. We were in critical section, but up_irq_restore only
|
||||||
* disabled local interrupts on a different CPU;
|
* disabled local interrupts on a different CPU;
|
||||||
* Interrupts could still be enabled on this CPU.
|
* Interrupts could still be enabled on this CPU.
|
||||||
|
*
|
||||||
|
* g_cpu_irqlock = SP_LOCKED.
|
||||||
|
* g_cpu_nestcount = 0
|
||||||
|
* The CPU bit in g_cpu_irqset should be zero
|
||||||
|
*
|
||||||
|
* 3. An extension of 2 is that we may be re-entered numerous
|
||||||
|
* times from the interrupt handler. In that case:
|
||||||
|
*
|
||||||
|
* g_cpu_irqlock = SP_LOCKED.
|
||||||
|
* g_cpu_nestcount > 0
|
||||||
|
* The CPU bit in g_cpu_irqset should be zero
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Handle nested calls to enter_critical_section() from the same
|
/* Handle nested calls to enter_critical_section() from the same
|
||||||
@@ -152,8 +168,7 @@ irqstate_t enter_critical_section(void)
|
|||||||
* wait until we have the lock.
|
* wait until we have the lock.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DEBUGASSERT(!spin_islocked(&g_cpu_irqlock) ||
|
DEBUGASSERT((g_cpu_irqset & (1 << cpu)) == 0);
|
||||||
(g_cpu_irqset & (1 << cpu)) == 0);
|
|
||||||
|
|
||||||
/* Wait until we can get the spinlock (meaning that we are no
|
/* Wait until we can get the spinlock (meaning that we are no
|
||||||
* longer in the critical section).
|
* longer in the critical section).
|
||||||
|
|||||||
Reference in New Issue
Block a user