public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Kurt Garloff <garloff@suse.de>
To: Linux SCSI list <linux-scsi@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>,
	Andrew Morton <akpm@osdl.org>
Subject: [PATCH] 5/6: scsi_inq_timeout
Date: Sun, 18 Apr 2004 20:59:57 +0200	[thread overview]
Message-ID: <20040418185957.GH4868@tpkurt.garloff.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2810 bytes --]


Feature.

Introduce a new SCSI scanning boot/module parameter
scsi_inq_timeout=N
which sets the timeout used when the INQUIRY is send in the SCSI 
scanning procedure to N seconds. (Half a second is added, so 0 is safe.)
This is useful, because some devices need an excessive amount of time to 
recover from the bootup SCSI reset.
Also changes the default for PPC64, as some largely used crap chip there
requires it.

Note that the second INQUIRY (with more than 36 bytes) only gets half 
the amount of seconds, the long delay for the first is only due to the 
recovery needed from the initial bus reset.

--- linux-2.6.5.noreplunhost/drivers/scsi/scsi_scan.c.orig	2004-04-15 22:51:08.000000000 +0200
+++ linux-2.6.5.noreplunhost/drivers/scsi/scsi_scan.c	2004-04-16 19:30:43.289826746 +0200
@@ -125,6 +125,22 @@ MODULE_PARM_DESC(scsi_allow_ghost_device
 		 "allow devices marked as being offline to be accessed anyway "
 		 "(0 = off, else allow ghosts on lun 0 through allow_ghost_devices - 1");
 
+/* Some AChip ARC765 based DVD-ROM's take 15 or more seconds
+ * to reset.  A scan will fail if made right after a reset.
+ * It's completely broken device behaviour: SCSI specification
+ * says devices need to be able to respond to INQUIRY always
+ * (after a selection timeout ... of 250ms).
+ */
+#ifdef __powerpc64__
+static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ+25;
+#else
+static unsigned int scsi_inq_timeout = SCSI_TIMEOUT/HZ+3;
+#endif
+
+module_param_named(scsi_inq_timeout, scsi_inq_timeout, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(scsi_inq_timeout, 
+		 "Timeout (in seconds) waiting for devices to answer INQUIRY."
+		 " Default is 6. Some non-compliant devices need more.");
 
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
@@ -376,7 +392,7 @@ static void scsi_probe_lun(struct scsi_r
 
 	memset(inq_result, 0, 36);
 	scsi_wait_req(sreq, (void *) scsi_cmd, (void *) inq_result, 36,
-		      SCSI_TIMEOUT + 4 * HZ, 3);
+		      HZ/2 + HZ*scsi_inq_timeout, 3);
 
 	SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 1st INQUIRY %s with"
 			" code 0x%x\n", sreq->sr_result ?
@@ -425,7 +441,7 @@ static void scsi_probe_lun(struct scsi_r
 		memset(inq_result, 0, possible_inq_resp_len);
 		scsi_wait_req(sreq, (void *) scsi_cmd,
 			      (void *) inq_result,
-			      possible_inq_resp_len, SCSI_TIMEOUT + 4 * HZ, 3);
+			      possible_inq_resp_len, (1+scsi_inq_timeout)*(HZ/2), 3);
 		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: 2nd INQUIRY"
 				" %s with code 0x%x\n", sreq->sr_result ?
 				"failed" : "successful", sreq->sr_result));
-- 
Kurt Garloff  <garloff@suse.de>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2004-04-18 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-18 18:59 Kurt Garloff [this message]
2004-04-18 19:21 ` [PATCH] 5/6: scsi_inq_timeout Christoph Hellwig
2004-04-18 22:16   ` Kurt Garloff
2004-04-19 16:41     ` Patrick Mansfield
2004-04-20 11:34       ` Kurt Garloff

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=20040418185957.GH4868@tpkurt.garloff.de \
    --to=garloff@suse.de \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=linux-scsi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox