Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 1997 21:45:51 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        julian@whistle.com, tlambert@primenet.com
Cc:        current@freebsd.org
Subject:   Re: buf struct & scsi disk IO availability.
Message-ID:  <199709301145.VAA21109@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> I would like to do some IO from a disk at PROBE time.
>> ...
>> 1/ is the buf system set up fully by this time, 

Not quite.

>> i.e. can I user getebuf()?

getebuf() doesn't exist.  If you mean geteblk(), not quite.

Buffers are initialized before devices, but bad things happen in the
(unlikely here) event that geteblk() sleeps.  `cold' is still 1, so
tsleep() doesn't actually sleep, it just does slplx(safepri) and returns.
There are several problems with this:

1. safepri isn't actually safe in general.  It is 0 but should be at
   least SWI_AST_MASK; this is a bug.

2. safepri isn't safe during device initialization.  During at least ISA
   initialization, the ipl is splhigh(), and lowering this is not good.

3. Lowering the ipl can't be expected to work during device initialization.
   Device drivers can't be expected to handle interrupts at this time, so
   no progress may be made towards freeing the resources that

Lowering the ipl is not good in general.  However, it sometimes helps(?)
by allowing writing of dirty buffers after the system panics at a high
ipl (tsleep() also lowers the ipl if it is called during a panic).
Disk drivers can't be expected to work at this time, but lowering the
ipl may allow the to work (dangerously).

Another answer: no :-).

>Heh.  I wrote the original SYSINIT stuff and you checked it in, but
>you have to ask???  8-).
>
>SI_SUB_DRIVERS		= 0x23000000,	/* Let Drivers initialize */
>SI_SUB_CONFIGURE	= 0x24000000,	/* Configure devices */
>SI_SUB_VM_CONF		= 0x38000000,	/* config VM, set limits*/
>
>This should mean "no".

This doesn't mean much.  SI_SUB_VM_CONF doesn't configure VM, it just
sets limits.  VM is initialized earlier in SI_SUB_VM.  Buffers are
initialized earlier in SI_SUB_CPU.  However, because of the above
problems, buffers can't be used until at least the end of device
configuration when `cold' is cleared.  I think geteblk() does work
then - I think tsleep() works well enough, although clock interrupts
are not initialized, so timeouts don't work.

Anyway, you should use Justin's new method of delaying device configuration
until all interrupts work.

Bruce



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