chirping78 commented on PR #10496:
URL: https://github.com/apache/nuttx/pull/10496#issuecomment-1758804497

   I tried to print the cpu/pid of the task which has disabled IRQ with 
following changed `up_irq_save`.
   
   Please note that:
   - the changed part is closed in `#if 1` and `#endif`
   - can not use `syslog` / `info`, which will call `up_irq_save` recursively. 
So `up_putc` is used here
   - can not use `up_interrupt_context` / `gettid`. They call  `up_irq_save` 
recursively. So copy their logic here (the IRQ is disabled)
   ```
   irqstate_t up_irq_save(void)
   {
     unsigned int cpsr;
   #if 1
     int cpu;
     pid_t tid;
     static pid_t printed_pid[2] = {0};
   #endif
   
     __asm__ __volatile__
       (
         "\tmrs    %0, cpsr\n"
         "\tcpsid  i\n"
   #if defined(CONFIG_ARMV7A_DECODEFIQ)
         "\tcpsid  f\n"
   #endif
         : "=r" (cpsr)
         :
         : "memory"
       );
   
   #if 1
     if (g_nx_initstate >= OSINIT_IDLELOOP && CURRENT_REGS == NULL)
     {
       cpu = up_cpu_index();
   
       struct tcb_s *rtcb = current_task(cpu);
       tid = rtcb->pid;
   
       if (!(cpsr & 0x80))
       {
         if (tid != printed_pid[cpu])
         {
           up_putc(cpu + '0');
           //up_putc(':');
           up_putc((tid / 10) + '0');
           up_putc((tid % 10) + '0');
           //up_putc(':');
           //up_putc('0');
           up_putc('\n');
           printed_pid[cpu] = tid;
         }
       }
     }
   #endif
   
     return cpsr;
   
   }
   ```
   The bad news is, with the change this issue can not be reproduced, although 
the change has been limit to minimum range.
   Any other suggestion? @masayuki2009 


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