Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 1996 07:12:05 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        Nicolas.Souchu@prism.uvsq.fr, hackers@FreeBSD.ORG
Subject:   Re: polling driver
Message-ID:  <199607082112.HAA17933@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Surely, doing a tsleep() in a driver is a bad idea... I think
>resources are not well locked before the drive-dependent scsi_cmd()
>routine is called because the process is supposed to keep the CPU
>during the call and return without being interrupted.

Sleeping works (only) in process context (not in interrupt handlers
including timeout handlers) .  The SCSI_NOSLEEP flag is supposed to
tell SCSI drivers when it is safe to sleep.

>Timeouts are not good either because they interrupt the CPU at a high
>level (>splbio) and the callback is executed at a very low level.

Timeout handlers are always called at the same low level (splsoftclock)
(<splbio).  See the fd driver for how to turn a timeout handler into a
normal disk interrupt handler.  At worst, a polled disk driver can work
much like an interrupt driven driver, except slower, by scheduling a
timeout every clock tick and turning the timeout into a normal disk
interrupt.

Bruce



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