Benjamin Herrenschmidt On PPC/Linux, Apple and OSS
MacBoy writes "The folks over at ResExcellence have a great interview with Benjamin Herrenschmidt, kernel guru for the PPC/Linux camp. He offers up some history of Linux on Apple and PPC hardware, and some discussion on Apple's current and past contributions to the open-source and Linux communities. He makes some interesting comparisons of Linux on PPC vs. Intel hardware, such as the ease of getting important patches into the kernel on PPC compared to Intel. It's an interesting read, especially if you are amoung the many who covet the new Dual-CPU GHz G4 Macs and want to know a little more about the PPC/Linux community."
PPC/Linux seems like an ambitious and technically interesting project, no doubt. Personally, though, I don't seem to understand the purpose. MacOs X is based on BSD, so you get all the nice Unix-like server features... and a decent GUI, something that Linux has never had. Are there some other advantages of Linux/PPC that I'm missing?
If guns kill people, then CmdrTaco's keyboard misspells words.
I was going to ask if anyone has Linux running on the new dual G4's, but then I found this cool link
http://linuxppc.org/hardware/dualg4/
Anyone have benchmarks (under Linux) for the dual G4's and corresponding PCs for:
- compiling the kernal
- GIMP
- Quake1/2 benchmarks
I'd love to get the "other endian machine" and compile some game code on it. Anyone have any recommendations? How did id do the Quake3 port to Macs ?
"PC Expert - Mac newbie"
Sence the site seems /.ed; Here's the article:
An Interview with Benjamin Herrenschmidt, PPC/Kernel Hacker.
by Michael Coyle
In the early days of PPC/Linux, it was extremely difficult to boot into the alternative OS. It required a three-finger keyboard command to boot into Open Firmware and then typing several lines of cryptic text.
Fortunately, thanks to work the of Benjamin Herrenschmidt and his free BootX Control panel, booting Linux in Old World Macs became much easier. It opened Linux to a large number of average Mac users. Today, several years later, BootX has been replaced by yaboot and Ben has moved on to become a major contributor to the PowerPC branch of the Linux kernel. Running Linux on a Powerbook or iBook with support for power management and accelerated graphics wouldn't be possible his efforts.
Born in Selestat, France twenty-nine years ago, Ben had his first computer at 8 years old (a ZX81) and by the age of 13 he was enrolled in his first "Technology Class". You wouldn't call him the "Teachers Pet", more likely a "Teachers Pest" since the instructor soon asked young Benjamin run the course for him.
His first exposure to the MacOS came when he ran a Mac emulator on Atari ST and Amiga computers. By college, Ben traded his Amiga computer for his first Mac. At that time, he had no interest in Linux, but enjoyed writing for the lower level bits and bytes. He adds,
"Unlike many other Linux hackers, Unix is a late discovery for me. After I sold my Amiga, I had the chance to have access to a Mac and started learning MacOS programming. I started doing that professionally after spending a couple of years having fun and drinking beer at the university. I quickly became interested specifically in device drivers and other kind of low level programming, and that's probably what led me to Linux."
Benjamin installed MkLinux on his Wallstreet PowerBook, but there was no Sleep support at that time. He contacted the maintainer of the PPC branch of the Linux kernel, Paul Mackerras, and asked permission to use his Linux/PPC PMU (Power Management) source code as the basis for an MkLinux version. Ben never finished the MkLinux version, but this introduction to Paul and PPC/Linux led to his switch from MkLinux to the PPC/Linux kernel where he rolled up his sleeves and dug in, fixing whatever low level drivers got in the way of enjoying Linux on his Powerbook. But what let to the development of BootX?
"At one point, I got fed up of floppy booting and used a code snipped I found on usenet that showed how to switch the CPU into supervisor mode. I used that to write BootX. That's how, slowly, I started using my knowledge of Macs and my MacOS hacking skills to work on improving Linux on Macs. But I've never been a Linux _user_, I'm still learning "newbie" tricks everyday. When it comes to userland, I believe I can't even write moderately complex shell scripts."
One advantage to being a developer on the PPC code base is how quickly your patches are accepted into the official Linux kernel. In the x86 world, there are substantially more developers trying to get their snippet of code added to the kernel, but in the PowerPC world, the pond is a lot smaller and it's easier to be a "Big Fish". While PPC is a smaller community, it's not limited solely to Apple hardware.
"The PPC tree has it's own complexities, mostly because we have to deal with a large set of very different machines and CPUs. From the PowerMacs, PRePs & CHRP, the 4xx and 8xx based embedded platforms, and even IBM pSeries and iSeries servers."
Because the source code is often available for Linux programs, the platform disparity that exists between MacOS and Windows is diminished. If a software developer compiles his project for the x86 architecture, the user of a PPC computer can simply compile the source on his own computer. Unfortunately, their are sometimes problems with the compilation. Are x86 developers reluctant to modify their code to accommodate PPC users, is Linux another OS where PowerPC users are given second class status?
"Well, except for some rare cases, I've never seen maintainers reluctant to merge in things like endian fixes. It's a bit more difficult when it comes to someone saying, "Hey, add that ugly hack that makes it work for me".
But Benjamin, do you make money writing Open Source software?
"So far, all my Linux work has been spare-time volunteer activity. I have a job in a nice small company where I mostly do MacOS software. Our company is evolving though, and we are now working on some embedded systems using Linux/PPC on IBM 405GP CPU. I do it (Linux/PPC Development) for fun and because I learned a lot of things doing it.
I quite like the concept of Free Software and am happy to put my work under the GPL umbrella. I believe at some point, computer science is like science in general, information and techniques have to be shared to benefit the most people and evolve.
I also feel these technologies have too important a position in our society, too many things depend on them, to safely leave them in the hands of an opaque monopoly. Free Software (or Open Source in this case) is a kind of guarantee that the technology you rely on can be trusted."
It seemed Apple would embrace Linux. there was even a ppclinux.apple.com website for awhile, but the site has disappeared as have most mentions of Linux from the Apple site. The boot process for MacOS X seems very similar to what happens in BootX and yaboot for Linux. Did you ever work for Apple? What is your opinion on how they view Linux?
"I did not work for Apple, but I used to (and still) know some Apple engineers. Apple use to have a "Linux technology manager", but I'm not sure I fully figured out what his role was, but he tried hard to get us hardware specifications (and mostly failed).
Apple's BootX and Linux BootX are two completely different things. yaboot is similar, but they were developed independently and share no code. There has been no collaboration here.
It's difficult to decrypt the reasons Apple does things. They didn't open source driver code for some third party hardware, but that is understandable. They might simply not have had the right to do so. Regarding drivers for Apple's own hardware, they did indeed "hide" a couple of them. What comes to my mind right now are the PMU driver (Power Management Unit) and the Firewire controllers driver (OHCI and Lynx chipsets)."
Still, by making Darwin, the core of MacOS X, more open, Apple must be helping the PPC/Linux group, even if inadvertently.
"Darwin code has been incredibly useful for some things. There is no documentation on the various Apple chipsets, so we have to "discover" them by either looking at the OF code (Open Firmware), disassembling MacOS bits, or reading Darwin drivers.
I have not used Darwin as a distro however. I do use MacOS X at work, and I quite like it. I have a machine running Linux 100% of the time, and one running MacOS (9 or X). In fact, I also run MacOS 9 in MacOnLinux on the Linux machine right now to write this email using CTM softwares excellent PowerMail"
PPC/Linux on a new Ti Powerbook
(Click for full image in a new window) It's possible Apple no longer actively supports Linux because the OS is multi-platform. In the final analysis, Apple is a hardware company. They leverage the MacOS to move CPUs. Since Linux runs on a variety of platforms, most costing less than Apple's hardware, support from Apple for Linux only increases the probability of migration to the x86 platform.
Still, it would be a mistake to think PPC/Linux lags behind the MacOS. It has always been fully multi-threaded and preemptive, features lacking in Classic MacOS, and Linux's hardware support exceeds MacOS X is some areas, PCMCIA and printing are two that come to mind.
Fortunately, the Mac/Linux community has volunteer coders, such as Ben Herrenschmidt, whose efforts keep an inexpensive and open source alternative to the MacOS available on PowerPC hardware.
Despite the early antagonism between the league for programming freedom and Apple, Macs and Unix went together pretty well. Long before samba, 680X0 Macs were sharing files quite nicely with unix servers. In many disciplines at universities, unix was used for heavy lifting, and macs were used for light word processing and making drawings.
Linuxppc has benefited from the generally better hardware on the PowerPC (higher quality and reliability, and less diversity). Also, for much of the '90s, the PPC chip was faster for many things than ix86. Recently, I had a 90 MHz powermac running KDE, xemacs, and Netscape without a hitch for months without any hiccups (a little slow but definitely useable). Under MacOS the thing would lock up several times a day. OS X is not an option for these older macs.
My old Mac died but I hope to get an ibook soon and put Linux on it. By the way, I wish there was something like fips for shrinking Mac partitions for people that want to dual boot.
The lmbench numbers show that linux is significantly faster for certain operations. I have a copy of the results that I pointed to in an old post over here. Linux spanks OS X. It's a reason.
Other reasons include access to all of the source of your OS and better support for certain things (pcmcia 802.11b card support? Better filesystems. More software already working).
I personally run Debian on my laptop 99% of the time because my environment is the same everywhere, and apt-get kicks ass (fink on OS X is cool, but there isn't as much stuff available).
Of course, the long-standing debate between Mac and Windows (I use the term generally) users has been that of their respective platform's performance. Sure, Max users complain that Windows is ugly, Windows user complain that Mac OS doesn't have enough apps...BUT, the big ticket is always when they start comparing Intel (or AMD) processors to their PPC competitors.
With Linux on both platforms, I would be interested to see some comprehensive real-world benchmarks comparing the two platforms. Really, I'm rather tired of the "Megahertz-myth" PPC touters and the "RISC sucks" x86 campions arguing which is better without any solid numbers.
-Jayde
What's a sig?
On one hand, you have them using and contributing to open source. On the other, you have them sending the lawyers after people who try to create a theme engine because they believe it is theoretically possible for someone to use it to violate Apple's trademarks.
You have them giving away developers tools a short while after they send their users firmware upgrades to prevent G3 users from upgrading (without telling the G3 users what the magical firmware upgrade did)
You have them sending firmware upgrades to block the use of RAM that doesn't meet Apple's strict standards, without telling users ahead of time the sticks they spent hundreds on are now utterly useless.
Apple can't decide wether it wants to be free and open, or continue to manifest its worst control-freak tendancies - ones that even rival Microsoft.
It's interesting that the article claims better peripheral support in LinuxPPC. I don't know what their data are to support this, but it's certainly true that peripheral support is a huge problem for MacOS X.
Other than that, I don't see a lot of good reasons to mess with LinuxPPC. People are posting saying MacOS X is slow, but I think it would be more accurate to say that certain parts of MacOS X are slow, e.g. Sherlock. But so what? Just use ``locate'' instead of Sherlock.
As far as open-source application software, I find it easy enough to use X Windows when I need to run GIMP or whatever. Why bother with a dual-boot system?
Find free books.
First, I am a app programmer and not a kernel hacker.
I am not a an expert, but this is how I understand it.
This is not intended to be a flame, if I make a mistake.. please correct it , not flame me. Thax.
Down to business.
There is a scheduler that will take the instructions of a program and put it into a queue. So if you have 15 different programs all running at the same time, you will have lots of processes needing a LOT of very simple instructions, which will wait in the queue until the CPU can get to it. I believe this is called the scheduler that handles this queue of instructions to the CPU.
Now, the scheduler is not going to feed any instruction to any cpu. It looks at the process and determines, the priority, the cpu it was at (to keep the cache hit ratio high on the cpu). At that point it starts feeding instructions through the scheduler. I believe that the starting process for a instruction stream would be the CPU that doesn't have load, or the least amount of load.. I would imagine.. but I guess that would be determined on how the schedular was written.
Anyhow, thats how I understand it.
Cheers
When (and only when) each instruction takes one clock cycle to execute you can divide each instruction inte several sub-tasks, for example Fetch - Decode - Execute - Store. Now a pipeline can be introduced:
instruction 1 F D E S
instruction 2 . F D E S
instruction 3 . . F D E S
instruction 4 . . . F D E S
In this way work is parallellised. Four instructions are executed in parallell, during 4 clock cycles each, giving a throughput of 1 instruction per second.
CISC basically means that instructions take different number of clockcycles to execute. With such an instruction set you can not use Pipelining.
The i386 cpus today transform the CISC instructions into RISC instructions, and apply pipelining. For the price of a translator the major drawbacks with CISC are avoided.
It is probably true that Intel has to put more research and silicon into a CPU than Motorola to achieve the same performance. But this is not because Intel are stuck with building a CISC cpu - it is because Intel must emulate the i386 CISC instruction set on a RISC cpu core.
With OS X the usefulness of Linux on the PPC platform is indeed brought into question, but article is still a good read.
It's interesting, however, to note that Linux people still miss the whole point of finding out about Mac OS X. Don't like it? Don't use it. But if you're smart you'll develop for hit. Read the O'Reilly Network, or any any other article, for writing in cocoa for MacOS X.
If there's anything missing in the viability of the comments about PPCLinux and its "questionable viability" you could well say the same thing about Linux in general as a desktop platform. It's going nowhere. Genome and KDE will not only never be the finished GUI that OS X is, but they also won't have the installed (and growing) desktop users that OS X has either.
New games are shipping for OS X, not ports, but original games. The recent O'Reilly network article about writing for cocoa represents an idea which any geek interested in making a living doing something besides tweaking SQL databases may want to consider.
Sure, the Mac OS X kernal, Darwin, itself offers much to users. But any Linux geek who likes to write code should give it even more serious consideration, its portability to other platforms, including Linux.
If you're hung up on the idea of free software disregard this, but if you're looking for a good *nix OS check out OS X if you're smart.
The one problem i personally can see and have experienced is that you cant find that much information concerning Linux on PPC online. Sure, there are some devoted sites line LinuxPPC.org and others, and groups.google.com is always a nice thing, but if you run into *specific* problems (like me, see further down that post) youre in for some serious pain.
I tried several times to put a usable linux distro on my old powermac 4400 (upgraded w/ a G3 procesor card, a voodoo3 2000 and a realtek-chip-based ethernet card).
Xfree will crash at startup, which can be only solved by going online, grabbing some drivers and compiling them into the kernel, which kind of sucks for a newbie - but thats not the point because I can't get online because the ethernet card is not recocnized even if I choose the realtek drivers.
So I did some google research, came up with the mentioned solution for XFree, but not for the ethernet problem.
Another point is that noone in your neighborhood can help because LinuxPPC is not as common as Linux for i386.
I'll try darwin next, but since my machine isn`t officially supported I`m not exactly optimistic about that.
If you're running Debian, you can post to the debian-powerpc mailing list and people will try to help you out. I don't know about the support for other distros, but I've found debian-powerpc to be more than adequate (especially considering the kernel hacker types also subscribe).
I always wondered why the people hacking away at Linux/PPC don't just fork the code base. Honestly, it seems like Linus has little or no interest anyway in the other architectures, and it could easily result in a much better end product.
--saint
Linux is often faster. Just like Intel Linux, it's possible to create a custom stripped down desktop with no fat. I've become accustomed to how things work on my Intel Linux machines and like having almost the same environment on my Pismo Powerbook. I also prefer the GNU utilities over the BSD ones (flame away...it's just a preference...get over it).
OSX is also next to useless on older hardware. We use 233Mhz Beige G3 desktop as an internal server. It's running ssh, Apache-SSL, NTP, mySQL, Apache, and Netatalk. The Apache/mySQL setup powers our troubleticket/inventory system. The Netatalk/Samba combo makes files available to both Mac and Windows clients. It does all of this with very acceptable speed and reliablity. The machine has zero need for a GUI...and doesn't have one. I suppose I could use Darwin but the machine wouldn't do it's work any better and I would have to mess with fussy ports of the daemons. It has full apt-get goodness....I forgot to mention that it is dead easy to admin.
So yeah, there are valid reasons to use Linux on PPC hardware.
As a group, BSD advocates are no more immune to licence zealotry and fanboyism than Linuxers. Anybody remember the picture of the Daemon doing Tux up the butt? How about the tiff the pf author got into with Theo and let's not forget his special "no GPL" license. I've also seen lots of BSD advocates get horked off over GPL forks of BSD code yet be delighted over proprietary forks. I even sometimes wonder if the entire universe would go up in a flash of gamma rays if Brett Glass were to ever shake hands with Richard Stallman.
If every instance of BSD and Linux were exchanged in your post it wouldn't come off any differently.
I had a little trouble getting all of the modules to work with one of his 2.4.17rc kernels. I figured what the hey and emailed him. He straightened me right out. I suppose the world of PPC Linux is small enough that a leading light can have a little time for an end user like me.
Why bother porting TCP/IP to the Lego RCX when it's already got its own functional IR communications routine?
Because you can.
Fact is that there's a lot of demand out there for non-Intel hardware. I'm in the process of updating my geek code because I just got a job building PCs. I've studied Scott Mueller's book and I find it truly amazing that the PC architecture even works; Northbridge-Southbridge is easy enough to understand on the face of it, but there is an amazing amount of crap that has to be dealt with just to get to a boot prompt.
PC hardware is nasty and skanky. Sun/Apple/anything customized usually is not. Someone may despise MacOS and yet look at the hardware and think it's pretty elegant. Some simply want the challenge of porting NetBSD or Linux to it.
/Brian
Lets forget about OS-X for a moment. What LinuxPPC does is fix the mac by providing a real operating system for it. There are macs where I work, and every time I'm stuck using one I start getting crazy notions in my head about taking a sledge hammer to them all, or finding some other way of destroying them. The reason has nothing to do with the hardware they are running. They're not super fast, but I'm not particularly picky in that area. What bugs me about them is the antique operating system they're running. If I wanted cooperative multi-tasking and no memory protection between apps, I'd run windows 3.1. When I sit down in front of a computer I expect the system to be responsive to me, regardless of what it is doing in the background.
One day about a year ago I loaded up the PPC version of SuSE 7.0 onto one of the macs. Lo and behold!!! A new computer was born! Or at least it seemed that way. The computer actually seemed to run FASTER as well as being infinitely more responsive. I was also a great relief to escape from the Macs GUI, which I find cumbersome. It was like I was trying to run with a cinder block tied to my leg and someone just cut the cord. Unfortunately I eventually had to wipe Linux and reinstall MacOS-9 on it.
Nowadays we have OS-X, which is about 6 years late, but better late than never. Its GUI isn't on par with KDE, but its far better than the previous MacOS versions. Its also responsive! Its great to actually be able to have my computer wait on me rather than the other way around. Its not terribly fast, but I'm not going to complain! Much better that it take longer to do things in the background but be more responsive in the foreground than it lock me out. Hopefully IBM/Motorola/Apple will be able to push the PPC architecture further in terms of clock rate.
Then of course there are the standard form-factor PPC motherboards that will soon be available. Whether they will ever outperform an Athlon based system is doubtful, but the fact that they are there and available is a good thing.
Lee
Muslim community leaders warn of backlash from tomorrow morning's terrorist attack.
Obviously you want a Sun laptop instead of a Mac, so why not just buy one?
Nothing against OSX, but in all honesty even a fully loaded Linux desktop will take less RAM than OSX. I'm running a fully loaded KDE right now, with Mozilla (rumor says it's bloated), StarOffice 6.0, and Kmail, and my used (not cache) memory is only at 64MB. Note that only KDE and Kmail share many libraries.
I don't know where people get this idea that you need a ton of memory to run these programs. Granted, 128MB is little on the high side if you're talking real low end, but these are desktop workstations, as you said. OSX requires that 128 at a bare minimum, and even that maxed out when I was using 10.0 (don't know if they decreased the RAM requirements as of 10.1, but I doubt it). Linux apps just don't take as much memory as people say. KDE gets you a solid UI with a lot of bells and whistles for relatively low memory cost. Plus, the inclined desktop user could simply run fluxbox or twm, which isn't possible without Darwin, in which case you can't easily switch to Aqua. OSX is great, but Linux has its advantages too.
"I may not have morals, but I have standards."