News for hackers. Stuff that matters.
Re:Arm's Cortex X925: Reaching Desktop Performance by dinglo on Tuesday March 03, 2026 @04:24AM (#47230143)
If ARM starts dominating in desktop and laptop spaces with a quite different set of applications, might we start seeing more software bugs around race conditions? Caused by developers writing software with X86 in mind, with its differing constraints on memory ordering.
Re:Arm's Cortex X925: Reaching Desktop Performance by vardump on Tuesday March 03, 2026 @05:28AM (#47230541)
That's a possibility. Some code still assumes (without realizing!) x86 style ordered loads and stores. This is called a strong memory model, specifically TSO, Total Store Order. If you tell x86 to execute "a=1; b=2;", it will always store value to 'a' first. Of course compilers might reorder stores and loads, but that's another matter.

ARM is free to reorder stores and loads. This is called a weak memory model. So unless it's explicitly told to the compiler, like C++ memory_order::acquire and memory_order::release, you might get invalid behavior. Heisenbugs in the worst case.

Re:Arm's Cortex X925: Reaching Desktop Performance by Fire-Dragon-DoL on Tuesday March 03, 2026 @11:02PM (#47242906)
Is this only for constants or even for instructions?

Like:

a=fooMethod(); b=otherMethod()

Will this be reordered?

Re:Arm's Cortex X925: Reaching Desktop Performance by vardump on Wednesday March 04, 2026 @03:37AM (#47244724)
Depends on the processor's store queue. It might be. Of course if otherMethod() is anything more complicated, 'a' will almost certainly be assigned first. Of course you should still do the order dependent assignment correctly, like by using C++ std::memory_order or atomics.
Re:Arm's Cortex X925: Reaching Desktop Performance by cmrdporcupine on Tuesday March 03, 2026 @07:41AM (#47231468)
This is actually one reason I feel like developing my systems level stuff on ARM64 instead of x86 (I have a DGX Spark box) is not a bad idea. Building lower level concurrent data structures, etc. it just seems wiser to have to deal with this more immanently.

That said, I've never actually run into one of these issues.

Re:Arm's Cortex X925: Reaching Desktop Performance by dd_xplore on Tuesday March 03, 2026 @04:36AM (#47230215)
The major issue is these days most software is electron based or a webapp. I miss the days of 98/XP, where you'd find tons of desktop software. A PC actually felt something that had a purpose. Even if you spin up a XP/98(especially 98/2000 VM) now, you'd see the entire OS feels something that you can spend some time on. Nowadays most PCs feel like a random terminal where I open the browser and do some basic work(except for gaming ofcourse). I really hate the UX of win 11 , even 10 isn't much better compared to XP. I really hope we go back to that old era.
Re:Arm's Cortex X925: Reaching Desktop Performance by rbanffy on Tuesday March 03, 2026 @05:14PM (#47239839)
> Nowadays most PCs feel like a random terminal

It's a fun perception. For the longest time, all the "serious" computers were used through networks and terminals and didn't even come with any ability to connect a monitor or a keyboard (although a serial terminal would work as the system console). I used to joke (usually looking at Unisys Windows-based big servers), if the computer had VGA and PS/2 ports, it wasn't a computer, but a toy. Those Unisys servers weren't toys, but you could run Pinball and Minesweeper directly on them, which kind of said otherwise.

I think we got used to such levels of platform bloat that we don't care if the UI toolkit these days is bigger than the entire operating system that runs 95% of the world's payment transactions.

Re:Arm's Cortex X925: Reaching Desktop Performance by pjmlp on Wednesday March 04, 2026 @05:47AM (#47245707)
Those of us that keep using Windows or macOS, can still find native applications for many cases, especially because the culture of accepting to pay for small utilities.

It is the Year of Desktop Linux that keeps being inundated with Electron crap, to detriment of Gtk, Qt, KDE, and whatever else is out there.

Re:Arm's Cortex X925: Reaching Desktop Performance by dd_xplore on Wednesday March 04, 2026 @10:53AM (#47249305)
Linux apps today dont have that feel of apps that we had in 98/2000 era or even XP era. Windows platform had really good apps.
Re:Arm's Cortex X925: Reaching Desktop Performance by ivolimmen on Tuesday March 03, 2026 @04:31AM (#47230190)
If you go around your OS yes that could be the case but you can already have issues using the application from machine to machine with the same OS having different amounts of RAM and different CPU's. But I am not an expert in these matters.
Re:Arm's Cortex X925: Reaching Desktop Performance by runeks on Tuesday March 03, 2026 @04:51AM (#47230312)
Wouldn't the compiler take care of producing the correct machine code?
Re:Arm's Cortex X925: Reaching Desktop Performance by octachron on Tuesday March 03, 2026 @05:32AM (#47230566)
The issue is that the C memory model allows more behaviours than the memory model of x86-64 processors. You can thus write code which is incorrect according to the C language specification but will happen to work on x86-64 processors. Moving to arm64 (with its weaker memory model than x86-64) will then reveal the latent bug in your program.
Re:Arm's Cortex X925: Reaching Desktop Performance by Someone on Tuesday March 03, 2026 @06:18AM (#47230859)
And “happen to work on x86-64 processors” also will depend on the compiler. If you write

  *a = 1;
  *b = 'p';
