|
|
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 12:27 UTC (Tue) by wtarreau (subscriber, #51152)
Parent article: Support for the TSO memory model on Arm CPUs

I undertand Will and he's right. A few years ago when I started to test haproxy on the Neoverse-N1 platform, I discovered that it would randomly crash and misbehave. It had weaker atomics than its predecessors and my code was just too unrigorous to accommodate to that. This notion of memory models was totally unclear to me by then; nobody except a few tens of people on earth really know how each memory model works (and Will definitely is one of them BTW). After a few weeks of work (and help from the CPU designer) we addressed the problems and started to be stricter in our way to use atomics. Now it's one of the most scalable platforms, if not the most scalable one. Now I wish there was a way to disable TSO on x86!

If I had had this prctl available, what would have happened ? Very easy, looking at the random crashes, Google would have directed me to other people solving this problem by placing this prctl() in the startup chain and voilĂ ! Not only the code would never have been fixed, but it would have remained suboptimal and I would not have learned anything about my bad practice. Thus I'm really glad this prctl didn't exist!

Also there are other problems: it's not just a matter of process, it's a matter of code. Programs are dynamically linked with external libraries nowadays. What if a library was designed with TSO in mind and not the rest of the code ? How will one detect that the whole code needs to be protected ? IMHO that's more of an ABI problem than anything else, and if something had to be done, it should be by claiming to be a different architecture variant so that it is the kernel that recognizes a binary as working in this or that mode, and that programs can only link with compatible libraries. This way it still allows to port existing code using that explicit architecture variant, but it also imposes it on the whole ecosystem (the set of dependencies), just like some use compat32 for example. This would void the risk that users start to randomly stuff that into their programs to solve bugs, and make sure that it's only used when there is a compelling reason to do so.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


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