Skip to content

Conversation

@crafcat7
Copy link
Contributor

Summary

This reverts commit 5aa13bc, Related to #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

@github-actions github-actions bot added Area: OS Components OS Components issues Size: S The size of the change in this PR is small labels Oct 12, 2024
@GUIDINGLI
Copy link
Contributor

@anchao

@xiaoxiang781216 xiaoxiang781216 linked an issue Oct 12, 2024 that may be closed by this pull request
1 task
Copy link
Contributor

@anchao anchao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be a problem with the implementation of Spinlock. I am out of office now and let us revert first

@crafcat7
Copy link
Contributor Author

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

@xiaoxiang781216
Copy link
Contributor

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.

@masayuki2009
Copy link
Contributor

masayuki2009 commented Oct 12, 2024

@xiaoxiang781216

I wrote the following comments in
#14079 (comment)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: OS Components OS Components issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] new warnings when building sim/smp

5 participants