casaroli commented on code in PR #20723: URL: https://github.com/apache/nuttx/pull/20723#discussion_r4587643896
########## include/nuttx/atomic.h: ########## @@ -277,8 +333,10 @@ typedef __Atomic(int64_t) atomic64_t; #if UINTPTR_MAX > UINT32_MAX typedef atomic64_t atomic_ptr_t; -#else +#elif UINTPTR_MAX > UINT16_MAX typedef atomic_t atomic_ptr_t; +#else +typedef __Atomic(int16_t) atomic_ptr_t; Review Comment: I don't think so. `NXSEM_MHOLDER()` casts the `uint32_t mholder` of every mutex to `atomic_t *`, and bit 31 of `mholder` is `NXSEM_MBLOCKING_BIT`. With a 16-bit `atomic_t`, AVR reads and writes only the low half of `mholder`. `NXSEM_COUNT()` (`int32_t semcount`) and seqlock.h (`uint32_t sequence`) use the same cast. ########## libs/libc/tls/Kconfig: ########## @@ -5,6 +5,26 @@ menu "Thread Local Storage (TLS)" +config TLS_EMUTLS + bool "Per-thread copies of emulated TLS variables" + default y + depends on BUILTIN_TOOLCHAIN + depends on (ARCH_TOOLCHAIN_GNU && !ARCH_TOOLCHAIN_ARMCLANG && !ARCH_TOOLCHAIN_GHS && !ARCH_SIM) || (ARCH_SIM && SIM_TOOLCHAIN_GCC && !HOST_MACOS && !WINDOWS_NATIVE) Review Comment: I don't think so. The toolchain selects the TLS model, not `SCHED_THREAD_LOCAL`. That option adds only arm_tls.c or riscv_tls.c, and no compiler flag. For `__thread int x`, arm-none-eabi-gcc 13.2, aarch64-none-elf-gcc 13.2 and riscv-none-elf-gcc 14.3 call `__emutls_get_address()` with or without it. `SCHED_THREAD_LOCAL` is default n, so with this dependency the threads of most boards share one copy again. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
