svn commit: r198486 - head/sys/dev/ata

Giorgos Keramidas keramida at freebsd.org
Mon Oct 26 15:50:42 UTC 2009


On Mon, 26 Oct 2009 11:20:15 +0000 (UTC), Alexander Motin <mav at FreeBSD.org> wrote:
> Author: mav
> Date: Mon Oct 26 11:20:14 2009
> New Revision: 198486
> URL: http://svn.freebsd.org/changeset/base/198486
>
> Log:
>   Increase ATA command timeouts. Some drives need more then 5s to spin-up.

On Mon, 26 Oct 2009 14:42:52 +0000, Alexey Dokuchaev <danfe at FreeBSD.org> wrote:
> Can't it be factored out into a macro so one does not have to make a bunch
> of those identical changes over several files shall it be required to
> adjust timeout again some time in the future?

Yes it can.  See attached patch below.

On Mon, 26 Oct 2009 16:51:52 +0200, Andriy Gapon <avg at freebsd.org> wrote:
> If this is to happen, then I'd like them to become sysctls too.

If it's not a problem, we can add the macro first and then work on
making it a sysctl.  FWIW, it may also be nice to have a different
sysctl for each ata device, or something that can be tuned per bus or
per-device with atacontrol.

The patch attached below is what we need to make this a compile-time
option for kernel config files.  It's small enough that I think we can
commit this now, and work on the sysctl/atacontrol tunable in the
meantime.

%%%
diff -r 912fc3591cda UPDATING
--- a/UPDATING	Mon Oct 26 15:41:28 2009 +0200
+++ b/UPDATING	Mon Oct 26 17:46:11 2009 +0200
@@ -22,6 +22,11 @@
 	machines to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20091026:
+	The ata(4) driver has been updated to allow rebuilding with a custom
+	request timeout.  ATA_REQUEST_TIMEOUT now defaults to 10 seconds, but
+	may be set in the kernel configuration file to another value.
+
 20091025:
 	The iwn(4) driver has been updated to support the 5000 and 5150 series.
 	There's one kernel module for each firmware. Adding "device iwnfw"
diff -r 912fc3591cda sys/conf/NOTES
--- a/sys/conf/NOTES	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/conf/NOTES	Mon Oct 26 17:46:11 2009 +0200
@@ -1716,8 +1716,11 @@
 #
 # ATA_STATIC_ID:	controller numbering is static ie depends on location
 #			else the device numbers are dynamically allocated.
+# ATA_REQUEST_TIMEOUT:	the number of seconds to wait for an ATA request
+#			before timing out.
 
 options 	ATA_STATIC_ID
+#options 	ATA_REQUEST_TIMEOUT=10
 
 #
 # Standard floppy disk controllers and floppy tapes, supports
diff -r 912fc3591cda sys/conf/options
--- a/sys/conf/options	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/conf/options	Mon Oct 26 17:46:11 2009 +0200
@@ -350,6 +350,7 @@
 # Options used in the 'ata' ATA/ATAPI driver
 ATA_STATIC_ID		opt_ata.h
 ATA_NOPCI		opt_ata.h
+ATA_REQUEST_TIMEOUT	opt_ata.h
 
 # Net stuff.
 ACCEPT_FILTER_DATA
diff -r 912fc3591cda sys/dev/ata/ata-all.h
--- a/sys/dev/ata/ata-all.h	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/dev/ata/ata-all.h	Mon Oct 26 17:46:11 2009 +0200
@@ -336,6 +336,10 @@
 #define ATA_OP_FINISHED                 1
 #define ATA_MAX_28BIT_LBA               268435455UL
 
+#ifndef	ATA_REQUEST_TIMEOUT
+#define ATA_REQUEST_TIMEOUT		10
+#endif
+
 /* structure used for composite atomic operations */
 #define MAX_COMPOSITES          32              /* u_int32_t bits */
 struct ata_composite {
diff -r 912fc3591cda sys/dev/ata/ata-disk.c
--- a/sys/dev/ata/ata-disk.c	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/dev/ata/ata-disk.c	Mon Oct 26 17:46:11 2009 +0200
@@ -230,7 +230,7 @@
     }
     request->dev = dev;
     request->flags = ATA_R_CONTROL;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 1;
     request->callback = ad_power_callback;
     request->u.ata.command = ATA_STANDBY_IMMEDIATE;
@@ -265,7 +265,7 @@
 	request->timeout = 31;
     }
     else {
-	request->timeout = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
     }
     request->retries = 2;
     request->data = bp->bio_data;
@@ -468,7 +468,7 @@
     request->u.ata.count = 0;
     request->u.ata.feature = 0;
     request->flags = ATA_R_CONTROL | ATA_R_QUIET;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     ata_queue_request(request);
     if (request->status & ATA_S_ERROR)
@@ -487,7 +487,7 @@
     request->u.ata.count = 1;
     request->u.ata.feature = 0;
     request->flags = ATA_R_CONTROL;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     ata_queue_request(request);
     if (request->status & ATA_S_ERROR)
diff -r 912fc3591cda sys/dev/ata/ata-queue.c
--- a/sys/dev/ata/ata-queue.c	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/dev/ata/ata-queue.c	Mon Oct 26 17:46:11 2009 +0200
@@ -135,7 +135,7 @@
 	    atadev->spindown_state = 0;
 	    request->timeout = 31;
 	} else {
-	    request->timeout = 10;
+	    request->timeout = ATA_REQUEST_TIMEOUT;
 	}
 	request->retries = 0;
 	ata_queue_request(request);
@@ -389,7 +389,7 @@
 	    request->bytecount = sizeof(struct atapi_sense);
 	    request->donecount = 0;
 	    request->transfersize = sizeof(struct atapi_sense);
-	    request->timeout = 10;
+	    request->timeout = ATA_REQUEST_TIMEOUT;
 	    request->flags &= (ATA_R_ATAPI | ATA_R_QUIET | ATA_R_DEBUG);
 	    request->flags |= (ATA_R_READ | ATA_R_AT_HEAD | ATA_R_REQUEUE);
 	    ATA_DEBUG_RQ(request, "autoissue request sense");
diff -r 912fc3591cda sys/dev/ata/atapi-cd.c
--- a/sys/dev/ata/atapi-cd.c	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/dev/ata/atapi-cd.c	Mon Oct 26 17:46:11 2009 +0200
@@ -700,7 +700,7 @@
 	request->dev = dev;
 	bcopy(ccb, request->u.atapi.ccb, 16);
 	request->flags = ATA_R_ATAPI;
-	request->timeout = 10;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	ata_queue_request(request);
 	if (!request->error &&
 	    (request->u.atapi.sense.key == 2 ||
diff -r 912fc3591cda sys/i386/conf/KOBE
--- a/sys/i386/conf/KOBE	Mon Oct 26 15:41:28 2009 +0200
+++ b/sys/i386/conf/KOBE	Mon Oct 26 17:46:11 2009 +0200
@@ -90,6 +90,7 @@
 device		atapicam	# emulate ATAPI devices as SCSI ditto via CAM
 				# needs CAM to be present (scbus & pass)
 options 	ATA_STATIC_ID	# Static device numbering
+options 	ATA_REQUEST_TIMEOUT=12
 
 # SCSI peripherals
 device		scbus		# SCSI bus (required for SCSI)

%%%


More information about the svn-src-head mailing list