[3142] in linux-scsi channel archive
Re: problems on alpha linux
daemon@ATHENA.MIT.EDU (Gadi Oxman)
Thu Jan 29 14:27:55 1998
Date: Thu, 29 Jan 1998 21:13:15 +0300 (IST)
From: Gadi Oxman <gadio@netvision.net.il>
To: Joerg Schilling <schilling@fokus.gmd.de>
cc: cdwrite@pixar.com, paul@wau.mis.ah.nl, linux-scsi@vger.rutgers.edu
In-Reply-To: <199801291611.RAA18335@sherwood.fokus.gmd.de>
On Thu, 29 Jan 1998, Joerg Schilling wrote:
> >From gadio@netvision.net.il Wed Jan 28 23:49:45 1998
>
> >> I am not a Linux expert. Could someone please check if this is a bug in the
> >> alpha version of Linux?
>
> >I think that the following 2.0.x patch should solve the timeout problem;
> >Linux ALPHA is using by default a system clock of 1024HZ rather than
> >100HZ as is being used on x86 systems. Since the SG_SET_TIMEOUT ioctl
> >is using the value directly, the actual timeout is about 10 times shorter.
>
> >Gadi
>
> >--- linux/drivers/scsi/sg.c~ Thu Jan 29 00:46:27 1998
> >+++ linux/drivers/scsi/sg.c Thu Jan 29 00:46:27 1998
> >@@ -76,10 +76,10 @@
> > result = verify_area(VERIFY_READ, (const void *)arg, sizeof(long));
> > if (result) return result;
> >
> >- scsi_generics[dev].timeout=get_user((int *) arg);
> >+ scsi_generics[dev].timeout=get_user((int *) arg) * HZ / 100;
> > return 0;
> > case SG_GET_TIMEOUT:
> >- return scsi_generics[dev].timeout;
> >+ return scsi_generics[dev].timeout * 100 / HZ;
> > default:
> > return scsi_ioctl(scsi_generics[dev].device, cmd_in, (void *) arg);
> > }
>
>
> I thought a little bit in this problem...
>
> Gadi, is there any documentation for the /dev/sg driver that says something
> on the SG_SET_TIMEOUT ioctl() ? If there is already a documentation that
> the timeout sounts in HZ units, I should rather change my interface
> in cdrecord.
>
> Joerg
>
> http://www.fokus.gmd.de/usr/schilling ftp://ftp.fokus.gmd.de/pub/unix
The SCSI-Programming-HOWTO contains the following:
ioctl(fd, SG_SET_TIMEOUT, &Timeout); sets the timeout value to
Timeout * 10 milliseconds. Timeout has to be declared as int.
ioctl(fd, SG_GET_TIMEOUT, &Timeout); gets the current timeout
value. Timeout has to be declared as int.
I do not know if there are applications which assume that the timeout
is counted in 'system clock tick' units and support non-x86 systems,
though (cc'ed to linux-scsi).
Gadi