You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "crafcat7 (via GitHub)" <gi...@apache.org> on 2024/10/12 13:29:42 UTC

[PR] Revert "sched/spinlock: remove nesting spinlock support" [nuttx]

crafcat7 opened a new pull request, #14190:
URL: https://github.com/apache/nuttx/pull/14190

   ## Summary
   
   This reverts commit 5aa13bc490ea2e5a0d7462dd0131f9218a35f56a, Related to https://github.com/apache/nuttx/issues/14167
   
   I found that this submission would cause ci warning, So should we revert it first?
   ```
   machine/arch_atomic.c: In function ‘__atomic_load_2’:
   machine/arch_atomic.c:51:22: warning: infinite recursion detected [-Winfinite-recursion]
      51 |   type weak_function __atomic_load_##n (FAR const volatile void *ptr, \
         |                      ^~~~~~~~~~~~~~
   machine/arch_atomic.c:354:1: note: in expansion of macro ‘LOAD’
     354 | LOAD(2, uint16_t)
         | ^~~~
   In file included from /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/atomic.h:84,
                    from /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/fs/fs.h:40,
                    from /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/sched.h:47,
                    from /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/arch.h:89,
                    from /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:38,
                    from machine/arch_atomic.c:31:
   In function ‘spin_lock_wo_note’,
       inlined from ‘spin_lock_irqsave_wo_note’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:531:7,
       inlined from ‘spin_lock_irqsave’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:586:11,
       inlined from ‘__atomic_load_2’ at machine/arch_atomic.c:354:1:
   /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:244:10: note: recursive call
     244 |   while (atomic_load((FAR atomic_ushort *)&lock->tickets.owner) != ticket)
         |          ^~~~~~~~~~~
   In function ‘spin_lock_wo_note’,
       inlined from ‘spin_lock_irqsave_wo_note’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:535:7,
       inlined from ‘spin_lock_irqsave’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:586:11,
       inlined from ‘__atomic_load_2’ at machine/arch_atomic.c:354:1:
   /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:244:10: note: recursive call
     244 |   while (atomic_load((FAR atomic_ushort *)&lock->tickets.owner) != ticket)
         |          ^~~~~~~~~~~
   machine/arch_atomic.c: In function ‘__atomic_fetch_add_2’:
   machine/arch_atomic.c:120:22: warning: infinite recursion detected [-Winfinite-recursion]
     120 |   type weak_function __atomic_fetch_add_##n (FAR volatile void *ptr,   \
         |                      ^~~~~~~~~~~~~~~~~~~
   machine/arch_atomic.c:450:1: note: in expansion of macro ‘FETCH_ADD’
     450 | FETCH_ADD(2, uint16_t)
         | ^~~~~~~~~
   In function ‘spin_lock_wo_note’,
       inlined from ‘spin_lock_irqsave_wo_note’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:531:7,
       inlined from ‘spin_lock_irqsave’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:586:11,
       inlined from ‘__atomic_fetch_add_2’ at machine/arch_atomic.c:450:1:
   /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:243:5: note: recursive call
     243 |     atomic_fetch_add((FAR atomic_ushort *)&lock->tickets.next, 1);
         |     ^~~~~~~~~~~~~~~~
   In function ‘spin_lock_wo_note’,
       inlined from ‘spin_lock_irqsave_wo_note’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:535:7,
       inlined from ‘spin_lock_irqsave’ at /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:586:11,
       inlined from ‘__atomic_fetch_add_2’ at machine/arch_atomic.c:450:1:
   /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/spinlock.h:243:5: note: recursive call
     243 |     atomic_fetch_add((FAR atomic_ushort *)&lock->tickets.next, 1);
         |     ^~~~~~~~~~~~~~~~
   ```
   
   ## Impact
   
   None,it just fix CI warning
   
   ## Testing
   
   Build Host(s): Linux x86
   Target(s): sim/smp
   
   After that, there will be no warnings for compilation
   ```
   ╭─crafcat7@hp-prodesk-680-g4-mt ~/SSD/vela/nuttx.git/nuttx ‹master› 
   ╰─$ ./tools/configure.sh -l sim:smp                                                                                                                                          130 ↵
     Copy files
     Select CONFIG_HOST_LINUX=y
     Refreshing...
   CP: arch/dummy/Kconfig to /home/crafcat7/SSD/vela/nuttx.git/nuttx/arch/dummy/dummy_kconfig
   CP: boards/dummy/Kconfig to /home/crafcat7/SSD/vela/nuttx.git/nuttx/boards/dummy/dummy_kconfig
   LN: platform/board to /home/crafcat7/SSD/vela/nuttx.git/apps/platform/dummy
   LN: include/arch to arch/sim/include
   LN: include/arch/board to /home/crafcat7/SSD/vela/nuttx.git/nuttx/boards/sim/sim/sim/include
   LN: drivers/platform to /home/crafcat7/SSD/vela/nuttx.git/nuttx/drivers/dummy
   LN: include/arch/chip to /home/crafcat7/SSD/vela/nuttx.git/nuttx/arch/sim/include/sim
   LN: arch/sim/src/chip to /home/crafcat7/SSD/vela/nuttx.git/nuttx/arch/sim/src/sim
   LN: arch/sim/src/board to /home/crafcat7/SSD/vela/nuttx.git/nuttx/boards/sim/sim/sim/src
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/audioutils
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/benchmarks
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/boot
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/canutils
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/crypto
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/database
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/examples/mcuboot
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/examples
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/fsutils
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/games
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/graphics
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/industry
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/inertial
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/interpreters/luamodules
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/interpreters
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/logging
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/lte
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/math
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/mlearning
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/netutils
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/sdr
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/system
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/testing
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/videoutils
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/wireless/bluetooth
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/wireless/ieee802154
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps/wireless
   mkkconfig in /home/crafcat7/SSD/vela/nuttx.git/apps
   Loaded configuration '.config'
   Configuration saved to '.config'
   ╭─crafcat7@hp-prodesk-680-g4-mt ~/SSD/vela/nuttx.git/nuttx ‹master› 
   ╰─$ make -j
   Create version.h
   LN: platform/board to /home/crafcat7/SSD/vela/nuttx.git/apps/platform/dummy
   Register: hello
   Register: nsh
   Register: sh
   Register: getprime
   Register: smp
   Register: ostest
   Register: taskset
   CP:  /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/config.h
   CP:  /home/crafcat7/SSD/vela/nuttx.git/nuttx/include/nuttx/fs/hostfs.h
   LD:  nuttx
   ```
   


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


Re: [PR] Revert "sched/spinlock: remove nesting spinlock support" [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #14190:
URL: https://github.com/apache/nuttx/pull/14190#issuecomment-2408621987

   > I sorted out the reasons for the compilation warning. If we use NuttX atomic, then there is in the process
   > 
   > ```
   > spin_lock_irqsave->spin_lock_irqsave_wo_note->spin_lock_wo_note
   > ```
   > 
   > and the atomic function is also used in spin_lock_wo_note
   
   @crafcat7 let's fix the warning instead reverting the patch.


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


Re: [PR] Revert "sched/spinlock: remove nesting spinlock support" [nuttx]

Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao merged PR #14190:
URL: https://github.com/apache/nuttx/pull/14190


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


Re: [PR] Revert "sched/spinlock: remove nesting spinlock support" [nuttx]

Posted by "GUIDINGLI (via GitHub)" <gi...@apache.org>.
GUIDINGLI commented on PR #14190:
URL: https://github.com/apache/nuttx/pull/14190#issuecomment-2408566746

   @anchao 


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


Re: [PR] Revert "sched/spinlock: remove nesting spinlock support" [nuttx]

Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #14190:
URL: https://github.com/apache/nuttx/pull/14190#issuecomment-2408716618

   I wrote the following comments in 
   https://github.com/apache/nuttx/pull/14079#issuecomment-2408714889
   
   ===
   I noticed that spresense:wifi_smp causes a deadlock with this PR.
   I think this PR would affect some SMP configurations that use real hardware.
   So I suggest we revert this PR until all the issues have been resolved.
   ===


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


Re: [PR] Revert "sched/spinlock: remove nesting spinlock support" [nuttx]

Posted by "crafcat7 (via GitHub)" <gi...@apache.org>.
crafcat7 commented on PR #14190:
URL: https://github.com/apache/nuttx/pull/14190#issuecomment-2408587748

   I sorted out the reasons for the compilation warning.
   If we use NuttX atomic, then there is in the process
   
   ```
   spin_lock_irqsave->spin_lock_irqsave_wo_note->spin_lock_wo_note
   ```
   
   and the atomic function is also used in spin_lock_wo_note


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