Gentoo Archives: gentoo-dev

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: combining x86 and amd64
Date: Sat, 03 Sep 2005 03:58:06
Message-Id: pan.2005.09.03.03.54.33.135013@cox.net
In Reply to: Re: [gentoo-dev] combining x86 and amd64 by splite-gentoo@sigint.cs.purdue.edu
1 splite-gentoo posted <20050902193322.GB2116@××××××××××××××××.edu>,
2 excerpted below, on Fri, 02 Sep 2005 14:33:22 -0500:
3
4 > Actually, what I want is a 32-bit x86 userland with a 64-bit kernel and
5 > multilib'd gcc, bintools, and glibc. In other words, a 32-bit userland
6 > that my users can still compile and run their 64-bit number crunchers on.
7 > They don't need 64-bit X11, KDE, GNOME, etc. They do, however, want their
8 > Flash and Acroread plugins to work.
9 >
10 > Anyone have a way of doing this that doesn't involve wholesale plundering
11 > of binaries from an amd64 box? [] Or am I the only one who thinks this
12 > is a pretty neat idea (digital watches notwithstanding)?
13
14 Disclaimer, I'm a Gentoo AMD64 user, not a dev...
15
16 It's a neat idea, but might not be quite the "best of both worlds" you
17 may well believe you are getting. Perhaps you are aware of the following
18 and believe full 32-bit compatibility is easier (if a bit more hassle due
19 to the "by hand" you mention). If so, great, be it far from me to say
20 you have it wrong when I don't know the specifics of your installation; if
21 not, a slightly different alternative, as explained, might be better, and
22 certainly easier given that you wouldn't have the "by hand" stuff. Even
23 if you still want a mostly 32-bit userland, there's a solution below that
24 should be less hassle than what you describe as your current one.
25
26 In general, you are quite correct, 64-bit doesn't normally offer that much
27 other than flatter memory access and better number crunching in certain
28 situations. On pretty much any bi-arch other than amd64, your solution
29 would be perfect.
30
31 However, the x86/amd64 performance difference is somewhat larger than
32 that, due to x86 architectural peculiarities. The biggest of these is
33 x86's relative lack of named registers, as compared to other modern
34 architectures. 64-bit AMD64 addresses this weakness by adding additional
35 registers. However, for compatibility reasons, these registers aren't
36 available in 32-bit mode, only in 64-bit mode.
37
38 The result is that while (admittedly pulling numbers out of the air for
39 demonstration's sake, the argument is sound, do your own research on
40 specific numbers, if desired) 60 or 70 percent of apps on most archs would
41 get little benefit from switching to 64-bit, but would instead actually
42 lose performance due to the additional memory requirements of 64-bit over
43 32-bit, on AMD64, the same 60 or 70 percent will likely see improvements,
44 despite the larger working size and memory requirements, due to use of the
45 additional registers. Efficiency can be increased somewhat further with
46 -frename-registers and similar tricks to make better use of all available
47 registers.
48
49 Due primarily to the "register factor", it thus makes better sense to run
50 a general 64-bit userland than it might on other platforms, and this is
51 what Gentoo for AMD64 is designed for, for the most part. Gentoo AMD64's
52 multilib setup makes it possible to run the 32-bit binary-only apps, and
53 from-source 32-bit apps with 32-bit binary-only codecs and plugins, that
54 you may need, while at the same time being designed "out of the box" (or
55 should that be "from the profile"??) to run a general 64-bit userland
56 where 32-bit is /not/ necessary, because that's generally most efficient
57 for the reasons explained above.
58
59 Note, however, that you still have a couple of options, one of which
60 would end up pretty close to what you describe, only without the "by hand"
61 hassle you have at the moment.
62
63 The normal profile and setup is designed, as already mentioned, to
64 emphasize 64-bit. However, on top of that, while it enables 32-bit, it is
65 designed to emphasize minimal-maintenance-hassle 32-bit, over maximum
66 run-time-efficency 32-bit. A number of the 32-bit compatibility libraries
67 are by default binaries, of less optimization than normal, because they
68 are designed to run on both ia64 (Itanium) and amd64. Likewise with the
69 32-bit binary applications such as mozilla-firefox-bin, if you choose to
70 install them.
71
72 Note that due to portage limitations (it can't track 32-bit and 64-bit
73 dependencies separately at this time) it's not wise to use the 64-bit
74 system-wide portage to install 32-bit stuff (other than the 32-bit
75 binary-only stuff). However, you still have options...
76
77 For those that want optimized 32-bit, the recommended solution is to run a
78 32-bit chroot. There are instructions in the amd64 technotes, but the
79 idea is that after you set up your 64-bit system, you setup a 32-bit
80 chroot. In it, you setup a 32-bit profile and generally emerge anything
81 you want 32-bit, including all dependencies, in that profile. Because
82 you are running a separate 32-bit only copy of portage, with its own
83 database, in the chroot, it won't interfere with the 64-bit main system
84 copy.
85
86 Now, normally, one would still run a mostly 64-bit system, including
87 whatever system daemons (cron, syslog, etc) and general applications one
88 would normally be running, presumably only merging applications that had
89 32-bit-binary-only dependencies (along with the from-source
90 dependencies, in 32-bit form as well) in the chroot. However, there's
91 really nothing stopping you from merging and running most of your system
92 as 32-bit, with the 64-bit "main" system being only a minimal base, if
93 that's what you prefer. Given the "register factor" above, however, IMUO
94 (U=user), it still makes more sense to run the general system as 64-bit,
95 on amd64, and only run 32-bit where necessary for compatibility reasons.
96 However, that's just "MUO" and "YUO" may well be quite different. Since
97 it's your boxen we are talking about, it's "YUO" that applies. =8^)
98
99 Finally, this should have really been posted to the amd64 list, not the
100 devel list, thus not bothering all the devels who don't do AMD64. There
101 are many there, both users and devs, quite willing to help, and it's
102 certainly more a topic for there than for here. So... while Gentoo devs
103 are usually pretty nice about answering anyway, and I'm replying here as
104 well so maybe they won't have to and can keep doing the good things they
105 do as devs bringing us all those nice ebuilds to play with =8^), please...
106 for any followups and for next time, post gentoo-amd64 questions to the
107 gentoo-amd64 list, OK? That's what it's there for. =8^)
108
109 --
110 Duncan - List replies preferred. No HTML msgs.
111 "Every nonfree program has a lord, a master --
112 and if you use the program, he is your master." Richard Stallman in
113 http://www.linuxdevcenter.com/pub/a/linux/2004/12/22/rms_interview.html
114
115
116 --
117 gentoo-dev@g.o mailing list