|
|
Log in / Subscribe / Register

Support for the TSO memory model on Arm CPUs

Support for the TSO memory model on Arm CPUs

Posted Apr 30, 2024 13:15 UTC (Tue) by farnz (subscriber, #17727)
Parent article: Support for the TSO memory model on Arm CPUs

Would it be workable to say that this state is per-thread, and that a thread in TSO mode cannot make syscalls other than to disable TSO mode?

For an emulator like FEX, this is perfectly reasonable; emit "switch to TSO mode", emit your JITted code, and at the end of a JIT block (when you're about to go back to Arm native code such as a FEX ThunkLib, or making a syscall), emit "switch out of TSO mode". It has a small performance hit (since you need to re-request TSO mode at each syscall boundary), but hopefully the advantage of running the core in TSO mode outweighs the hit from having to switch back and forth.

However, this isn't usable as a "quick hack" for applications that didn't take the memory model into account - you'd have to patch up every place that makes a syscall to switch out of TSO mode, make the syscall, and switch back, else it'll crash. If you do this, it's obvious looking at your code that you've got an evil hack in place, and thus clear that you didn't think about the impact.

Am I missing something critical here?


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds