MP and device drivers
Andrew Doran <[email protected]> Sun, 3 Sep 2006 16:02:38 +0100
| Newsgroups | gmane.os.netbsd.devel.smp |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I would like to gate entry to character and block drivers so that we acquire the kernel_lock if the driver is not marked as MP safe. Here are my initial thoughts: - Make callout_init() take a flag indicating MP-safety. We'd take the kernel_lock just before final dispatch of the callout. - Put wrappers around the devsw entry points (e.g. bdev_strategy(dev, bp)). In the MP case these would check d_flag and maybe grab the kernel_lock. We'd need to assert that no other locks are already held. - Modify generic soft interrupts and hard interupts not to take the kernel lock if the handler is marked as MP safe. - Take the lock in shutdown hooks and perhaps other minor entry points. As others have mentioned these should be proper driver entry points but that's a whole other can of worms. There are some problems with this approach: - There are multiple places in each driver where we have to specify 'MP safe'. Ideally we would stash this information somewhere else, like cfattach or the lkm info. - This doesn't handle network drivers and 'oddball' drivers, but that's beyond what I'm trying to do. Can you see other problems with this approach? Thoughts? Thanks, Andrew