Gentoo Archives: gentoo-user

From: Michael Mol <mikemol@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: x32 ABI
Date: Tue, 31 Jul 2012 05:03:55
Message-Id: CA+czFiC4uprfe-fgyq-Aj=Z-VpGerzd06t8_YjLAM9x-2RSd6g@mail.gmail.com
In Reply to: Re: [gentoo-user] Re: x32 ABI by Walter Dnes
1 On Tue, Jul 31, 2012 at 12:21 AM, Walter Dnes <waltdnes@××××××××.org> wrote:
2 > On Tue, Jul 31, 2012 at 05:47:22AM +0300, Nikos Chantziaras wrote
3 >
4 >> That's a problem with x86, not x32. x32 is a 64-bit mode. It's a
5 >> new ABI :-)
6 >
7 > The original poster asked...
8 >
9 >> What are the benefits and drawbacks of using the x32 ABI, other
10 >> than the obvious "experimental" cautions? I currently do not have
11 >> a computer with more than 4GB of ram, and one only has 2GB (used as
12 >> a media center).
13 >
14 > x32 is a backwards compatability shim for use under 64-bit mode. The
15 > point I was trying to make was that the minimum memory where 64-bit has
16 > clear advantages is 4 gigs. If you have 3 gigs or less, you can stick
17 > with 32-bit mode, and x32 libs become moot.
18
19 The only reason they're the "clear" advantages is because it's much,
20 much harder to adequately describe the advantages given in things such
21 as:
22
23 * Doubling the number of general-purpose registers. The compiler has a
24 _lot_ more wiggle room for efficiently arranging data during
25 execution.
26 * Doubling the number of SSE registers. You can process a lot more
27 data a lot more quickly without the round trip latency of getting to
28 your GPU.
29 * Decreasing the pressure on memory allocators to allocate memory in a
30 way that avoids fragmentation. This is a function of the larger
31 virtual address space, and has nothing to do with the amount of
32 physical memory you have.
33 * Changing the calling convention to reduce function prologues, and to
34 enable some fancy optimizations.
35
36 It's also commonly forgotten that a process's address space is divided
37 between userspace and kernelspace; the kernel takes its piece of your
38 process, too, meaning that even if you have 4GB of RAM, you can't
39 create a 3GB heap allocation or mmap 3GB of data. And that has nothing
40 to do with the architecture's mapping of your video card's memory into
41 your system's physical address space.
42
43 People pound on the "3-4GB of RAM, and you should use x86_64" because
44 it was the easiest way to justify x86_64 to people when it came out;
45 AMD didn't retain full compatibility with x86 when the processor is in
46 long mode, nor does the compatibility mode (which is what x86 ELF
47 binaries running under an x86_64 kernel) have all of the features of
48 the legacy x86 ISA. AMD discarded them for a variety of reasons, even
49 though it meant breaking compatibility with a lot of code that was out
50 there. These days, that doesn't seem like a big deal, but there was
51 doubt at the time as to whether or not AMD64 would take off. Even
52 Microsoft bet the wrong way on that one, initially announcing its only
53 64-bit platform would be Itanium.
54
55 To get around the bad press, people pointed to RAM. AMD64 long mode
56 carried real benefits over PAE for enterprise applications, and AMD's
57 parts kept things like instruction reordering, whereas Intel's Itanium
58 ditched it, hoping that compilers would cover the difference. So, for
59 enterprise, where you often had servers with a whopping 16GB of RAM
60 and terabytes of mmap()-able data, the improved address space was a
61 major boon.
62
63 Meanwhile, home users just kinda trotted along. It took Unreal's
64 developers complaining they needed to be able to fit gigabytes of
65 texture, object and model data into RAM before you really started
66 seeing AMD64 pick up steam on home systems. Even then, Windows desktop
67 users didn't get real 64-bit support until Vista. (Yes, there was a
68 64-bit version of XP, but driver support there was and is abysmal).
69 But by the time users started installing Vista, they'd already had 4GB
70 of RAM in their systems and were wondering why their BIOS POST
71 sequence would say they only had, say, 3.6GB.
72
73 So, again, people started pounding on the RAM barrier as a reason to
74 switch to AMD64. People in userland still didn't notice things like
75 additional registers, because they didn't (and don't) understand them.
76 It's not something they see as as part of their POST process or as a
77 visible part of a spec sheet, so it's not something they jockey over.
78 But it's far more important than whether a part has a 90nm feature
79 size or a 45nm feature size.
80
81 It's true enough; if you have enough RAM, you certainly should be
82 using x86_64. The opposite isn't true, though; even if you don't have
83 enough RAM to demand 64-bit pointers, that doesn't mean you shouldn't
84 be using x86-64.
85
86 --
87 :wq