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 <bou...@antioche.eu.org> NetBSD: 26 ans d'experience feront toujours la difference --