You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2024/07/01 23:23:00 UTC

(nuttx) branch revert-12595-apache_2 created (now 83646ca7cb)

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a change to branch revert-12595-apache_2
in repository https://gitbox.apache.org/repos/asf/nuttx.git


      at 83646ca7cb Revert "irq: remove g_cpu_nestcount in restore_critical_section"

This branch includes the following new commits:

     new 83646ca7cb Revert "irq: remove g_cpu_nestcount in restore_critical_section"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(nuttx) 01/01: Revert "irq: remove g_cpu_nestcount in restore_critical_section"

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch revert-12595-apache_2
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 83646ca7cba37283ca6463dc3b6f78b66811e241
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Tue Jul 2 08:22:51 2024 +0900

    Revert "irq: remove g_cpu_nestcount in restore_critical_section"
    
    This reverts commit 1bf41985564643a38baffe5de50039e0a5dc13c7.
---
 sched/irq/irq_csection.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c
index 175ce0dace..224358642d 100644
--- a/sched/irq/irq_csection.c
+++ b/sched/irq/irq_csection.c
@@ -621,9 +621,25 @@ void restore_critical_section(void)
    */
 
   tcb = current_task(me);
-  DEBUGASSERT(g_cpu_nestcount[me] <= 0);
-  if (tcb->irqcount <= 0)
+  if (tcb->irqcount > 0)
     {
+      /* Do notihing here
+       * NOTE: spin_setbit() is done in nxsched_add_readytorun()
+       * and nxsched_remove_readytorun()
+       */
+    }
+
+  /* No.. This CPU will be relinquishing the lock.  But this works
+   * differently if we are performing a context switch from an
+   * interrupt handler and the interrupt handler has established
+   * a critical section.  We can detect this case when
+   * g_cpu_nestcount[me] > 0.
+   */
+
+  else if (g_cpu_nestcount[me] <= 0)
+    {
+      /* Release our hold on the IRQ lock. */
+
       if ((g_cpu_irqset & (1 << me)) != 0)
         {
           cpu_irqlock_clear();