The Geeky Successes of Linux

Today an annoyance on my new desktop machine ‘yawl’ (A Dell GX260 snarfed on ebay, as mentioned here), finally got to the point where Something Had to be Done. What follows is a geeky story of problem solving under Linux, which usually involves a tremendous amount of yak shaving, but in this case, was a simple performance tune.

I’d been having problems with performance on the new machine. Now, for a 2.26ghz machine with 2gig of RAM, this really shouldn’t happen. I had plenty of RAM, plenty of CPU bandwidth, but during heavy disk IO, the machine would simply -stop- responding. Even the mouse would stop moving. It got worse with heavy disk writes (copying files from a remote server to local was particularly painful). Something needed to be done!

My initial suspicion was a problem in the IDE driver. Either I had a piss poor IDE controller that couldn’t do more than one thing at a time, or there was a problem with the driver. I guessed the latter, and started digging around. Folks on IRC mentioned checking to see if DMA on the controller were enabled. This is checked via the ‘hdparm’ tool, which, after apt-getting, showed me:

dbs@yawl:~$ sudo hdparm /dev/hda
/dev/hda:
multcount    =  0 (off)
IO_support   =  0 (default 16-bit)
unmaskirq    =  0 (off)
using_dma    =  0 (off)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 38792/16/63, sectors = 39102336, start = 0

Looked pretty suspicious. No DMA at all. ‘hdparm’ allows hard-setting of driver parameters, so that was the first attempt. The HDIO driver in the linux kernel is supposed to auto-select DMA on if possible, maybe it needed a nudge. Employing hdparm again:

dbs@yawl:~$ sudo hdrparm -d 1 /dev/hda
setting using -dma to 1 (on)
HDIO set dma failed: operation not permitted

DENIED. Okay, fine. Something is not configured right in the kernel. A little digging on various mailing lists brought me to a posting that described a problem with Intel ICH4 IDE controllers. Direct support for them must be enabled directly in the kernel to enable DMA. The switch in the kernel config file is:

CONFIG_BLK_DEV_PIIX=y

Lo, a kernel rebuild and reboot later, and:

dbs@yawl:~$ sudo hdparm /dev/hda
/dev/hda:
multcount    =  0 (off)
IO_support   =  0 (default 16-bit)
unmaskirq    =  0 (off)
using_dma    =  1 (on)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 38792/16/63, sectors = 39102336, start = 0

Performance is MUUUUCH better. I copied files from one server to here at 3.6meg/sec, and though my machine was busy, it was not wedging and sputtering as it would have before.

This, coupled with an upgrade of some network hardware (I discovered, somewhat shamefacedly, that we were running most of Chez Geek off a 10-base-T hub. That was quickly replaced with a 100bt switch, and life resumed at a somewhat better pace), and things are getting downright zippy around here.

About

A wandering geek. Toys, shiny things, pursuits and distractions.

View all posts by

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.