pussuw commented on code in PR #10857:
URL: https://github.com/apache/nuttx/pull/10857#discussion_r1346195434


##########
sched/task/task_exithook.c:
##########
@@ -465,7 +465,15 @@ void nxtask_exithook(FAR struct tcb_s *tcb, int status)
    * status (no zombies here!)
    */
 
-  group_leave(tcb);
+  if (group_leave(tcb) == 0)
+    {
+      /* Group is dead now, PANIC() if this is the init task */
+
+      if (nxsched_is_inittask(tcb))

Review Comment:
   ```
   ville@workpc:~/wpc_toolchain/workspace/nuttx-bare/nuttx$ qemu-system-riscv64 
-semihosting -M virt,aclint=on -cpu rv64 -smp 8 -bios none -kernel nuttx 
-nographic
   ABC
   NuttShell (NSH) NuttX-10.4.0
   nsh> exit
   [    1.640000] riscv_exception: EXCEPTION: Load access fault. MCAUSE: 
0000000000000005, EPC: 000000008000531a, MTVAL: 0000000000000008
   [    1.640000] riscv_exception: PANIC!!! Exception = 0000000000000005
   [    1.640000] _assert: Current Version: NuttX  10.4.0 3b71bad8c7 Oct  4 
2023 19:56:45 risc-v
   [    1.640000] _assert: Assertion failed panic: at file: 
common/riscv_exception.c:85 task: /system/bin/init 0xc000004a
   [    1.640000] up_dump_register: EPC: 000000008000531a
   [    1.640000] up_dump_register: A0: 0000000080209650 A1: 0000000080209460 
A2: 00000000802095c0 A3: 0000000000000000
   [    1.640000] up_dump_register: A4: 0000000000007fff A5: 0000000000000000 
A6: 0000000080206c38 A7: fffffffffffffff8
   [    1.640000] up_dump_register: T0: 0000000080006c34 T1: 0000000000000007 
T2: 00000000000001ff T3: 0000000080209838
   [    1.640000] up_dump_register: T4: 0000000080209830 T5: 0000000000000009 
T6: 000000000000002a
   [    1.640000] up_dump_register: S0: 0000000080209650 S1: 0000000080209470 
S2: 00000000802094a0 S3: 0000000000000000
   [    1.640000] up_dump_register: S4: 0000000000000000 S5: 0000000000000000 
S6: ffffffffffffffff S7: 000000000000000b
   [    1.640000] up_dump_register: S8: 000000000000000a S9: 0000000000000000 
S10: 0000000000000000 S11: 0000000000000000
   [    1.640000] up_dump_register: SP: 00000000802091f0 FP: 0000000080209650 
TP: 0000000000000000 RA: 0000000080005130
   [    1.640000] dump_stack: Kernel Stack:
   [    1.640000] dump_stack:   base: 0x80208860
   [    1.640000] dump_stack:   size: 00003072
   [    1.640000] dump_stack:     sp: 0x802091f0
   [    1.640000] stack_dump: 0x802091e0: 80209650 00000000 800050c0 00000000 
00000001 00000000 80209650 00000000
   [    1.640000] stack_dump: 0x80209200: 00000000 00000000 8000450a 00000000 
c02002e8 00000000 c0200858 00000000
   [    1.640000] stack_dump: 0x80209220: 00000000 00000000 80006c40 00000000 
c0202b40 00000000 800013a4 00000000
   [    1.640000] stack_dump: 0x80209240: c0000d16 00000000 8000019a 00000000 
8000138c 00000000 c0000d16 00000000
   [    1.640000] stack_dump: 0x80209260: 80209250 00000000 00000000 00000000 
00000000 00000000 800072da 00000000
   [    1.640000] stack_dump: 0x80209280: c00011a6 00000000 000001ff 00000000 
00000000 00000000 c0200858 00000000
   [    1.640000] stack_dump: 0x802092a0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x802092c0: 00007fff 00000000 00000001 00000000 
c0200118 00000000 fffffff8 ffffffff
   [    1.640000] stack_dump: 0x802092e0: 00000001 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209300: ffffffff ffffffff 0000000b 00000000 
0000000a 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209320: 00000000 00000000 00000000 00000000 
802090e0 00000000 802090d8 00000000
   [    1.640000] stack_dump: 0x80209340: 00000009 00000000 0000002a 00000000 
00042120 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209360: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209380: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x802093a0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x802093c0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x802093e0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209400: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209420: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] stack_dump: 0x80209440: 00000000 00000000 800044c8 00000000 
00000000 00000000 00000000 00000000
   [    1.640000] dump_tasks:    PID GROUP PRI POLICY   TYPE    NPX STATE   
EVENT      SIGMASK          STACKBASE  STACKSIZE      USED   FILLED    COMMAND
   [    1.640000] dump_tasks:   ----   --- --- -------- ------- --- ------- 
---------- ---------------- 0x802002b0      2048      2040    99.6%!   irq
   [    1.640000] dump_task:       0     0   0 FIFO     Kthread N-- Ready       
       0000000000000000 0x80206010      3056      1520    49.7%    Idle_Task
   [    1.640000] dump_task:       1     1 100 RR       Kthread --- Waiting 
Semaphore  0000000000000000 0x8020a050      1968       704    35.7%    lpwork 
0x802015f0 0x80201618
   [    1.640000] dump_task:       2    -1 100 RR       Task    N-- Running     
       0000000000000000 0xc0202040      3008       768    25.5%    
/system/bin/init
   
   ```
   
   Just tried it, and the system crashes at once. Perhaps there is some bug 
that needs to be fixed. IRQ stack usage seems a bit high but that can be due to 
the assert dump.



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