Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2009 22:56:05 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r199159 - in stable/7/sys: conf dev/ata
Message-ID:  <200911102256.nAAMu5VG074391@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Nov 10 22:56:05 2009
New Revision: 199159
URL: http://svn.freebsd.org/changeset/base/199159

Log:
  MFC r188740, r198486, r199050:
  Increase ATA command timeouts. Introduce define and kernel option
  ATA_REQUEST_TIMEOUT to control it.
  
  PR:		kern/111023

Modified:
  stable/7/sys/conf/NOTES
  stable/7/sys/conf/options
  stable/7/sys/dev/ata/ata-all.h
  stable/7/sys/dev/ata/ata-disk.c
  stable/7/sys/dev/ata/ata-queue.c
  stable/7/sys/dev/ata/ata-raid.c
  stable/7/sys/dev/ata/atapi-cd.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/conf/NOTES
==============================================================================
--- stable/7/sys/conf/NOTES	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/conf/NOTES	Tue Nov 10 22:56:05 2009	(r199159)
@@ -1621,8 +1621,11 @@ hint.ata.1.irq="15"
 #
 # 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

Modified: stable/7/sys/conf/options
==============================================================================
--- stable/7/sys/conf/options	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/conf/options	Tue Nov 10 22:56:05 2009	(r199159)
@@ -338,6 +338,7 @@ ISCSI_INITIATOR_DEBUG	opt_iscsi_initiato
 # 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

Modified: stable/7/sys/dev/ata/ata-all.h
==============================================================================
--- stable/7/sys/dev/ata/ata-all.h	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-all.h	Tue Nov 10 22:56:05 2009	(r199159)
@@ -308,6 +308,10 @@ struct ata_ahci_cmd_list {
 #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 {

Modified: stable/7/sys/dev/ata/ata-disk.c
==============================================================================
--- stable/7/sys/dev/ata/ata-disk.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-disk.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -259,7 +259,7 @@ ad_spindown(void *priv)
     }
     request->flags = ATA_R_CONTROL;
     request->dev = dev;
-    request->timeout = 5;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 1;
     request->callback = ad_power_callback;
     request->u.ata.command = ATA_STANDBY_IMMEDIATE;
@@ -291,9 +291,9 @@ ad_strategy(struct bio *bp)
     if (atadev->spindown_state) {
 	device_printf(dev, "request while spun down, starting.\n");
 	atadev->spindown_state = 0;
-	request->timeout = 31;
+	request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31);
     } else {
-	request->timeout = 5;
+	request->timeout = ATA_REQUEST_TIMEOUT;
     }
     request->retries = 2;
     request->data = bp->bio_data;

Modified: stable/7/sys/dev/ata/ata-queue.c
==============================================================================
--- stable/7/sys/dev/ata/ata-queue.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-queue.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -119,6 +119,7 @@ int
 ata_controlcmd(device_t dev, u_int8_t command, u_int16_t feature,
 	       u_int64_t lba, u_int16_t count)
 {
+    struct ata_device *atadev = device_get_softc(dev);
     struct ata_request *request = ata_alloc_request();
     int error = ENOMEM;
 
@@ -129,7 +130,13 @@ ata_controlcmd(device_t dev, u_int8_t co
 	request->u.ata.count = count;
 	request->u.ata.feature = feature;
 	request->flags = ATA_R_CONTROL;
-	request->timeout = 1;
+	if (atadev->spindown_state) {
+	    device_printf(dev, "request while spun down, starting.\n");
+	    atadev->spindown_state = 0;
+	    request->timeout = MAX(ATA_REQUEST_TIMEOUT, 31);
+	} else {
+	    request->timeout = ATA_REQUEST_TIMEOUT;
+	}
 	request->retries = 0;
 	ata_queue_request(request);
 	error = request->result;
@@ -389,7 +396,7 @@ ata_completed(void *context, int dummy)
 	    request->bytecount = sizeof(struct atapi_sense);
 	    request->donecount = 0;
 	    request->transfersize = sizeof(struct atapi_sense);
-	    request->timeout = 5;
+	    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");

Modified: stable/7/sys/dev/ata/ata-raid.c
==============================================================================
--- stable/7/sys/dev/ata/ata-raid.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/ata-raid.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -273,7 +273,7 @@ ata_raid_flush(struct bio *bp)
 	request->u.ata.lba = 0;
 	request->u.ata.count = 0;
 	request->u.ata.feature = 0;
-	request->timeout = 1;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	request->retries = 0;
 	request->flags |= ATA_R_ORDERED | ATA_R_DIRECT;
 	ata_queue_request(request);
@@ -4358,7 +4358,7 @@ ata_raid_init_request(struct ar_softc *r
 	printf("FAILURE - out of memory in ata_raid_init_request\n");
 	return NULL;
     }
-    request->timeout = 5;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 2;
     request->callback = ata_raid_done;
     request->driver = rdp;
@@ -4432,7 +4432,7 @@ ata_raid_rw(device_t dev, u_int64_t lba,
 
     /* setup request */
     request->dev = dev;
-    request->timeout = 10;
+    request->timeout = ATA_REQUEST_TIMEOUT;
     request->retries = 0;
     request->data = data;
     request->bytecount = bcount;

Modified: stable/7/sys/dev/ata/atapi-cd.c
==============================================================================
--- stable/7/sys/dev/ata/atapi-cd.c	Tue Nov 10 22:37:44 2009	(r199158)
+++ stable/7/sys/dev/ata/atapi-cd.c	Tue Nov 10 22:56:05 2009	(r199159)
@@ -703,7 +703,7 @@ acd_geom_access(struct g_provider *pp, i
 	request->dev = dev;
 	bcopy(ccb, request->u.atapi.ccb, 16);
 	request->flags = ATA_R_ATAPI;
-	request->timeout = 5;
+	request->timeout = ATA_REQUEST_TIMEOUT;
 	ata_queue_request(request);
 	if (!request->error &&
 	    (request->u.atapi.sense.key == 2 ||



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911102256.nAAMu5VG074391>