RTEMS | [i386] Implement _CPU_Spin_wait() in cpu.h for SMP spin-loop throttling (#5647)
Wayne Thornton (@wmthornton-dev)
gitlab at rtems.org
Wed Jul 15 18:30:21 UTC 2026
Issue created by Wayne Thornton: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5647
## Description:
We have introduced a new Super Core architecture hook, `_CPU_Spin_wait()`, to mitigate aggressive speculative execution penalties, reduce thermal load, and lower bus contention during SMP spin-wait polling loops. The reference template is currently documented in `cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h` and natively implemented for `x86_64` upon merging of rtems/rtos/rtems!1256.
The i386 architecture port needs to mirror the `x86_64` behavior by implementing the pipeline pause instruction in `cpukit/score/cpu/i386/include/rtems/score/cpu.h`.
Suggested Implementation:
This should utilize the standard x86 pause instruction (historically encoded as `rep; nop,` which executes safely as a standard no-op on legacy IA-32 processors prior to the Pentium 4 / SSE2):
```
static inline void _CPU_Spin_wait( void )
{
__asm__ volatile( "pause" ::: "memory" );
}
#define _CPU_Spin_wait _CPU_Spin_wait
```
## Verification:
Validate that the implementation compiles cleanly on SMP i386 targets and passes the standalone SMP spin-wait test suite: `testsuites/smptests/smpspinwait01`. Once defined, the preprocessor will automatically override the temporary test-level fallback in `init.c`.
<!-- Pre-set options
- milestone
-->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5647
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/4-ahw32yld3pw5v2m2v9icj9dtb-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260715/1d34d5aa/attachment-0001.htm>
More information about the bugs
mailing list