Archive for December, 2006

OpenFirmware on OLPC

Sunday, December 31st, 2006

I know, I was going to forget all of this. But now, there’s . Mitch Bradley posted a patch which exposes the Open Firmware three as a filesystem, once again. Naturally, an arument happens. On one hand, sparc and powerpc both did it before, so adding yet another openpromfs is just getting ridiculous. On the other hand, Mitch just wants something little and unencumbered. He does not want to create common code and be a subject to constraints imposed by other users. I am not going to judge this. The question which interests me is, why in the world does OLPC use OpenFirmware?

From the perspective of firmware, an OLPC system uses 3 major parts: LinuxBIOS, OF, and OS (usually Linux, but it can be Windows). At system startup, LinuxBIOS initializes the system and invokes OF. If it were a SPARC system, LinuxBIOS would have been called “POST”. Afterwards, OF is accesses the boot media (Big NAND flash, wireless, or USB) and boots the OS. I do not know for sure if OF or LinuxBIOS present the interface to the OS when it runs, but I presume it’s OF.

So, the issue is that although I obviously do not know the details, the OF appears redundant. Firstly, after-boot firmware interface is completely unnecessary for OLPC. The ACPI in case of Intel is a way to avoid publishing details about CPU frequency and voltage mangement for them. But on OLPC, these things are presumably documented. For crying out loud, this thing runs on a Geode! Going further, OF is used to boot things. That is good, but it’s not as if these bootstrappers could not be written, say, in Java. They are separate programs plugging into LinuxBIOS (or taking over). Booting over the wireless is something that Etherboot could do just as easily.

The OF is not cost-free. It uses space (in flash and in RAM). On SPARC OBP runs into the region of 200 to 500KB. The may be not entirely trivial for OLPC. Also, it takes some time to initialize, and it runs slowly. And finally, nobody can ever fix anything in it… except Mitch.

I just can’t understand what OF brings to the table that advances the goals of OLPC. A unified way to select a bood device from the “ok” prompt, perhaps? Seems somewhat valuable… for a general purpose platform. This is some kind of a mystery.

usbmon on Solaris, OSX, or BSD

Saturday, December 30th, 2006

A thought just occured to me (ok, I’m slow). What do people on Solaris, OSX, or BSD use for a usbmon equivalent? As far as I can tell, MS Windows does not have a system-level standard API, and Snoopy Pro serves as a kind of ad-hoc standard. It’s quite likely that the rest just get by with ad-hoc tools. I suppose the magic of DTrace might allow for a degree of usbmon equivalent on Solaris, by placing correct probes in key places. Not that I’m dying to know, but it’s curious.

SCSI strikes back

Friday, December 29th, 2006

A day has passed since I proclaimed my trust into the SCSI stack and happens:

[1742510.144326] usb 1-6.4.2: USB disconnect, address 15
[1742510.173818] BUG: unable to handle kernel NULL pointer dereference
 at virtual address 0000000c
[1742510.173838] Oops: 0000 [#1]
[1742510.173840] PREEMPT
[1742510.173915] EIP:    0060:[]    Tainted: G   M  VLI
[1742510.173931] EIP is at klist_del+0×9/0×49
[1742510.173993]  [] device_del+0×17/0×161
[1742510.174009]  [] __scsi_remove_device+0×34/0×62
[1742510.174021]  [] scsi_forget_host+0×5e/0×9a
[1742510.174029]  [] scsi_remove_host+0xad/0×14b
[1742510.174041]  [] quiesce_and_remove_host+0xcf/0xd3 [usb_storage]
[1742510.174089]  [] storage_disconnect+0×11/0×1b [usb_storage]
[1742510.174106]  [] usb_unbind_interface+0×41/0×81 [usbcore]

Yeah, this would not have happened if he used ub. But ub is dead, so what now? Now I must look at scsi_host.c. So not fun.

BTW, the second of the four oopses which happened to ub, occured when I cut a corner with locking and forgot about preemt. It’s an extremely strict model under which to program.

{Update: DaveJ pointed out an MCE taint.}

Our long international nightmare is almost over

Thursday, December 28th, 2006

It appears that I have no choice but to terminate ub.

Reasons are several. Although ub by itself is the best driver I have ever written, the coexistance issues with usb-storage gave rise to hackish code in libusual. Such code always metastases. Greg Kroah indulged me while I was able to sweep problems under the carpet, but brought it to the head. [1]

One of the ways ub attempts to be bugless is to avoid the James’ SCSI stack and plug into the Axboe’s block layer. But USB devices are SCSI devices, and so ub carries inside a miniature SCSI stack. This is architecturally wrong, and anti-social, for a net win of 120KB of RAM. Every hour I spend working on ub is one less hour spent fixing problems with much wider applicability. Jeff Garzik’s libata trusts SCSI, and is hotplug-aware. Now that it includes PATA, it puts SCSI into critical stack for millions. [2] Why shouldn’t I trust SCSI more?

I am sad to see ub go, somewhat. I do not have an emotional attachement to it, but it was a very convenient reservoir of good quality code to steal. On the other hand, I suspect that few people trusted it enough for this to be effective. This was evident when ub uncorked problems in CFQ scheduler using a spinlock with an improper lifetime.

Looking at the upside, ub begat usbmon, and usbmon is quite successful. Or at least it is useful for others, which pleases me. Maybe it was all worth it.

[1] I looked at a number of ways to mend the situation, some of them quite fantastic.
#0 - Throw ub out.
#1 - Merge ub into usb-storage, as it was originally intended to be. This, however, removes the possibility of running it standalone.
#2 - Kill libusual and just have two drivers without any cooperation. This is going to bring up Bunk with new cries.
#3 - Just have libusual with the bias, but keep device tables attached to (sub-)drivers. Almost same memory use as #1, ub is kept separate. The best alternative, but I expect that carrying a useless driver is going to tick people. Don’t forget that Rusty’s modprobe loads all modules which match an alias.
#4 - The class hook. This is rejected by Greg once, but I suppose I could while and plead a bit more.
#5 - Split libusual into little static piece and the big module with the alias table (”libusual0″). Solves Fedora problems, but what happens if someone does “modprobe usb-storage”?
#6 - Intercept uevent inside sysfs. Impossible to execute quetly and without Greg’s approval, far messier code than #3.
#7 - Devise a way to form modules.alias while libusual is static by clever modifications of scripts/mod/modpost, Makefiles, and modutils.

[2] I think that from the architectural point of view Jeff is wrong and the “more correct” way is to plug PATA and SATA disks into the block layer, like ub does. Emulating SCSI commands in sofware is dumb. However, I suppose Jeff had his reasons.

Just a thought

Wednesday, December 27th, 2006

I never imagined how hard it may be to find which “uevent” is responsible for loading a particular module. That is all.

P.S. “last_sysfs_file[]” does not help. Of course.

Lain redux

Wednesday, December 27th, 2006

Thanks god it’s over.

I finished Lain because a certain someone likes that kind of anime. I am already plotting to feed her Mushishi.

Those who place Lain on the same shelf with Haibane Renmei make me wonder. It’s nowhere close. The biggest difference is, Haibane Renmei is more coherent. It might not explain everything, but it explains more. Also, it is constructed so explanation is not paramount. In Lain, it’s the opposite, the worst of everything: the story is hallucinatory, and so explanations are necessary. But the explanations have to scoop deeper and deeper into Intelligent Design with every new question. And they have to twist the facts, too, because “facts” can’t be strung together.

When I was done with Lain , I reached for the , and it sort of made sense. But when I entered the second half of the show, the lunacy of an attempt to establish a rational framework where Abe himself had none became palapable. Just about every event cried for an alternative, incoherent vision or what was happening. For example, Alice plainly remembered Lain quite well when she wanted to e-mail her. But if we attempt to explain this in a coherent way, it can’t be possible, and so we have to postulate that she actually didn’t and only had a deja-vu (because this would not be coherent with her behaviour at their later meeting when she clearly did not remember).

Complete explanations of Naruto face exactly the same problem. Neither Kishimoto nor Abe thought out their respective worlds in the detail required to sustain such explanations. So when the question of overseas nations with nuclear power arises, the answer is… a magical shield (if that). Heck, nobody can even explain why radio exists while telephone does not, or why an outboard engine exists, but not a car. At least in Naruto there’s a story (a bunch of stories), character development, and heck… the fighting. But Lain is devoid of anything except hallucinations about god of the machine.

I think Abe knew just how bad Lain was, exactly where, and why. This is why Haibane Renmei was so much better. Different director might’ve helped a bit too.

Liked: No
Rewatch: Never again

Sub? Dub? Raw? No, it was a Voice-over!

Monday, December 25th, 2006

Apropos which I saw today, I wanted to share a recollection to which some LJ readers from abroad might relate.

When I was a boy, I watched quite a few movies being neither subbed or dubbed, but rather being “voice-overed”: the translated dialog was recorded over the original soundtrack. This way all the sound effects of the original were preserved. Although it was associated with VHS pirates in 1990s, the technique was used for legitimate translations in 1960s and 1970s. The technology was a celluloid film with a magnetic strip. This is how I saw Lassie, IIRC. I think Flipper was dubbed traditionally though, but it’s hard to remember now.

All in all, it was a unique experience, which is hard to explain. I would not claim that the voice-over technique was necesserily superior (and nothing is superior to raw), but I know that when I watch in sub these days, I see notably less detail than when I watch raw. This is because my mental bandwidth is not all that great. But it happens to the best of us as well. Mike Melvill once said that when he flew SS1 under the rocket power for the first time, he did not hear anything and did not see anything except the flight director display. When he flew it for the second time, he stole a glace out of a port. When he flew it for the third time, he heard the roar of the rocket engine, which actually was deafening. But before, he had to concentrate on piloting the spaceship so much that he tuned it out completely.

So, no matter how good the font is, subtitles take eyes off the action in a non-trivial way.

200 man nin no kanken etc. etc. etc.

Monday, December 25th, 2006

So, I got the chance to pull from under the tree and unpack my DS and . The first thing I had to do was to enter my name. And just as feared, the damn thing took the long horizontal stick wrong, so I’m “ピ一ト” instead of ”ピート”. Can’t see the difference? I couldn’t either… until I saw the name written vertically. And apparently, there’s no way to change a player’s name or create a new player (well, there are two slots, but not beyond that). Carramba, as they say in Brazil.

Also, DS does not have anti-aliased fonts for kana and kanji. Lame. I mean, seriously, people… the system is powerful enough to recognize handwritten kanji and can’t render a TT font? I’m not buying it. Oops, I guess I just did buy it. Well, I still don’t believe that it’s some kind of a system limitation. Must be a holdover from Gameboy days.

{The game renders anti-aliased fonts just fine, but not the firmware, ROM, or whatever DS has without a cartridge.}

{[This is an informational update for Alaric which I wanted to preserve - my backup system does not save comments.]

“Ichi” is a kanji in its own right, which means “one”, although it’s just one horizontal stroke, like em-dash. Many printed fonts add little serif on the right end, although the brushstroke end has no hook, strictly speaking.

The other glyph has no sound, it just extends the previous vovel. I’m sure it has a name, only I do not know it. It’s used with katakana where double or extension vovels are written in hiragana.

When letters are written vertically, “ichi” remains horizontal (of course), because its shape is the horizontal line. But the extender becomes vertical and thus easily distinguishable. I do not think a kanji exists which consists of a single vertical line. There’s such a radical, called “bo”, but it’s not standalone.

The advent of pens and computers screwed some aspects of Japanese writing. Not being able to form pretty stroke endings with a ball pen disturbs me.}

Thumbdrives

Monday, December 25th, 2006

You just can’t make this stuff up:

Hardware periperals are another factor - once anyone can plug any mouse or USB thumbdrive bought off NewEgg or Amazon into Linux and It Just Works, Linux’ fortune will markedly improve.
[]

Astonishing, isn’t it? I can’t believe that he selected two kinds of devices which Just Work in Linux to illustrate his point. Plug a thumbdrive in, and Nautilus shows a drive icon. No shell, no fuss. This is possible because both of these types have well defined and well supported USB classes (HID and Mass Storage), which cover the ground all the way up into the application stack. This is important because, for instance, Printer has a well defined class too, but it only covers the transport, and so the necessary filters have to be used. But for a thumbdrive, it’s just a block device and lots of HAL/Gnome/Nautilus magic (thank David Zeuten if you have a chance).

{Forgot to mention - no, I do not habitually scan Internet looking for people writing hilariously retarded things about Linux… The guy has an anime blog which I follow.}

{Update 2007/01/08: We have the answer [], which claims that the stick “simply would not mount” on the GE box. Also, commenters look at the issue from varying angles.}

Vandread 1/2

Friday, December 22nd, 2006

It’s over, I’m done with the first half of Vandread. Probably not taking the second half, at least for a while.

This show is problematic for me for many reasons, such as 3D which I can’t stand (not as bad as Pilot Candidate, but not far from it either), lots of magical premises, the need to dig into theories of Praksis to make any sense, etc. etc. And to top it all, I can’t get worked up enough to care for any characters. They are all defective. For example, I think the only Parfeit’s project which (eventually) worked was the snow machine. And she calls herself an engineer? Please! I am a software engineer, and I can make a snow machine work [disclaimer: my snowflakes won’t be as beautiful as slowly formed natural ones].

If anyone comes anywhere close to being my favourite, it’s Barnette. She’s got some serious spirit, not quite unlike Meia’s. But her promise was not fulfilled. Her pretensions for leadership outside of cockpit were laughable, and she spent her screen time being an icon of anti-man sentiment. In the cockpit, she is willfully pigeonholed into the role of a group commander, thus letting Jura’s unique brand of give-up-and-whine leadership nearly kill everyone when injured Meia was out of action. And please, pilot your Dread in a flight suit, will you.

Liked: Kinda
Rewatch: Low