Is the GOP melting down?

•February 5, 2010 • Leave a Comment

First there was the poll of self-identified Republicans conducted by Research 2000 and commissioned by Markos Moulitsas (the “Kos” of “Daily Kos”): What Republicans Believe (related Metafilter thread.)

Edit:Nate Silver of FiveThirtyEight.com has a good analysis.

Then there’s the first National Tea Party Convention (metafilter thread) kicking off today with a keynote speaker who needs no introduction, Sarah Palin

Finally there’s Carly Fiorina’s little political advertisement:

Popout
(metafilter thread)
At first you’re thinking, “meh, yeah, it’s stupid, overly dramatic, etc. but… why am I watching this?” Hang in there ’til the 2 minute 27 second mark.

ABC News talks to the demon sheep himself.

WORDPRESS “PROGRAMMERS” Why do my comments appear in random places in the comment stream?

•February 4, 2010 • Leave a Comment

Hello WordPress “programmers.”

Why, when I make comments at the bottom of a post, or, in reply to another comment, do my comments appear in apparently RANDOM places in the comment stream? Why? What bug is this? When will you fix it?

Sorry to be too snippy, but goddamn, it’s fucking irritating to type a lengthy response only to have it appear nowhere near the thing you’re replying to, but instead, amongst six month old comments a mile upthread, where it makes absolutely no sense, and where it must be replaced with the string “FUCKING WORDPRESS FUCKING SUCKS” or similar to bring the comment stream back to something remotely resembling coherence, and I’m being charitible to consider threads sprinkled with “FUCKING WORDPRESS FUCKING SUCKS” for no apparent reason to be “coherent.” But that’s more coherent than the alternative of the current situation of horrible scrambled comment threads. Fix this shit, guys, or explain to me why it makes sense for a newly entered comment to appear a mile upthread amongst six-month old comments that I am not in any way replying to.

Cyclekart progress, Jan 31, 2010

•January 31, 2010 • Leave a Comment

I’ve started working on the hubs for the rear end. One of the things which must be done is to hack off the central bearing holder on the inside of the Honda wheel hubs. There’s not much room for a tool to get in there. I ended up using a Dremel tool to do the job. It took forever, something like 4 or 5 hours and went through probably 4 or 5 fibreglass cutting wheels.

President Obama Takes Questions at GOP House Issues Conference

•January 31, 2010 • Leave a Comment


popout <– you should click this, rather than watching it here.(And the embedded video doesn’t seem to work right now anyway.)

The question and answer session begins at the 19 minute mark.

Can you imagine GWB, or John McCain, or Sarah Palin doing something like this, and not be glad that they aren’t having to attempt it?

It’s so nice to have a president with a functioning brain.

Funny enough, FOX news apparently can’t handle a non-Republican president with a brain, and turned tail and simply fled.

via: The Huffington Post

Neat neuroscience video

•January 24, 2010 • Leave a Comment

I’ve got some commenters who remind me of Peter

•January 22, 2010 • Leave a Comment

They remind me of Peter, because, you know… they’re dumb as a …. wait for it… as a rock!

Peter? Rock? Petre? Get it? He he. I kill me….


via metafilter (where there’s more)

WordPress comment system sucks

•January 22, 2010 • 1 Comment

To quote jwz, Dear lazyweb,

The WordPress commenting system sucks. When there’s a reply to a comment, it’s indented. When there’s a reply to that comment, it’s indented again. Obviously, this doesn’t scale. It is “suggested” that this be limited to three levels. Why? Because it doesnt’ scale. Not because it makes any fucking sense at all. It’s the most retarded fucking thing in the universe. You can have a conversation, so long as it’s very very short, and one sided. Original commenter, replier, and then original commenter gets the last word.

After the third reply, subsequent replies must be detached from the thread, as that’s the only way the commenters can enter them. Which makes a giant mess.

And then, if you click on the ‘reply’ button to a comment in the dashboard, often your comment ends up at the very bottom of all the comments, and somehow magically continues to sink to the bottom, disconnected from whatever you were replying to, eternally at the bottom, as if it’s some uber-last-word comment.

