All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kresimir Kukulj <madmax@iskon.hr>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] siimage.c - turning DMA on because of 'md' kernel thread.
Date: Sat, 19 Jul 2003 00:34:25 +0200	[thread overview]
Message-ID: <20030718223425.GA21110@max.zg.iskon.hr> (raw)

Hi

	I'm trying to use Sil3112a controller with two Seagate 120Gb SATA
disks for RAID-1 (mirror) with 'md - multiple devices' driver. I am aware
that I need to use some tricks to get it working, like this:

 # hdparm -d1 -X69 /dev/xxx
 # echo "max_kb_per_request:15" > /proc/ide/hd?/settings

First one prevents freezing the system when enabling DMA.
Second one stops IO errors.

As far as I can tell, it works ok, but with reduced bandwidth (because of
max_kb_per_request). When using 'md' driver for RAID-1 mirror (rootfs, swap)
with persistent superblocks I have problems. If server crashes (for some
reason), 'md' tries to resync mirrors automatically. That is done by a kernel
thread that is activated before init(8) is started. I have put 'hdparm' cludge
very early in the boot process, but that happens _after_ 'md' thread starts to
resync.  That means that disks are busy (in PIO mode), and when hdparm -d1 -X69
executes, system freezes [if there is no disk/little activity hdparm cludge
passes ok - for example, if RAID-1 is clean so there is no resync].

For past two days I tried to find a way to force ide driver to initialize disk
in dma mode automatically by the kernel itself although disks are set to PIO by
the bios for some reason. I devised a patch that does hdparm + echo cludge. I
have never seen linux kernel, so I am unsure if I did it correctly. Patch is
attached.  Please, if anyone uses it, test it to see if  it works ok for you! I
am not familiar with linux ide driver so I did this with a lot of printk's and
trial & error.

With this patch, disks are initialized by kernel to UDMA100, with
max_kb_per_request:15.  Now, RAID-1 is resynced at boot with DMA already
activated (so there is no need for hdparm) and it completed successfully.
At least it works for me. I need to do more disk stress tests to be sure it is
stable.

This is all done with vanilla 2.4.21.
2.4.22-pre4 didn't work at all. Copying a few MB of data freezes the kernel.

My motherboard is Asus P4G8X deluxe.
http://www.asus.com/products/mb/socket478/p4g8x-d/overview.htm

--- siimage.c.orig	Fri Jul 18 23:36:58 2003
+++ siimage.c	Fri Jul 18 23:36:59 2003
@@ -97,7 +97,7 @@
 
 	switch(hwif->pci_dev->device) {
 		case PCI_DEVICE_ID_SII_3112:
-			return 4;
+			return 3;
 		case PCI_DEVICE_ID_SII_680:
 			if ((scsc & 0x30) == 0x10)	/* 133 */
 				mode = 4;
@@ -297,7 +297,7 @@
 	struct hd_driveid *id	= drive->id;
 
 	if ((id->capability & 1) != 0 && drive->autodma) {
-		if (!(hwif->atapi_dma))
+		if ((hwif->atapi_dma))
 			goto fast_ata_pio;
 		/* Consult the list of known "bad" drives */
 		if (hwif->ide_dma_bad_drive(drive))
@@ -803,7 +803,7 @@
 	pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
 	class_rev &= 0xff;
 
-	hwif->rqsize = 128;
+	hwif->rqsize = 15;
 	if ((dev->device == PCI_DEVICE_ID_SII_3112) && (!(class_rev)))
 		hwif->rqsize = 16;
 
-----------------------

I'm confused why is this check there:
 	if ((id->capability & 1) != 0 && drive->autodma) {
 		if (!(hwif->atapi_dma))
 			goto fast_ata_pio;

Is it intentional ?

-- 
Kresimir Kukulj                      madmax@iskon.hr
+--------------------------------------------------+
Old PC's never die. They just become Unix terminals.

             reply	other threads:[~2003-07-18 22:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-18 22:34 Kresimir Kukulj [this message]
2003-07-18 22:48 ` [PATCH] siimage.c - turning DMA on because of 'md' kernel thread Alan Cox
2003-07-21 15:34   ` Kresimir Kukulj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030718223425.GA21110@max.zg.iskon.hr \
    --to=madmax@iskon.hr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.