both the compiler and the CPU can freely pick the order in which those two happen (or even execute them in parallel, or do half of one first, then the other, then the other half of the first, but I think those are hypothetical cases)

x86-64 will never do such a swap, but x86-64 compilers might.

If you write

  *a = 1;
  *b = 2;
, things might be different for the C compiler because a and b can alias. The hardware still is free to change that order, though.
Re:Arm's Cortex X925: Reaching Desktop Performance by rbanffy on Tuesday March 03, 2026 @05:17PM (#47239871)
This architecture trick was often used for precisely this - finding bugs in the program that would work in one architecture and fail in another. A very common class of issues like these was about endianness, and PowerPC was very handy because it could boot as both high and low-endian modes (I think I remember different versions of Linux for each mode, but I'm no longer sure).
Re:Arm's Cortex X925: Reaching Desktop Performance by jasomill on Tuesday March 03, 2026 @06:12PM (#47240456)
Starting with POWER8, the Linux kernel and some of the BSDs support 64-bit PowerPC in both big- and little-endian modes. Older PowerPC chips had more limited support for little-endian, and all the commercial desktop/server PowerPC OSes that come immediately to mind (classic Mac OS, Mac OS X, NEXTSTEP / OpenStep, OS/400 / IBM i, AIX, BeOS) are big-endian only.

As you'd expect, Linux distribution support for big- and little-endian varies.

Re:Arm's Cortex X925: Reaching Desktop Performance by mrweasel on Tuesday March 03, 2026 @06:21AM (#47230874)
OpenBSD famously keeps a lot of esoteric platforms around, because running the same code on multiple architectures reveal a lot of bugs. At least that was one of the arguments previously.
Re:Arm's Cortex X925: Reaching Desktop Performance by lproven on Tuesday March 03, 2026 @11:59AM (#47235297)
Which is why Windows NT was multiplatform in 1993.

Developed on Intel i860, then MIPS, and only then on x86, alongside Alpha.

Re:Arm's Cortex X925: Reaching Desktop Performance by spijdar on Tuesday March 03, 2026 @04:49PM (#47239540)
Big endian MIPS, no less! At least initially.
Re:Arm's Cortex X925: Reaching Desktop Performance by rbanffy on Tuesday March 03, 2026 @05:19PM (#47239887)
I don't think the i860 port lasted very long. IIRC, the performance in context switches was atrocious.
Re:Arm's Cortex X925: Reaching Desktop Performance by lproven on Wednesday March 04, 2026 @04:43AM (#47245224)
It didn't make it to release, and I believe MS switched internal development more or less as soon as it had an alternative. I do not recall reading any specific detailed look into why, so you may well be right!

Intel let the i860 and indeed the slightly older i960 wither, which was a damned shame. Ditto the Alpha it ended up with, while it sold its Arm licence to Marvell, which at one point recently was worth more than Intel.

I'd like to see a skunkworks project to resurrect one, or several, of these. :-) Attack Arm from a direction it's not expecting. And RISC-V come to that.

Re:Arm's Cortex X925: Reaching Desktop Performance by mhh__ on Tuesday March 03, 2026 @04:53AM (#47230322)
The compiler relies on the language and programmer to enforce and follow a memory consistency model
Re:Arm's Cortex X925: Reaching Desktop Performance by wat10000 on Tuesday March 03, 2026 @06:38PM (#47240732)
What is "correct"? If you write code that stores two values and the compiler emits two stores, that's correct. If the programmer has judged that the order of those stores is important, the compiler may not have any obligation to agree with the programmer. And even if it does, the compiler is likely only obligated to ensure the ordering as seen by the current thread, so two plain load instructions in the proper order would be enough to be "correct." But if the programmer is relying on those stores being seen in a particular order by other threads, then there's a problem.

Compilers can only be relied on to emit code that's correct in terms of the language spec, not the programmer's intent.

Re:Arm's Cortex X925: Reaching Desktop Performance by Zardoz84 on Tuesday March 03, 2026 @06:40AM (#47230993)
If it is programmed in assembly. This kind of nasty detail should be handled by the compilers.
Re:Arm's Cortex X925: Reaching Desktop Performance by askl on Tuesday March 03, 2026 @06:52AM (#47231090)
If it's programmed in assembly, it just wont compile for a different architecture.
Re:Arm's Cortex X925: Reaching Desktop Performance by jordiburgos on Tuesday March 03, 2026 @05:06AM (#47230411)
Only for the hand-written assemply parts of the source code. The rest will be handled by the compilers.
Re:Arm's Cortex X925: Reaching Desktop Performance by bpye on Tuesday March 03, 2026 @05:19AM (#47230480)
You don't need to be writing assembly. Anything sharing memory between multiple threads could have bugs with ARM's memory model, even if written in C, C++, etc.
Re:Arm's Cortex X925: Reaching Desktop Performance by silon42 on Tuesday March 03, 2026 @05:18AM (#47230477)
Not even close. Except maybe in Rust /s
Re:Arm's Cortex X925: Reaching Desktop Performance by galangalalgol on Tuesday March 03, 2026 @06:25AM (#47230901)
For rustaceans missing that /s, if you just use Relaxed ordering everywhere and you aren't sure why, but hey tests pass on x86, then yeah on arm it may have a problem. On x86 it effectively is SeqCst even if you specify Relaxed.
Re:Arm's Cortex X925: Reaching Desktop Performance by IshKebab on Tuesday March 03, 2026 @04:52PM (#47239569)
I think that's less likely than you'd expect because the memory ordering model used by C++ and others essentially requires you to write code that works even without x86's total storage order. If you don't then you can get bugs even on x86, because the compiler will violate the ordering you thought you had in your program, even if the CPU doesn't.

Also most software runs on ARM now and I don't think that has actually happened in practice.

Re:Arm's Cortex X925: Reaching Desktop Performance by rbanffy on Tuesday March 03, 2026 @05:06PM (#47239735)
> Also most software runs on ARM now and I don't think that has actually happened in practice.

At least in my house, ARM cores outnumber x86 cores by at least four to one. And I'm not even counting the 32-bit ARM cores in embedded devices.

There is a lot of space for memory ordering bugs to manifest in all those devices.

Re:Arm's Cortex X925: Reaching Desktop Performance by IshKebab on Wednesday March 04, 2026 @02:13AM (#47244191)
The number of cores is fairly similar actually. X86 has been commonly 2 or 4 core for decades, and ARM is only recently more than that.
Re:Arm's Cortex X925: Reaching Desktop Performance by wat10000 on Tuesday March 03, 2026 @06:33PM (#47240685)
It's definitely a real issue in real code, since the CPU isn't bound by things like function boundaries or alias analysis or pointer validity. For example:

  x = *a;
  if (x) y = *b;
The compiler cannot reorder the load of b before the load of a, because it may not be a valid pointer if x is false. But the CPU is free to speculate long ahead, and if the pointer in b isn't valid, that's fine, the CPU can attempt a speculative load and fail.

It's not particularly common and code that has this issue will probably crash only rarely, but it's not too hard to do.

Re:Arm's Cortex X925: Reaching Desktop Performance by IshKebab on Wednesday March 04, 2026 @02:10AM (#47244168)
I don't understand your example. That code is correct on both architectures.
Re:Arm's Cortex X925: Reaching Desktop Performance by wat10000 on Wednesday March 04, 2026 @01:03PM (#47251349)
Memory ordering issues require two sides to manifest, since even the most extreme out-of-order architecture presents itself as in-order to a single thread.

Imagine that code was paired with code in another thread that did:

  *b = newValue;
  barrier();
  *a = 1;
We put a barrier here to ensure the stores don't get reordered, since we must write out the new value in b before writing out the flag in a that tells the other code to use it.

Paired with this, my example above will work fine on an architecture with strong ordering, but will potentially get a bad value into y on archs with weak ordering. The reader may fetch the value in b first, getting the value before the reassignment. It may then fetch the value in a and see 1. This will cause it to use the old value loaded from *b, which is semantically incorrect in this case even though it's perfectly correct according to the architecture and the language spec.

Correct code here would need an acquire barrier on the load of a, paired with a release barrier on the store.

Re:Arm's Cortex X925: Reaching Desktop Performance by martin1975 on Monday March 16, 2026 @07:20PM (#47406411)
Curious, what type of code and in what language do you write that the compiler wouldn't take care of this without you even trying?