On Thu, Apr 19, 2012 at 04:41:04PM +1000, matthew green wrote: > > > Module Name: src > > Committed By: bouyer > > Date: Wed Apr 18 20:37:49 UTC 2012 > > > > Modified Files: > > src/sys/dev/scsipi: scsipi_base.c > > > > Log Message: > > Fix KASSERT(): autoconf doesn't run under the KERNEL_LOCK > > this is true, but can you please fix it differently? ie autoconf > isn't "cold". most of scsi autoconf runs after cold is gone, so > i'd rather make whatever callers deal with it so that they work > cold or not.
But if we're not cold, interrupts are enabled so I hope whatever calls into scsi autoconf runs under the big lock if the underlying driver isn't SMP-safe (and if it is, it's its job to take the KERNEL_LOCK). The problem I've seen is with a driver I'm working on, similar to mfi(4) (and I suspect mfi(4) would have had the same problem): the driver's attach calls config_found_sm_loc() to attach the scsibus while cold, so the big lock isn't helt at this point. 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. What kind of senario do you have in mind ? -- Manuel Bouyer <bou...@antioche.eu.org> NetBSD: 26 ans d'experience feront toujours la difference --