Hi all, the following problem occured just to me. Suppose the last lines in my attach() function look something like:
if_attach(...) bus_setup_intr(...) Last time we had the locking discussion it was more or less the concensus, that no locking is needed in attach() and that the last thing I do is setting up the interrupt. It seems to me, however, that the following may happen here: 1. After if_attach but before setup_intr() a process on another processor calls if_ioctl to make the interface UP and if_start() to start output. 2. while the attach routine is blocked (perhaps while an interrupt is serverd) if_start initiates output. 3. The device tries to interrupt but cannot do that (setup_intr() has not been called yet). 4. The device gets stuck, because the interrupt is lost. 5. setup_intr() is called but that does not help. Is this a possible scenario? I must admit, that such a scenarion has a rather low probability, but according to Murphy's Law, it will happen. Maybe if_attach and bus_setup_intr can be reversed. In this case the interrupt routine must be careful to not call into the network system, because the network system doesn't know anything about the interface until if_attach(). Another solution would be to lock softc before if_attach, but this would probably provoke an LOR (as I remember). Regards, harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private [EMAIL PROTECTED], [EMAIL PROTECTED] To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-net" in the body of the message