tmedicci commented on code in PR #15815:
URL: https://github.com/apache/nuttx/pull/15815#discussion_r1953004237


##########
arch/risc-v/src/common/riscv_doirq.c:
##########
@@ -88,13 +88,24 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs)
       (*running_task)->xcp.regs = regs;
     }
 
-  /* Nested interrupts are not supported */
+  /* Current regs non-zero indicates that we are processing an interrupt;
+   * current_regs is also used to manage interrupt level context switches.
+   *
+   * Nested interrupts are not supported. But an exception may occur while
+   * processing an interrupt. In this case, current_regs will be non-NULL.
+   */
 
-  DEBUGASSERT(!up_interrupt_context());
+  DEBUGASSERT(((irq > RISCV_MAX_EXCEPTION) && !up_interrupt_context()) ||

Review Comment:
   Hi @xiaoxiang781216, 
   
   I don't think those changes can be split into smaller commits. This PR 
implements the backtrace dump when an exception occurs during IRQ handling.
   
   This code is necessary, otherwise it wouldn't achieve the panic function 
that dumps the backtrace (which require `irq_dispatch` to run). Without it, we 
wouldn't be able to check if the call frame is able to restore the backtrace 
across the IRQ handle. 
   
   2 and 3 aren't independent changes.
   
   @fdcavalcanti , can you test if 1) can be split into another PR?
   



-- 
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