+1 for the cleanup

Best regards
Alin J

On Wed, Nov 11, 2026 at 1:05 PM Marco C. <[email protected]> wrote:

> Hello,
>
> I would like to discuss a small breaking change, as CONTRIBUTING.md 1.13
> asks:
>
> https://github.com/apache/nuttx/pull/21696
>
> The PR is a draft with the "breaking change" label. It depends on
> apache/nuttx#21693 and stays a draft until that one merges. I will
> start a vote after the discussion.
>
> What the PR does
>
> It removes the BOARDIOC_SPINLOCK boardctl() command,
> CONFIG_BOARDCTL_SPINLOCK and struct boardioc_spinlock_s. Its only user
> was pthread_spin_*(), and apache/nuttx#21693 (not a breaking change)
> implements those in libc with atomics, so they no longer need a system
> call. Xiang Xiao asked for the removal in the review of #21693; it is
> in its own PR because it removes a public command. The value 0x000f
> stays unused, so the other boardctl() commands keep their numbers. The
> PR also removes the documentation page of the boardioc_spinlock
> example, which is not in nuttx-apps.
>
> Who is affected
>
> No configuration or application in nuttx and nuttx-apps master: with
> #21693, no code uses BOARDIOC_SPINLOCK, and no defconfig sets
> CONFIG_BOARDCTL_SPINLOCK. Out-of-tree code that calls
> boardctl(BOARDIOC_SPINLOCK) is affected.
>
> Quick fix
>
> An application that called boardctl(BOARDIOC_SPINLOCK) uses
> pthread_spin_lock(), pthread_spin_trylock() and pthread_spin_unlock()
> (CONFIG_PTHREAD_SPINLOCKS); kernel code uses spin_lock() and
> spin_unlock() from <nuttx/spinlock.h>. A defconfig drops
> CONFIG_BOARDCTL_SPINLOCK.
>
> The alternative
>
> Keep the command with no user in the tree.
>
> Tests
>
> The removed code has no caller, so nothing runs differently. Builds
> with -Werror of this PR together with #21693 pass (qemu-armv8a:knsh,
> bl602evb:wifi). The spin locks of #21693 pass a test program on QEMU
> (arm64 kernel, flat and SMP, rv64 kernel, armv7-m protected) and on
> real hardware: RP2350 (Pimoroni Pico Plus 2, one and two Cortex-M33
> cores). ostest passes on QEMU and on the RP2350.
>
> Help with build and runtime logs on other real boards is welcome.
> Please send your comments here or in the PR.
>
> Best regards,
> Marco Casaroli
>

Reply via email to