And sometimes, when entering a comment in the big comment box at the end of all the comments (because the thread is 3 levels deep, and we can’t reply in the thread we want to replay in, because it’s reached it’s insanely low maximum comments of 3. 3 shall be the number of the counting, not 4, and 5 is right out) we find that our comment is placed seemingly randomly in the midst of all the comments, and you cannot really tell what the hell it is we were trying to reply to. So, then we edit that comment, deleting the content, leaving a blank comment, which makes us appear like some sort of Stalinist self-censoring jackass, and try again, trying to get our comment to appear in the right place, where people can have some idea what the hell we’re replying to.

Whoever designed the wordpress commenting system really screwed up. It’s ok. As a programmer, I know, we all screw up. We take a stab at it, we try our best, and then the users come, and we find out our system we thought was so good, actually isn’t all that great. That’s normal.

I get the feeling that the designer of the system imagined that no blog post would ever have more than about ten comment total. Well, that assumption turns out to be extremely wrong.

So then, we fix it. Right? We fix it? Pretty please? Please wordpress? Please fix the totally fucked commenting idiocy?

Some ideas?

Indenting replies does not work.

Instead do what the message boards do. Allow quoting. Indent the quotes if you must, but not the replies. If the quotes become too indented, the original can still be read.

Maybe there are some options on the wordpress crap that can make it sane. If so, please leave hints in the currently insane “comment” area, if you can be bothered. If you can’t, I completely understand, as it is currently a pile of shit.

Fixed a very hard bug at work today.

•January 22, 2010 • Leave a Comment

Jan 21, 2010

In my work, I’m a computer programmer. Lately, I work mainly on a couple of linux device drivers. Today, with the help of a colleague, a very hard to find bug got fixed. It was pretty interesting in retrospect, but frustrating, right up until we found it.

So the driver we were working on controls some hardware, which shall remain nameless. The way it works, in very general terms, is commands come into the driver, are sort of reformatted, are sent down to the nameless hardware, which processes them, and then every so often this hardware dumps a bunch of information into a chunk of host memory, and generates an interrupt. The driver gets the interrupt (which appears as a function call) and processes the information that was dumped into host memory. The information that gets dumped into hsot memory is a list of which commands the hardware is finished processing, essentially.

There are some details which need to be understood. When a command is “sent down” to the hardware, what’s really sent down is a “bus address” of a block of host memory which contains the details of the command. This bus address is jammed into a memory mapped register on the nameless hardware. The hardware takes this bus address, and uses DMA to suck the details of the command into it’s own memory for processing. One of the things inside the command details is a “tag.” This tag uniquely identifies the commands. When the hardware periodically dumps its information into host memory, what it’s dumping is a bunch of these tags.

The symptoms of the bug that we were seeing were as follows:

  1. On one particular set of hardware (several different instances), things seemed to work pretty well. Oddly, this was the newest, least likely to work hardware.
  2. On another set of hardware (several different instances) things didn’t work so well. Oddly, this was older, proven hardware.
  3. In the failure cases, we’d occasionally see what appeared to be bogus tags dumped into the host memory instead of the tags we were expecting. Sometimes these tags looked suspiciously like kernel virtual addresses, which were not what was expected at all.
  4. On the failing system, it seemed that 80 to 90 percent of the time, commands worked, but 10 to 20 percent of the time, we’d get these bogus tags instead. That tags always appeared just where we’d expect the hardware to be writing new tags.

The fact that the bogus tags looked a lot like kernel virtual addresses, and that these addresses could actually be dereferenced, and dumped out, combined with the fact that the failures occurred on known, good, proven hardware made me think that it had to be some stray write coming from the driver, accidentally writing into this area of host memory. It pretty much had to be a write coming from the kernel, it couldn’t be coming from the hardware. How could the hardware come up with a valid kernel virtual address? Not just any valid kernel address, but one obviously within the data space of the driver. Although dumping out what was at that address did not reveal anything obvious about exactly what it was. All of this combined, well, it didn’t make sense. Made you go, “hmmm….”

