Test boots for UFS for me.
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 15619 Build 15655: arc lint + arc unit
Event Timeline
There is one more user of vfs_mountroot(), from kern_reroot(). We have Giant locked around kern_reboot() call in kern_shutdown.c. I believe I cleaned geom from useless asserts that Giant is not owned, so may be the leftover is innocent.
Or may be, try to remove Giant from kern_shutdown.c as well. I suspect that other caller of kern_reboot(), namely shutdown_nice(), is not locked consistently. E.g. it seems that vt(4) does not lock Giant when calls it.
audit callers of shutdown_now
- Remove Giant from init creation and vfs_mountroot.
- These interrupts call shutdown_nice() which should be called Giant
- This is MPSAFE on this platform, so don't take Giant out while running
- Unlock giant when calling shutdown_nice()
- fold
- Mark this as MPSAFE -- unsure
- Drop giant before calling shutdown_nice. Not sure if these are called
I believe that I've cleaned up the whole mess, but I'm a little uneasy about psycho.c, the rest I'm confident on, assuming that my understanding of DROP_GIANT() will drop, if held, Giant, otherwise it won't matter that Giant is already unlocked.
Another round of careful preening of when / where we need to drop
Giant. It appears we don't need to drop in vt at all. Better fix for
psycho since I don't think those interrupts can be marked MPSAFE (at
least I'm unsure, so err on the side of caution).
- Remove Giant from init creation and vfs_mountroot.
- bufshutdown is no longer called with Giant held, so there's no need to
- These interrupts call shutdown_nice() which should be called Giant
- This is MPSAFE on this platform, so don't take Giant out while running
- Unlock giant when calling shutdown_nice()
- It's unclear if these interrupts can be marked MPSAFE, so drop Giant
I think that you are right in that your patch explicitly drop Giant before calling in shutdown_nice(), because shutdown uses delay and this might not drop GIant automatically.
For the sparc64 changes, I suggest to ask Marius.
sys/arm/at91/at91_rst.c | ||
---|---|---|
127 | Is this intended change ? It is not clear. | |
sys/sparc64/sbus/sbus.c | ||
414 | Are these interrupt handlers call to pyscho_XXX functions which you modified ? |
sys/arm/at91/at91_rst.c | ||
---|---|---|
127 | Yes. The callout_init function takes an mpsafe arg. We don't need giant to protect the timer routine, I don't think. It's intended, but I'll double check. | |
sys/sparc64/sbus/sbus.c | ||
414 | No. These are the handlers to the sbus interrupt routines that do something similar. Here I could just make the interrupts MPSAFE because they are (now) MPSAFE since all they do is call shutdown_nice() |
sys/sparc64/sbus/sbus.c | ||
---|---|---|
414 | No, these bits set up sbus_overtemp() and sbus_pwrfail() as interrupt handlers. |
sys/sparc64/sbus/sbus.c | ||
---|---|---|
414 | Calling something from the interrupt filter is almost same as calling the same code while owning a spinlock. Since shutdown_nice() does many top-half operations like locking a sleepable mutexes and sending signals, it cannot be called from the filter. |
sys/sparc64/sbus/sbus.c | ||
---|---|---|
414 | Okay, than it still would be preferable to modify psycho_set_intr() to set up the filters and handlers as INTR_MPSAFE instead of doing the mtx_unlock(&Giant) kludges in psycho_overtemp() and psycho_powerdown(). |
sys/sparc64/sbus/sbus.c | ||
---|---|---|
414 | That also means that there still is incorrect code in the tree, i. e. filters that call shutdow_nice(9), for example rt305x_gpio_intr() (I didn't do an exhaustive search, though). |
Update pyscho drivers per Marius.
- Remove Giant from init creation and vfs_mountroot.
- bufshutdown is no longer called with Giant held, so there's no need to
- These interrupts call shutdown_nice() which should be called Giant
- This is MPSAFE on this platform, so don't take Giant out while running
- Unlock giant when calling shutdown_nice()
- Mark psycho interrupts as MPSAFE. It's safe to do so now that we don't
Updated, per the review, but haven't gone back and re-checked to see if any of these routines are in a filter. I Think when I checked them, they were all MPSAFE, but I'll admit I wasn't looking for filters at the time.
sys/sparc64/sbus/sbus.c | ||
---|---|---|
414 | There is no rt305x_gpio_intr in the tree that I can find. It was from the obsolete port to the mediatek stuff that was deleted in favor of sys/mips/mediatek. |
sys/sparc64/sbus/sbus.c | ||
---|---|---|
414 | Ah, this then means that the head tree of fxr.watson.org currently is out of date :) |
I'd love to finally kill it, but that will be having some kind of topology lock in newbus after all these years... :)