Distance Debugging Logo

The Magic of DMA

I have posted previously about my new Linux server, that started somewhat auspiciously with a bad motherboard. I've had some other odd problems which I have mostly solved (or am in the process of solving) that I thought might be of use to others.

To start with, my server runs in so-called "Combined Mode", where the SATA and PATA channels are separated on the motherboard. This is the only mode in which I can boot my server currently. This may have something to do with the fact that the boot partition (/boot) and the MBR are on the SATA drive, and I would have to build the kernel differently since SATA support is built as a module rather than built-in to the kernel. This is just speculation though. Mostly I am taking an "if it ain't broke" position and leaving it alone.

I actually have two HDs in the machine, a 160GB SATA that holds most of my real data, the boot partition, and the swap area, and a 80GB PATA drive that holds the Fedora Core (now 6) installation. The Abit mobo only has a single IDE connector, so I have the PATA drive and my DVD writer on that cable as master-slave, and the SATA drive is separate. I noticed right away that the server seemed blazing fast for a lot of things, but it was jerky and slow for others. I immediately thought about the mishmash of drives and figured something was up. So I did a little hdparm analysis:

hdparm -tT /dev/hdc (the PATA drive)

Timing cached reads: 3496 MB in 2.00 seconds = 1748.62 MB/sec
Timing buffered disk reads: 7 MB in 3.02 seconds = 2.31 MB/sec

Ugh. There's the problem. I should be getting in the range of 40-50MB at least. So I checked the status, and of course no DMA or anything so I tried the obvious:

hdparm -d1 /dev/hdc

And I get the common "Operation not Permitted" error that usually means that the specific driver for your motherboard chipset is not available in the kernel. However, I verified that my chipset (ICH7) was there. Long story short, I found my way once again to the incredibly useful ThinkWiki, to the page about Linux and SATA:

http://www.thinkwiki.org/wiki/Problems_with_SATA_and_Linux#No_DMA_on_DVD...

along with a Redhat bugzilla report along the same lines. It turns out that the issue is that you want the libata driver to grab the PATA drives as well, but usually the regular ide driver grabs them and in combined mode that means you are unable to do anything like manipulate DMA (I am paraphrasing here, the reality is much more complex). Anyway, by adding the flag combined_mode=libata to the kernel boot parameters, I now get:

Timing cached reads: 3496 MB in 2.00 seconds = 1748.62 MB/sec
Timing buffered disk reads: 168 MB in 3.02 seconds = 55.64 MB/sec

So like 25x faster with a simple boot-parameter change. The whole system is just so much faster now, it's hard to believe. Unfortunately, this had the side-effect of making the DVD drive disappear. It looks like I somehow am not enabling ATAPI in the libata driver, so that's what I'm working on. I'll post again when I've got that solved.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
We hate to do this, but to comment, you'll need to prove you aren't a spambot by answering this question: