Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/dev/scsipi



On Thu, Apr 19, 2012 at 06:25:54PM +1000, matthew green wrote:
> [...]
> 
> > If the driver's attach is called after cold (e.g. after a detach/rescan
> > of the pci bus), the driver's attach should be called with KERNEL_LOCK
> > held, or bad things may happen when interrupts are enabled for this driver.
> 
> there should be no reliance on "cold" being set for normal driver
> attach.  it might be a module loaded after boot.  how ever the
> driver is loaded, it will need to work without cold being set.

If it's a module laoded after boot, and the driver is not SMP-safe,
its attach function has to be called with KERNEL_LOCK held. Or you may
have problems when this driver starts receiving interrupts before its
attach function has returned (which is typically the case, interrupt enable
occurs somewhere in _attach()).

> 
> in my mind, the scsi code should try to run regardless of the value
> of "cold" and that's why i replied above.
> 
> > What kind of senario do you have in mind ?
> 
> modules, as above.  or simply drvctl -d / -r.  IMO, only platform
> specific code really should depend upon cold.  "scsipi", as a
> relatively high level subsystem, should not.

But I don't think it's the job of non-SMP-safe drivers to make sure scsipi
is called with KERNEL_LOCK held (and scsipi may be the only subsystem
to check for KERNEL_LOCK(), but others do rely on it as well - e.g.
sys/dev/ata). Either attach() functions should always be called with
KERNEL_LOCK(), or for checks as above we have to accept that when
cold, locking is not fully up yet and lock checks should be bypassed.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index