Subject: re: have scsibus sleep only one time
To: Matt Thomas <matt@3am-software.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/10/2003 09:10:49
On Sun, 9 Mar 2003, Matt Thomas wrote:

> At 06:04 PM 3/9/2003, matthew green wrote:
> >
> >    Hi,
> >    would anyone object to the attached change ?
> >    It makes all the attached scsibusses sleep "in parallel" instead of
> >    sequencially, which is a real win for machines with several SCSI busses.
> >    On my DS20, which has 8 scsi busses, this saves 14 seconds on boot.
> >
> >
> >i think this change is a wonderful idea.
>
> There is one issue with this.  If you don't wire down your scsi devices
> in your config file, they may get attached in random order.

I thought that's what the mutex in there was for?

Oh, I see. All the busses could go to sleep, then wake randomly. Then we
will be polling busses in wake-order, not probe-order.

I think then the thing to do is keep the code the way it was, but have a
way to indicate that we have slept already. i.e. the first sleeper sets a
flag that gets cleared at boot.

Or, better yet, we keep track of a scsibus-sleep-generation number. When
we first attach the bus, we note the generation. We then proceed as now,
leaving the sleep code where it is. However before sleeping, we check to
see if the scsibus-sleep-generation number is the same as it was. If it's
the same, we sleep. If it's different, we don't.

That way we keep the same ordering as now, but only sleep once.

Take care,

Bill