You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/22 06:51:38 UTC

[GitHub] [incubator-nuttx] masayuki2009 opened a new pull request #4207: arch: sim: Workaround to make the IPI work on macOS

masayuki2009 opened a new pull request #4207:
URL: https://github.com/apache/incubator-nuttx/pull/4207


   ## Summary
   
   - I noticed that sim:smp does not work correctly on macOS
     due to the recent changes
   - Actually, it can not receive the IPI host signal, so if
     a new task is scheduled on CPU1/2/3, it hangs.
   - Finally, I found the issue depends on pthread stack settings
     and perhaps it might affect the host signal handling.
   - This commit fixes this issue by just reverting the pthread
     stack setting only for macOS.
   
   ## Impact
   
   - sim:smp on macOS 11.4 (x86_64)
   - Stack usage for CPU1/2/3 IDLE will be incorrect
   
   ## Testing
   
   - Tested with ostest on macOS
   


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #4207: arch: sim: Workaround to make the IPI work on macOS

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #4207:
URL: https://github.com/apache/incubator-nuttx/pull/4207#issuecomment-884888660


   @xiaoxiang781216 
   
   After more investigations, I found that ```pthread_attr_init()``` in ```sim_cpu_start()``` is linked incorrectly for both Linux and macOS. The symbol should locate in the host library but it calls the library on NuttX. Do you know why the symbol is linked incorrectly?
   
   ```
     pthread_attr_t attr; 
     pthread_attr_init(&attr); 
      3c875: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax 
      3c87c: 48 89 c7 mov %rax,%rdi 
      3c87f: e8 64 98 fe ff callq 260e8 <pthread_attr_init> <== should be @plt
     pthread_attr_setstack(&attr, stack, size); 
      3c884: 48 8b 95 28 ff ff ff mov -0xd8(%rbp),%rdx 
      3c88b: 48 8b 8d 30 ff ff ff mov -0xd0(%rbp),%rcx 
      3c892: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax 
      3c899: 48 89 ce mov %rcx,%rsi 
      3c89c: 48 89 c7 mov %rax,%rdi 
      3c89f: e8 6c 64 fc ff callq 2d10 <pt...@plt> 
     ret = pthread_create(&g_cpu_thread[cpu], 
      3c8a4: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax 
      3c8aa: 48 98 cltq 
      3c8ac: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx 
      3c8b3: 00 
      3c8b4: 48 8d 05 85 77 21 00 lea 0x217785(%rip),%rax # 254040 <g_cpu_thread> 
      3c8bb: 48 8d 3c 02 lea (%rdx,%rax,1),%rdi 
      3c8bf: 48 8d 55 90 lea -0x70(%rbp),%rdx 
      3c8c3: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax 
      3c8ca: 48 89 d1 mov %rdx,%rcx 
      3c8cd: 48 8d 15 35 fe ff ff lea -0x1cb(%rip),%rdx # 3c709 <sim_idle_trampoline> 
      3c8d4: 48 89 c6 mov %rax,%rsi 
      3c8d7: e8 04 64 fc ff callq 2ce0 <pt...@plt> 
      3c8dc: 89 85 4c ff ff ff mov %eax,-0xb4(%rbp) 
                          &attr, sim_idle_trampoline, &cpuinfo); 
   ```


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] jerpelea merged pull request #4207: arch: sim: Workaround to make the IPI work on macOS

Posted by GitBox <gi...@apache.org>.
jerpelea merged pull request #4207:
URL: https://github.com/apache/incubator-nuttx/pull/4207


   


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4207: arch: sim: Workaround to make the IPI work on macOS

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4207:
URL: https://github.com/apache/incubator-nuttx/pull/4207#issuecomment-884905428


   All pthread_attr_* called by host side need put into:
   https://github.com/apache/incubator-nuttx/blob/master/arch/sim/src/nuttx-names.in#L70
   To add NX prefix for NuttX implementation.


-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org