I spent quite a lot of time trying to come up with ways of trapping these suspected accidental writes. I investigated mmiotrace, but this relies on the use of ioremap(), and we weren’t using that. (we were using pci_alloc_consistent instead.) I tried changing the driver to superflously ioremap this region, just so I could use mmiotrace on it, but as soon as I activated mmiotrace, the system hung. I tried using crash, but gdb (via crash) does not allow watch points to be set on a running kernel. I tried setting up kgdb and debugging remotely, but ran into some roadblocks there as well. All in all, extremely frustrating.

My colleague ended up spotting the problem.

Had I thought of what he thought of, I likely would have dismissed it, as I’d actually made this mistake before, and previously, the symptom was a kernel panic, not the mess we were seeing now. I didn’t even think of it though.

The problem was that we were not aligning the commands in the way that the hardware expected. Consequently, when we stuffed our bus address into the register on the hardware, it zeroed out some low order bits, and sucked down the command details from a slightly lower address than the one we had set up the command in. The hardware interpreted the data as a command, — a garbled command, to be sure — and the only thing it could do was post the “tag”, which was whatever data was where it expected the tag to be in the supposed command that it sucked down from the “wrong” place, with a couple low order bits set to indicate problems. So, that’s where the mysterious kernel virtual addresses that we were seeing came from.

But, how come most commands worked? And how come this worked on the new hardware, but not the old hardware? Well, most commands worked because we allocated an entire block of commands at once with pci_alloc_consistent, which returns a page-aligned block of memory. It so happened that the first command in this block would be page aligned, and many times, this first block would get reused over and over, and the alignment so happened to work out that every fourth command or so was naturally aligned. And it worked on the new hardware, because it just so happened that all the new hardware happened to be installed in 64 bit systems, and on those, the size of a pointer is 64 bits, and it just so happened that the command structure worked out to be perfectly sized so that all the commands were properly aligned. Not so on 32 bit systems, which just happened to be what all the old hardware was installed in. So it wasn’t a distinction between old and new hardware, as it appeared, it was a distinction between 32 bit and 64 bit systems.

All the symptoms pointed to a driver bug, in which the driver was writing somehow to this area of memory. But the write was actually coming from the hardware, even though the hardware was just fine! Ultimately the clue of the mysterious kernel virtual address appearing amongst the tags was indicative of a driver bug, just not the straightforward kind of driver bug you might first think of.

We actually did have a BUILD_BUG_ON in the code that is designed to catch precisely this problem at build time, but somehow in a patch, the update to this safety check got dropped, (and we verified older versions of the patch contained the correct check) and so the safety check was incorrect, and it slipped through, causing me to spend the last three and a half days at work staring a the code trying to figure out how in the heck the tags were getting corrupted, thinking blasphemous, forbidden thoughts, like, “maybe it’s a compiler bug.”

Feels good to be rid of that bug, as it was one of those bugs that put me in the position of not having enough ideas to try. It’s not fun staring at data that seems impossible, and racking your brains to try to come up with some kind of experiment that can pry a new clue out of the system and coming up with nothing for hours at a time. And when I finally did come up with experiments, I was thwarted at every turn, by mmiotrace, by kgdb, by crash. And, even if I hadn’t been thwarted, it wouldn’t have worked, as ultimately, the writes were coming from the hardware, and my attempts to trap the non-existent stray host-writes would have come up empty.

But, then, sometimes, I read about the biologists and chemists that have figured out so much about how the chemistry of life works over the years, and I realize that my days or hours of staring at impenetrable data, searching for an explanation is nothing compared to what real scientists face every day.

Even so, it feels pretty good to be rid of that bug.

Anyway, if you ever wondered what it’s like to work on linux device drivers, what’s above represents one of the tougher things I’ve run up against lately.

Our place in the universe

•January 21, 2010 • 1 Comment

Here’s another one of those “our place in the universe” videos, this one via Astronomy Picture of the Day.

popout
Credit and copyright: American Museum of Natural History

It’s quite good.

Pranking Christian TV

•January 18, 2010 • Leave a Comment

via reddit,
popout

May the force be with you, because you’re worth it. Smell ya later!