Linux 7.4 Adding New Emulation Function While Some Old CPUs May Soon Be Phased Out

Linux 7.4 Adding New Emulation Function While Some Old CPUs May Soon Be Phased Out

Linux 7.4 is seeing a new emulation function added for cmpxchg() for compare and exchange. This is being done so that two-byte cmpxchg() can be used in common Linux kernel code that is already natively supported on newer CPU architectures. The pull request notes though that some old CPU architectures might no longer be supported by the Linux kernel moving ahead. Longtime Linux developer Paul E. McKenney sent in the pull request for emulating of two-byte cmpxchg() support. This emulation function ends up being used by the SH, ARC, CSKY, and Xtensa CPU ports within the Linux kernel. The goal is on allowing the two-byte cmpxchg() to then be allowed throughout the common Linux kernel code as it can be safe to assume support everywhere. "These commits add a cmpxchg_emu_u16() function that emulates two-byte cmpxchg() in terms of four-byte cmpxchg() for architectures not having native instructions for this purpose. They also make use of this cmpxchg_emu_u16() function in those architectures, namely sh, arc, csky, and xtensa. This permits use of two-byte cmpxchg() in common code. However, it sadly does not permit easy implementation of all algorithms needing on two-byte atomic operations because there are some systems still supported by Linux that do not have native two-byte store instructions. There is reason to believe that these systems will soon no longer be supported by Linux." The last sentence of the pull request is arguably most interesting about mainline Linux potentially dropping "soon" systems not having native support for two-byte store instructions. C-SKY is interesting as that Chinese 32-bit CPU architecture was added to the Linux kernel in 2018 as perhaps the last new CPU architecture. Linux kernel developers remarked back then that due to the convergence on RISC-V moving ahead, the addition of C-SKY might be the last time they need to introduce a new CPU port/architecture to the kernel.

Original Source

Read the full article at Phoronix →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.