The x32 subarchitecture may be removed
If there are x32 users out there, now would be a good time for them to
speak up.
Posted Dec 12, 2018 17:05 UTC (Wed)
by fuhchee (guest, #40059)
[Link] (7 responses)
Posted Dec 13, 2018 15:44 UTC (Thu)
by jimuazu (guest, #129212)
[Link] (6 responses)
Posted Dec 13, 2018 23:03 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (5 responses)
It's been around for at least 6 years, and it's still not popular enough to reach Joe User. I'd say that qualifies as "not popular enough", personally - if it was worthwhile, surely Debian would have an x32 port by now?
Posted Dec 14, 2018 10:43 UTC (Fri)
by gspr (subscriber, #91542)
[Link] (4 responses)
Posted Dec 14, 2018 12:41 UTC (Fri)
by lkundrak (subscriber, #43452)
[Link] (3 responses)
> What doesn't [work]: Gnome3, Iceweasel (WIP in #775321), Chromium (needs llvm), libreoffice (some java JNI issue). KDE works but is buggy. Sound ...
There's a warning on the site that the information might be outdated, but this might still explain why x32 isn't all that popular.
Also, the proposed Iceweasel (Firefox) patches just disable optimizations, which sort of defeats the purpose of an ABI whose solemn purpose seems to be to squeeze out extra bits of performance.
Posted Dec 14, 2018 12:43 UTC (Fri)
by lkundrak (subscriber, #43452)
[Link]
some of proposed Iceweasel (Firefox) patches
Posted Dec 14, 2018 21:41 UTC (Fri)
by sorokin (guest, #88478)
[Link] (1 responses)
Disabling optimization is a bit ambiguous term. One might think it is about compiler optimization. Apparently the patches are about disabling assembler code in libjpeg-turbo because yasm doesn't support x32. The other change is disabling JIT for javascript.
Posted Dec 16, 2018 0:51 UTC (Sun)
by louie (guest, #3285)
[Link]
Other than that, Mrs. Lincoln, how was the play?
Posted Dec 12, 2018 17:19 UTC (Wed)
by jccleaver (guest, #127418)
[Link] (3 responses)
The discussion about similarity to other architectures with different sizes brings up good points. Rather than remove x32, I feel like Rich's point about this being an important test case should provide motivation for keeping it around.
https://lwn.net/ml/linux-kernel/20181211233316.GN23599@br...
If there's funkiness in x32 *per se*, then maybe abstract it out so that it and other architecture variants that need to translate syscalls do so in a more maintainable manner, but don't rip the whole thing out due to perceived lack of use if other groups still will have to solve that problem somehow. That just makes more work overall.
Posted Dec 13, 2018 0:46 UTC (Thu)
by luto (guest, #39314)
[Link] (2 responses)
Posted Dec 13, 2018 16:51 UTC (Thu)
by jensend (guest, #1385)
[Link] (1 responses)
Posted Jan 8, 2019 18:57 UTC (Tue)
by plugwash (subscriber, #29694)
[Link]
x32 was designed (under Linus's direction) to be as similar to x86-64 as possible, only differing from it in cases where doing so was nessacery to follow posix. Unfortunately this lead to it falling unconfortably between the two stools, it's data structures end up being different from both x86 and x64 but the framework designed to support 32-bit compatibility on 64-bit kernels was only designed to support a single backward compatibility mode.
As I understand it arm64ilp32 instead takes the approach of making the new ilp32 mode as similar to the old 32-bit mode as possible. This approach keeps the changes required more localised but Linus did not like it because it also brings forward legacy baggage from the 32-bit architecture (the example Linus used was the year 2038 issue).
Posted Dec 12, 2018 17:45 UTC (Wed)
by sorokin (guest, #88478)
[Link] (15 responses)
Removing x32 support completely seems like a step backward to me. The benefits of using 32-bit pointers in memory bandwidth limited application are measurable. From my understanding CPU are becoming more and more memory bandwidth limited over time. Also typically the higher the abstraction level of the programs the more memory bandwidth demanding the program is. I guess halving the size of pointer should definitely help and I'm absolutely sure that x32 abi is a much cleaner way of having 32-bit pointers on 64-bit machines than any other approach.
It's a pity that x32 haven't got bigger adoption yet, but my understanding it's more a chicken and egg problem than a technical problem.
Posted Dec 12, 2018 17:56 UTC (Wed)
by josh (subscriber, #17465)
[Link] (11 responses)
You can still use 32-bit pointers (or indexes) in your own application in x86-64 mode, if you want to minimize memory usage. Some applications do that.
Posted Dec 12, 2018 18:23 UTC (Wed)
by sorokin (guest, #88478)
[Link] (9 responses)
In theory yes. This is what I referred as "less clean other approaches". One can replace pointers with indices if all data is stored in one big array. Not all programs are like this. GCC is an example of a pointer-heavy application that has no easy way to replace all pointers with indices.
Posted Dec 12, 2018 18:34 UTC (Wed)
by josh (subscriber, #17465)
[Link] (8 responses)
It's not necessarily a good idea, but then, most applications shouldn't be doing it.
Posted Dec 12, 2018 18:53 UTC (Wed)
by sorokin (guest, #88478)
[Link] (7 responses)
Definitely not a good idea. Consider one has a pointer-heavy application and one wants to move it to 32-bit pointers. He has to replace pointers (T* with something like lowmem_ptr<T>), smart pointers (unique_ptr<T> with lowmem_unique_ptr<T>), smart point factories (make_unique<T> with lowmem_make_unique<T>), containers (does specifying lowmem_allocator work here?), providing lowmem_malloc (right?).
This process is invasive and it is not revertible easily. One can say "Still this is possible". Yes it is possible, but it is so complicated that no one will do this. That why I said "In theory yes". In practice it means no.
Compiling for x32 abi is a much cleaner solution.
Posted Dec 12, 2018 23:37 UTC (Wed)
by linuxrocks123 (subscriber, #34648)
[Link] (5 responses)
I'm guessing there might be something I'm missing here, because, otherwise, I don't know why they wouldn't have done it that way to begin with.
Posted Dec 13, 2018 5:56 UTC (Thu)
by eru (subscriber, #2753)
[Link] (4 responses)
Sounds like the "memory models" of MS-DOS and 16-bit Windows C compilers. You can certainly make it work, but you must make sure that all modules are compiled with the same memory model option, and any precompiled libraries you link against are for the same memory model as your code, or you need extensions or #pragmas to define "far" function prototypes. I'm not sure it is worth it. In MS-DOS this caused all sorts of fun, but was necessary for allowing C programs access more than 64k of memory. For x32_64 there is no such compelling reason.
Posted Dec 13, 2018 7:26 UTC (Thu)
by ibukanov (subscriber, #3942)
[Link] (2 responses)
Posted Dec 13, 2018 13:15 UTC (Thu)
by eru (subscriber, #2753)
[Link] (1 responses)
True, when you compiled all your code with the same memory model options. But you did need them for external libraries (that may or may not use the same memory model), and low-level code. (And of course for optimizations, as you noted). As I recall, the Microsoft compiler had four memory models for all combinations of near/far function and data pointers. (Some compilers had even a fifth, "huge", that permitted arrays larger than 64k). We obviously could reach the same number of models with 32 vs 64 data and function pointers, and relive the memory model mess-ups of the 1980's....
To quote one of the posts above, "Don't go there".
Posted Dec 13, 2018 14:38 UTC (Thu)
by ibukanov (subscriber, #3942)
[Link]
A memory model with 32-bit code and 64-bit data can be useful. We are still far away from 4GB executables even when accounting for JIT.
Posted Dec 13, 2018 16:26 UTC (Thu)
by nybble41 (subscriber, #55106)
[Link]
But that's already true for x32 code. The ABI proposed by linuxrocks123 (32-bit pointers but x86_64 system calls) would be similar to x32 but implemented entirely in userspace, with pointer size translation at the user <-> kernel boundary.
Posted Jan 6, 2019 18:01 UTC (Sun)
by jwakely (subscriber, #60262)
[Link]
Yes, in theory. In practice not all of GCC's std:: containers do the right thing yet, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57272
Posted Dec 22, 2018 13:18 UTC (Sat)
by berndp (guest, #52035)
[Link]
Posted Dec 14, 2018 4:12 UTC (Fri)
by mst@redhat.com (subscriber, #60682)
[Link] (2 responses)
Posted Dec 14, 2018 22:41 UTC (Fri)
by ballombe (subscriber, #9523)
[Link] (1 responses)
Posted Dec 15, 2018 7:52 UTC (Sat)
by jrn (subscriber, #64214)
[Link]
Posted Dec 12, 2018 18:26 UTC (Wed)
by epa (subscriber, #39769)
[Link] (18 responses)
Posted Dec 12, 2018 18:41 UTC (Wed)
by josh (subscriber, #17465)
[Link] (17 responses)
The only reason the kernel needed to care about the x32 architecture was for cases where the kernel supplies memory to userspace. Beyond that, it was an entirely userspace concern for how to compile binaries.
I half wonder if you could replace x32 support in the kernel with a prctl that makes the kernel default to MAP_32BIT for your process.
Posted Dec 12, 2018 19:23 UTC (Wed)
by plugwash (subscriber, #29694)
[Link] (15 responses)
Unfortunately that is not true, if all the kernel had to care about for x32 was limiting memory allocations we wouldn't be having this discussion.
The problem is that data structures that pass between kernel and userland are defined in terms of the standard C types including long and pointer. The Linux kernel has a mechanism designed for handling a "backwards compatibility architecture", but said mechanism was only designed to handle one such architecture. x32 is different from both i386 and amd64. The result is that at least according to the lkml thread that led to this article the handling of x32 syscalls is a hacky mess.
An alternative approach would be to define data structures used for kernel to userland interfacing without using the standard C long and poitner types. This would make the system non-poxix compliant and require a compiler extension to allow compiling code with mixed 32-bit and 64-bit pointers but it may be a more workable way forward than the current approach.
Posted Dec 12, 2018 20:18 UTC (Wed)
by ibukanov (subscriber, #3942)
[Link] (14 responses)
Posted Dec 12, 2018 21:32 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (6 responses)
Posted Dec 13, 2018 7:01 UTC (Thu)
by ibukanov (subscriber, #3942)
[Link] (5 responses)
Posted Dec 13, 2018 8:18 UTC (Thu)
by cladisch (✭ supporter ✭, #50193)
[Link] (4 responses)
As far as I can see, this assessment has not changed since then.
Posted Dec 13, 2018 13:31 UTC (Thu)
by plugwash (subscriber, #29694)
[Link] (3 responses)
Other than time and file offsets I can't think of much that has a pressing need to be 64-bit on 32-bit systems.
Posted Dec 13, 2018 19:02 UTC (Thu)
by jccleaver (guest, #127418)
[Link] (2 responses)
This absolutely is key. If this decision were to be rolled back in the interests of a meaningfully usable x32, it would be a great step.
Posted Dec 13, 2018 23:22 UTC (Thu)
by farnz (subscriber, #17727)
[Link] (1 responses)
Why? 64-bit time for 32-bit architectures is worth the effort because there still exist 32-bit only systems being sold today (ARM Cortex-R range, including new designs, for example, not to mention embedded systems using older ARMv7-A cores, plus anything designed around the DM&P Vortex86 SoCs or RDC's Emkore and IAD chips which are x86 CPUs with no 64-bit support). Thus, we need to address this anyway; these chips are going to be around for a while, and saying that brand new hardware designed in 2019 (or probably 2020) is going to be worthless before 2038 isn't exactly nice.
OTOH, x32 is just a potential speedup for users who could use amd64 or i386 ABIs; it doesn't expand the user base by any significant amount, and does involve engineering effort.
Posted Dec 14, 2018 8:30 UTC (Fri)
by joib (subscriber, #8541)
[Link]
Posted Dec 12, 2018 21:37 UTC (Wed)
by ken (subscriber, #625)
[Link] (6 responses)
Posted Dec 13, 2018 8:36 UTC (Thu)
by epa (subscriber, #39769)
[Link] (5 responses)
Posted Dec 13, 2018 11:01 UTC (Thu)
by NAR (subscriber, #1313)
[Link]
Posted Dec 13, 2018 11:47 UTC (Thu)
by excors (subscriber, #95769)
[Link] (2 responses)
ARM NEON does let you split up registers like that - the 32-bit registers S0 and S1 are the two halves of the 64-bit register D0, and D0/D1 are the two halves of 128-bit Q0, and so on up to D30/D31 = Q15. But that makes it much harder for an out-of-order CPU to accurately determine dependencies between instructions and do correct register renaming, so AArch64 got rid of that aliasing - now S0/D0/Q0 share one physical register, S1/D1/Q1 share another, etc. Better to sacrifice some utilisation of register space in exchange for a simpler and more efficient microarchitecture.
Posted Dec 13, 2018 16:38 UTC (Thu)
by epa (subscriber, #39769)
[Link] (1 responses)
I agree, it doesn't really seem worth the effort in general, but perhaps in some tight inner loop that works with 32-bit arithmetic it might make a difference.
Posted Dec 13, 2018 19:36 UTC (Thu)
by excors (subscriber, #95769)
[Link]
If you have a tight inner loop where such tiny differences matter, you should be using SSE/AVX anyway so that you're loading 128/256/512 bits at once and doing all your arithmetic with SIMD instructions.
Posted Dec 13, 2018 12:01 UTC (Thu)
by joib (subscriber, #8541)
[Link]
For x86 with mem-op instructions and register renaming, 16 GPR's is for most purposes enough.
Posted Dec 12, 2018 19:48 UTC (Wed)
by jem (subscriber, #24231)
[Link]
Or simply declare them 'int'. Integers are 32-bit on x86_64 Linux; pointers and longs are 64-bit. (On 64-bit Windows even longs are still 32-bit).
With 64-bit ints, declaring your variables int32_t wouldn't help, because of C's type conversion rules: arithmetic operands are converted to at least int before the operation.
Posted Dec 13, 2018 17:07 UTC (Thu)
by jalla (guest, #101175)
[Link] (3 responses)
Posted Dec 19, 2018 11:29 UTC (Wed)
by arnd (subscriber, #8866)
[Link] (2 responses)
If you indeed run x32, can you please reply to the email thread and explain what distro you have, why you chose x32, and what keeps you from migrating to either x86-32 or x86-64?
Posted Jan 6, 2019 17:58 UTC (Sun)
by jwakely (subscriber, #60262)
[Link] (1 responses)
The confusion isn't helped by Windows-land using "x64" to refer to x86_64, which unsurprisingly leads to people thinking that "x32" is just another name for x86-32 aka IA32 aka x86. Sigh.
Posted Jan 6, 2019 18:33 UTC (Sun)
by excors (subscriber, #95769)
[Link]
And watch out for IA-32 (x86) vs IA-64 (Itanium) vs IA-32e (AMD64). It's like a time capsule of Intel's ambitions in the early 00s.
Posted Dec 13, 2018 17:30 UTC (Thu)
by bircoph (guest, #117170)
[Link]
Of course in some synthetic cases results are better, but x32 complexity and maintenance burden is not worth it.
Posted Dec 14, 2018 18:21 UTC (Fri)
by thyrsus (guest, #21004)
[Link] (1 responses)
Posted Dec 14, 2018 19:58 UTC (Fri)
by k8to (guest, #15413)
[Link]
Posted Dec 27, 2018 8:57 UTC (Thu)
by sorokin (guest, #88478)
[Link]
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
> It's not necessarily a good idea, but then, most applications shouldn't be doing it.
The x32 subarchitecture may be removed
It seems like the compiler should be able to make pointers 32-bit on its own, [...]
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
In MS-DOS and Windows 3.* there were mostly no need to annotate pointers with __near and __far keywords.
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
> And I really do think that a new 32-bit ABI is *much* better off trying to be compatible
> with x86-64 (and avoiding things like 2038) than it is trying to be compatible with the
> old-style x86-32 binaries. I realize that it may be *easier* to be compatible with x86-32
> and just add a few new system calls, but I think it's wrong.
>
> 2038 is a long time away for legacy binaries. It's *not* all that long away if you are
> introducing a new 32-bit mode for performance.
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
Other flavours
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
https://flameeyes.blog/2012/06/23/debunking-x32-myths/
The x32 subarchitecture may be removed
The x32 subarchitecture may be removed
Perhaps it will be interesting to someone. On the net there are mentions of architecture called arm64_32 which uses 32-bit pointers using 64-bit arm instructions (aarch64) [1] [2]. Googling for it doesn't show many results. Presumably it is used by Apple in their smart watches [3] [4].The x32 subarchitecture may be removed
What I understand from the little details found on web. Programs for Apple Watch used to be compiled for armv7 architecture. Apple anticipated the transition to aarch64 and they required all programs to be shipped not only with normal binaries, but also with a dump of llvm intermediate representation. At some point Apple updated their hardware to aarch64 and they retranslated the intermediate representation of all programs to aarch64.
One should note here that llvm intermediate representation doesn't abstract away pointer sizes and is not architecture independent. In fact it can not be architecture independent because C code after preprocessing is not architecture independent. So as I understand the programs are compiled as if for armv7 and therefore the layout of all structures in arm64_32 matches exactly the layout of structures in armv7 with all its upsides and downsides.
From what I get they use it not for efficiency, but for compatibility with existing 32-bit binaries. Still I think it is an interesting approach to having 32-bit pointers on 64-bit architecture.
