evolution124 opened a new issue, #19875:
URL: https://github.com/apache/nuttx/issues/19875

   ### Description / Steps to reproduce the issue
   
   
   
   1. riscv_percpu_init will first initialize and add g_percpu to g_freelist, 
the  g_percpu[i].irq_stack is sequential initialized.
   static void riscv_percpu_init(void) {
      ...
     for (i = 0; i < HART_CNT; i++)
       {
         /* Set interrupt stack (if any) */
   
   #if CONFIG_ARCH_INTERRUPTSTACK > 15
         g_percpu[i].irq_stack = (uintptr_t)g_intstacktop - i * INT_STACK_SIZE;
   #endif
   
         sq_addlast((struct sq_entry_s *) &g_percpu[i], &g_freelist);
       }
      ...
   }
   
   2. riscv_percpu_add_hart(...) will dequeue the g_freelist and assign the 
g_percpu to the booting hart
       but the hart booting order will mismatch with the sequential order.
   
   
   3. riscv_percpu_get_irqstack will get irq_stack.
   
   
   
   
   ### On which OS does this issue occur?
   
   [OS: Linux]
   
   ### What is the version of your OS?
   
   Ubuntu24.04
   
   ### NuttX Version
   
   96f440f0c068f278cc11a956c2c6cf52ff79cf01
   
   ### Issue Architecture
   
   [Arch: risc-v]
   
   ### Issue Area
   
   [Area: Kernel]
   
   ### Host information
   
   _No response_
   
   ### Verification
   
   - [x] I have verified before submitting the report.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to