|
|
Log in / Subscribe / Register

Support for the TSO memory model on Arm CPUs

Support for the TSO memory model on Arm CPUs

Posted Apr 26, 2024 22:52 UTC (Fri) by willy (subscriber, #9762)
In reply to: Support for the TSO memory model on Arm CPUs by Heretic_Blacksheep
Parent article: Support for the TSO memory model on Arm CPUs

you seem nice


to post comments

Support for the TSO memory model on Arm CPUs

Posted Apr 26, 2024 23:21 UTC (Fri) by Wol (subscriber, #4433) [Link] (11 responses)

Dunno what I think about Heretic Blacksheep, but he has a point :-(

There's too many stories about stuff being blocked because maintainers don't like it, with minimal or no technical justification, and sometimes a blunt "over my dead body".

I can accept maintainers being sceptical and wanting to be convinced, but one only has to look at the people who don't want Rust anywhere near their subsystem, or that module that's supposed to configure hardware (can't remember the details) where it seems a single driver for a single board is unacceptable - the functionality supposedly needs to be spread across several drivers and castrated in the process ...

There are a few maintainers who seem to think that users are major inconvenience to a well functioning system - well they are, aren't they?

Cheers,
Wol

Support for the TSO memory model on Arm CPUs

Posted Apr 26, 2024 23:31 UTC (Fri) by pizza (subscriber, #46) [Link] (10 responses)

On the other hand, the maintainers usually have a far better view and understanding of the overall system (and are therefore in a better place to make educated judgements) than individual driver authors or (especially) users.

Case in point: "Android Linux" vs "Mainline Linux", and how everyone+dog cobbled stuff together and bashed at it until the former "worked" with no consideration of the cost (or even the necessity) of ongoing maintenance. Repeat that for every SoC maker, or SoC family, or individual SoC, or even individual devices.

The "Android" features that finally made it into the mainline bore little resemblance (and is vastly superior) to what was first shipped en masse, and that doesn't even touch on how much stuff never even saw a release in source code form.

Support for the TSO memory model on Arm CPUs

Posted Apr 27, 2024 0:12 UTC (Sat) by Wol (subscriber, #4433) [Link] (5 responses)

> On the other hand, the maintainers usually have a far better view and understanding of the overall system (and are therefore in a better place to make educated judgements) than individual driver authors or (especially) users.

And if a maintainer says "convince me", then that's fine. It's when the maintainer says "I'm not interested in any arguments, the answer's no", that we have a problem.

The problem as far as I'm concerned, is that too many experts have been brainwashed into thinking they know best, and need bashing over the head with a clue-by-four. If they're not prepared even to ask the question "does the proposer have a point", then they ought to go.

Your Android stuff, I'm not saying it was the best way to do it, but cobbling together a system that works, and then fixing it so it's acceptable to mainline, is the way Linux works. But sometimes mainline has the attitude "to hell with users, I want an easy life". You're left with the feeling on occasion that the kernel is actively hostile to user-space, forgetting that without user-space there's no point in having a kernel.

Cheers,
Wol

Support for the TSO memory model on Arm CPUs

Posted Apr 27, 2024 2:05 UTC (Sat) by nksingh (subscriber, #94354) [Link] (4 responses)

I think part of the issue here is that ARM Ltd. has a strong opinion that the architecture should have a weak memory model and all software written for ARM should be ready to handle it.

They are using their maintainership over the upstream ARM kernel port to enforce their viewpoint as the owner of the architecture. But they're kind of doing it in a way that might hamper adoption for people who want to efficiently emulate x86 binaries. Maybe there are no ARM inhouse cores that support tlany TSO extensions so they don't care yet.

Support for the TSO memory model on Arm CPUs

Posted Apr 27, 2024 6:26 UTC (Sat) by pbonzini (subscriber, #60935) [Link] (3 responses)

As far as I understand, Apple is a funding member of Arm. As such, they are allowed to implement non standard extensions whereas most other vendors can't.

Support for the TSO memory model on Arm CPUs

Posted Apr 27, 2024 17:59 UTC (Sat) by thoughtpolice (subscriber, #87455) [Link] (2 responses)

Yes, in practice all the cores that implemented it are custom designs, and Fujitsu, Nvidia and Apple are all architecture licensees, so they're allowed to do that. Not all of Nvidia's custom designs, at least, use TSO; Carmel (Xavier) is TSO only, while Denver2 (TX2) is weakly ordered.

TSO is a bit weird though because I was under the impression ARM's rules were something like "Non-standard extensions can't be externally 'visible' or documented for consumption and the core must fully comply with the spec." That's why Apple doesn't (and probably can't!) document extensions like this one, that allows TSO to be toggled. But the memory model is pretty visible? Maybe it's all a bit weaselly; after all, if the default memory model is stronger than the spec requires, then every correctly written weakly ordered program should behave the same anyway, so it's not "visible". On the other hand, incorrect programs may behave differently than they would under a weak model, but you could argue that TSO behaviors are "just" a subset of weakly ordered behaviors, and thus it's in spec.

Support for the TSO memory model on Arm CPUs

Posted Apr 28, 2024 4:46 UTC (Sun) by anton (subscriber, #25547) [Link]

Yes, weak ordering is not an architectural feature, it's a lack of a defined feature. An implementation that provides stronger ordering still satisfies the architectural requirements. And unlike, say, an additional instruction, where the architecture actually requires a specific behaviour (typically an illegal instruction exception) when the encoding for the new instruction is encountered, but the implementation with the additional instruction behaves differently, a stronger ordered implementation satisfies the (lack of) architectural requirements of the weakly ordered architecture. Another way of looking at it is that a program written for a weakly ordered architecture will behave as intended on an implementation with stronger ordering, so there is no test to say that the strongly ordered implementation does not satisfy the requirements of the architecture.

My guess is that this clause in the architectural license is indeed there to prevent licensees from squatting on currently unused instruction encoding space or currently illegal behaviour that ARM intends to reserve for future extensions.

The only thing that might be an issue here is the switch that Apple implemented. I guess they implemented it in something like a model-specific register (i.e. an area that the architecture leaves for implementations to define), and then that should satisfy the architectural license. I wonder, though, why Apple bothered with the switch; why not just do what Fujitsu did according to the article, and implement TSO throughout?

Support for the TSO memory model on Arm CPUs

Posted Apr 29, 2024 20:28 UTC (Mon) by justincormack (subscriber, #70439) [Link]

Apple does not actually anywhere refer to their cores as Arm (its Apple Silicon please), and Arm does not usually refer to them at all. Of course everyone else does.

Support for the TSO memory model on Arm CPUs

Posted Apr 28, 2024 20:22 UTC (Sun) by quotemstr (subscriber, #45331) [Link] (1 responses)

Android has facilities vastly superior to anything available in the GNU/Linux ecosystem. Consider linker namespaces, which comprehensively solve the ELF single namespace dynamic linker mistake. Consider the extremely efficient no-IPC system properties interface. Consider Binder, which beats the pants off dbus (on both performance and functionality) any day of the week. The broader "Linux" community would do well to learn, humbly, from Android.

Support for the TSO memory model on Arm CPUs

Posted Apr 29, 2024 5:59 UTC (Mon) by ssmith32 (subscriber, #72404) [Link]

But the original argument was not about the facilities provided by the implementations, it was about the quality of the implementation.

I can't speak to the quality of the Android implementation, but I've definitely seen the following pattern in languages (C++ some, but, particularly Java). Heck, I've seen analogs in applications and entire systems..

It goes like this..

Everyone agrees some aspect of the language/standard library is bad and horrible.

But, instead of getting a clean implementation upstreamed, they hack together some framework of horror (if one looks at the implementation), that putatively improves the situation (if one only looks at the features provided).

Eventually, the language incorporates a clean solution (since doing it right takes time), but all the consultants and folks who carved out a niche understanding the (often poorly documented) framework of horror, now have a sunk cost, and it takes ages to convince them to transition to just using the nicely implemented, performant, well-documented language/standard library features.

Maybe this isn't the situation with Android - but nothing in your argument rules it out.

Android could very well provide some nice features to the users *and* be a pile of unholy hacks. This is not an uncommon situation in many areas of programming and computer systems in general.

Worse is not necessarily better, despite what the gods have said to us.

Support for the TSO memory model on Arm CPUs

Posted Apr 28, 2024 20:45 UTC (Sun) by Cyberax (✭ supporter ✭, #52523) [Link] (1 responses)

> Repeat that for every SoC maker, or SoC family, or individual SoC, or even individual devices.

Android now has a single image that works across all the devices: https://source.android.com/docs/core/architecture/kernel/...

> The "Android" features that finally made it into the mainline bore little resemblance (and is vastly superior) to what was first shipped en masse

Which ones?

> and that doesn't even touch on how much stuff never even saw a release in source code form.

Android core has always been Open Source.

Support for the TSO memory model on Arm CPUs

Posted Apr 29, 2024 6:02 UTC (Mon) by ssmith32 (subscriber, #72404) [Link]

Yeah, but Android *core* hasn't always been a terribly useful set of software. The situation has gotten better, but, that's not really what people mean when they talk about the Android ecosystem in general.

Support for the TSO memory model on Arm CPUs

Posted Apr 28, 2024 14:47 UTC (Sun) by Heretic_Blacksheep (guest, #169992) [Link] (3 responses)

Arbitrariness and capricious argument are what I expect out of religious fanatics. The reasons given by two of the Arm code contributors stinks of religious zealotry not well reasoned and thought out objections, hence my reaction. "Who died and made you god?" is a common question when dealing with this kind of problem. It's a colloquialism just like every culture on earth has. It signifies strong negative reaction, nothing else.

Support for the TSO memory model on Arm CPUs

Posted Apr 28, 2024 15:28 UTC (Sun) by pizza (subscriber, #46) [Link] (2 responses)

> "Who died and made you god?"

The Arm maintainers, like all other maintainers in the F/OSS world, are maintainers because they've consistently shown up and done this hard, usually thankless work for many, many years. The Arm architecture is in far, far better shape now thanks to their work.

In other words, they have earned (and continue to earn!) their godhood.

Can you say the same about yourself?

Support for the TSO memory model on Arm CPUs

Posted Apr 29, 2024 14:03 UTC (Mon) by hmh (subscriber, #3838) [Link] (1 responses)

Well, you have what effectively is a new, incompatible-with-others architecture variant (ARM64TSO ?) that is capable of running programs for the other architecture (ARM64), but the opposite isn't true. Just like i686 userspace running on AMD64/X86-64 kernels... But without the benefit of being actually considered a separate architecture or variant, and thus creating a massive amount of headaches later on, *including* to users, distros, etc.

But is it any different from other optional extensions to the ARM64 ISA, which not everybody provides (is there such a thing)? I don't know enough about it to even give an "IMHO" about it, but to someone without enough information, it comes to mind that maybe it is just in need of being implemented to look like, e.g., AMD64+AVX2 support is to generic AMD64 (but with the IOCTL toggle or whatever form it should take: maybe something in ELF)?

Support for the TSO memory model on Arm CPUs

Posted Apr 30, 2024 7:54 UTC (Tue) by epa (subscriber, #39769) [Link]

There's a moral dimension to it that other architecture extensions don't have. If a new CPU supports a new instruction, and you decide to use it to speed up your program, you are simply taking advantage of new hardware. No doubt you continue to provide an alternative, slower implementation for older CPUs. You're not being a bad person by using the new instruction -- except, perhaps, if it's patented and only available on processors from one litigious, grasping manufacturer. (Although in olden days there was sometimes a mild "naughtiness" associated with using undefined opcodes of an 8-bit processor, arising from "don't care" states in the design, which had strange but occasionally useful semantics.)

But here there is a true path revealed to us. The designers of ARM, in their wisdom, have provided a plain and humble concurrency model. The righteous programmer will take care to follow its strictures. Not for us the worldly luxury of TSO as practised by the followers of Intel and the AMD-ites. If one group of ARM developers is allowed to get lazy and become addicted to the easier memory model, that's unfair to those who have remained virtuous. Indeed, others might be led astray and start to demand support for TSO everywhere. And then where would we be?


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