NetBSD Problem Report #41886

From Wolfgang.Stukenbrock@nagler-company.com  Thu Aug 13 16:20:29 2009
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id EEABE63C284
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Aug 2009 16:20:28 +0000 (UTC)
Message-Id: <20090813162026.93A3C4EA9FE@s012.nagler-company.com>
Date: Thu, 13 Aug 2009 18:20:26 +0200 (CEST)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: missing feature to define timeout values for ST device in kernel config
X-Send-Pr-Version: 3.95

>Number:         41886
>Category:       kern
>Synopsis:       missing feature to define timeout values for ST device in kernel config
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 13 16:25:00 +0000 2009
>Originator:     Wolfgang Stukenbrock
>Release:        NetBSD 4.0
>Organization:
Dr. Nagler & Company GmbH

>Environment:


System: NetBSD s012 4.0 NetBSD 4.0 (NSW-S012) #9: Fri Mar 13 12:31:52 CET 2009 wgstuken@s012:/usr/src/sys/arch/amd64/compile/NSW-S012 amd64
Architecture: x86_64
Machine: amd64
>Description:
	The three timeout values of the st(4) evice driver are defined as fixed values in /usr/src/sys/dev/scsipi/stvar.h.
	There is no way th change them via kernel configuration.
	E.g. the timeout for th sd(4) is changeble via kernel configuration by defining the option SD_IO_TIMEOUT.

	Now there seems to be at least on tape, where the 3 minutes IO-timeout is to short - one of our VXA-320 tapes ...
	It would be nice to have the option to change the timeout for a tape device - e.g. in the kernel configuration.

	The fix below defines three new kernel config options to overwrite the current default values from stvar.h.

	Of cause - the best way would be to allow different timeouts for each tape device in the system and use the current values as default
	during attach. But this requires larger changes to some files and a user-level program to set the values.
	For tape devices the mt(1) command is used, but changing timeout parameters would be an possibly incompartible extension in this program.

	The best way from my point of view would be to move the timeout handling in the SCSI-bus layer and no longer pass timeouts from the device
	drivers to the low-level drivers. The drivers should set the currently used values as default values in the SCSI-bus layer during attach.
	The scsictl(8) program should be expanded to show and change them then - for each target and perhaps each lun!
	Changable SCSI-timeouts should be a function of the SCSI-bus layer and not of the devices build on top of that.

	Neverless this requires much more work as simply allowing to set the default values via kernel config.
	I hope some other developers can implement this idea in a future version of NetBSD. It would be very great!
	Neverless the patch in this report makes sence even if this gets implemented.
>How-To-Repeat:
	not relevant - enhancment request ...
>Fix:
	The following two diffs changes /usr/src/sys/dev/scsipi/files.scsipi and /usr/src/sys/dev/scsipi/stvar.h.

	I've added a multi-include-barrier to stvar.h too, as found sdvar.h. It is of cause not realy needed, but so it is consistent to sdvar.h.

	remark: I haven't changed the names of the definitions currently used. It may make sence to use ST_IO_TIMEOUT etc. in order to use
		the same nameing convention as in sdvar.h. Feel free to change it, but you need to change it in /usr/src/sys/dev/scsipi/st.c too.

--- files.scsipi	2009/08/13 15:09:08	1.1
+++ files.scsipi	2009/08/13 15:10:02
@@ -7,6 +7,7 @@
 defflag	opt_scsi.h		SCSIVERBOSE ST_ENABLE_EARLYWARN
 				SES_ENABLE_PASSTHROUGH SCSI_OLD_NOINQUIRY
 defparam opt_scsi.h		ST_MOUNT_DELAY SDRETRIES SD_IO_TIMEOUT
+				ST_IO_TIME ST_CTL_TIME ST_SPC_TIME

 defflag	opt_scsipi_debug.h	SCSIPI_DEBUG
 defparam opt_scsipi_debug.h	SCSIPI_DEBUG_TYPE
--- stvar.h	2009/08/13 15:09:08	1.1
+++ stvar.h	2009/08/13 15:51:11
@@ -56,6 +56,11 @@
  * A lot of rewhacking done by mjacob (mjacob@nas.nasa.gov).
  */

+#ifndef _DEV_SCSIPI_STVAR_H_
+#define _DEV_SCSIPI_STVAR_H_
+
+#include "opt_scsi.h"
+
 #include "rnd.h"
 #if NRND > 0
 #include <sys/rnd.h>
@@ -64,9 +69,16 @@
 #include <dev/scsipi/scsipi_all.h>
 #include <dev/scsipi/scsiconf.h>

+/* default values for timeout paramters - may be overwritten in kernel config */
+#ifndef	ST_IO_TIME
 #define	ST_IO_TIME	(3 * 60 * 1000)		/* 3 minutes */
+#endif
+#ifndef	ST_CTL_TIME
 #define	ST_CTL_TIME	(30 * 1000)		/* 30 seconds */
+#endif
+#ifndef	ST_SPC_TIME
 #define	ST_SPC_TIME	(4 * 60 * 60 * 1000)	/* 4 hours */
+#endif

 #define	ST_RETRIES	4	/* only on non IO commands */

@@ -190,3 +202,5 @@
 int	stdetach(struct device *, int);

 extern struct cfdriver st_cd;
+
+#endif /* _DEV_SCSIPI_STVAR_H_ */

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.