peteg's blog

Real-time and high-resolution timers for Linux 2.6.29.6 running on the ts7260

/hacking/nixie_clock | Link

I got bitten by the classic Linux-ism: the standard resolution of usleep is only 10ms on these ARM boards, which is way too slow to do the kind of multiplexing the clock needs: I need delays of about 2ms and could use 100µs. I'm allergic to busy-waiting in user-space too.

The short story is that I tried 2.6.31.x and couldn't get the board to boot, but 2.6.29.6 works fine, after some mild futzing in applying the patch in the ts7260 forum's file area at Yahoo. It does not provide high-resolution timers for the ARM ep93xx which the ts7260 is blessed with, though. One can readily apply the RT patches to 2.6.29.6, but these also do not include the hrtimers stuff; one needs a further, not so clean patch to get these working.

So the clock now seems to scan OK, with no flicker visible to my eyes (on the single tube I have installed so far). Well, that's true provided that no other process is running. I've selected the right scheduler, cranked up the priorities, locked the program's virtual memory, and generally futzed with no improvement in robustness under load.

As has been true for a long time, there is some ts7260 stuff in the latest Linux kernel (2.6.32.3), and apparently the RT patches have been merged to the mainline. (I cannot really tell, but the CONFIG_PREEMPT_RT and friends options are there.) I'll see if I can get that to boot and perhaps figure out the hrtimers story there.

An aside: here's a good post on the proper treatment of SIGINT.

Douglas Adams: The Salmon of Doubt

/noise/books | Link

It has been an age since I've read anything by Douglas Adams. His style is at once familiar, an amiable bar-propping old friend, even when it is as travestied as it is here. I acquired this from Pete R.'s stash of books-to-toss, having not been tempted to read it for years, and almost wishing that I hadn't now.

Of course the prose is fine. What's lacking are those tangents, the sheer irrelevancy and irreverence to plots and characters that gave his earlier stuff its suspense and force. Then again, it might be the converse that I'm actually whinging about. This is a compilation of various rants, and most tantalisingly, bits of a third Dirk Gently. The editor goes out of his way to warn the reader that it's a let down, and don't be disappointed, it is.

The part I liked the most was the presumably previously unpublished Turncoat from October 2000. Here's the bit that struck the chord, slab-quoted Ramsey-style:

But nowadays everybody's a comedian, even the weather girls and continuity announcers. We laugh at everything. Not intelligently anymore, not with sudden shock, astonishment, or revelation, just relentlessly and meaninglessly. No more rain showers in the desert, just mud and drizzle everywhere, occasionally illuminated by the flash of paparazzi.

Creative excitement has gone elsewhere, to science and technology: new ways of seeing things, new understandings of the universe, continual new revelations about how life works, how we think, how we perceive, how we communicate. So this is my second point.

Where, thirty years ago, we used to start up rock bands, we now start up startups and experiment with new ways of communicating with each other and playing with the information we exchange. And when one idea fails, there's another, better one right behind it, and another and another, cascading out as fast as rock albums used to in the sixties.

There's always a moment when you start to fall out of love, whether it's with a person or an idea or a cause, even if it's one you only narrate to yourself years after the event: a tiny thing, a wrong word, a false note, which means that things can never be quite the same again. For me it was hearing a stand-up comedian make the following observation: "These scientists, eh? They're so stupid! You know those black-box flight recorders they put on aeroplanes? And you know they're meant to be indestructible? It's always the thing that doesn't get smashed? So why don't they make the planes out of the same stuff?"

The audience roared with laughter at how stupid scientists were, couldn't think their way out of a paper bag, but I sat feeling uncomfortable. Was I just being pedantic to feel that the joke didn't really work because flight recorders are made out of titanium and that if you made planes out of titanium rather than aluminium, they'd be far too heavy to get off the ground in the first place? I began to pick away at the joke. Supposing Eric Morecambe had said it? Would it be funny then? Well, not quite, because that would have relied on the audience seeing that Eric was being dumb — in other words, they would have had to know as a matter of common knowledge about the relative weights of titanium and aluminium. There was no way of deconstructing the joke (if you think this is obsessive behaviour, you should try living with it) that didn't rely on the teller and the audience complacently conspiring together to jeer at someone who knew more than they did. It sent a chill down my spine, and still does. I felt betrayed by comedy in the same way that gangsta rap now makes me feel betrayed by rock music. I also began to wonder how many of the jokes I was making were just, well, ignorant.

RIP DNA.

Shadow of a Doubt

/noise/movies | Link

Sifting down the IMDB noir list, I found this, an early Hitchcock. It is a bit too slow and all-American for my tastes. Joseph Cotton is creepy, and not altogether unlike Jude Law. Teresa Wright is wide-eyed and luminous in this performance, the year after she won an Oscar (how young she must have been). The comedic relief was too robotic, and the climax a let-down.