Create an API to take and drop the topo lock needed to manage
the newbus tree (bus_topo_lock() and bus_topo_unlock()). Add
bus_topo_mtx() to return this mutext (current Giant but soon to
be an SX lock I think).
Sponsored by: Netflix
Differential D31831
Create wrapper for Giant taken for newbus imp on Sep 4 2021, 4:36 AM. Authored by Tags None Referenced Files
Details
Create an API to take and drop the topo lock needed to manage Sponsored by: Netflix This needs a man page.
Diff Detail
Event TimelineComment Actions Patch looks good to me. The only comment I have is the function name? Why not just call it: bus_top_lock(); The four letters "topo" doesn't sound that good to me. Not that it matters. --HPS Comment Actions "topo" is the typical abbreviation for topology. Geom uses g_topology_lock() etc, but I thought that too long. I'd rather do topology than top since top means something a little different. Comment Actions I am mostly unfamiliar with miibus interface, but I see ~80 calls to mii_attach() in a tree, many of which are going from driver attach methods and are already under the lock. Are you expecting to recurse on the lock? Comment Actions Yea, that's one of the reasons why I need to separate out that change.... I convinced myself it was OK when I originally did it last year, but I need to study the code again I think to articulate the reason. With giant it doesn't matter, but it may in the future... Comment Actions remove miibus pushdown change that arrived I think via a rebase mistake when Comment Actions Add some notes for the reviewers that maybe don't belong in comments
Comment Actions I suggest you spell it out then, bus_topology_lock() is better than bus_topo_lock(), because "topo" means "top" in Portuguese, and in Spanish it means something completely different, and you already pointed out that "top" is not what you want to describe? --HPS Comment Actions Hi Warner, We don't want to have another "minion" discussion, look at this: In Italian "topo" means "mouse". --HPS Comment Actions Hans, I think you are too picky here. We already have xpt_topo_lock in CAM, ng_topo_lock in NetGraph, and 4 more line that in random drivers, so I think this abbreviation is quite typical. Comment Actions I think this may be different. We have the following: smp already has topo_nodes to map out the system topography, with lots of machdep code that uses the _topo_ names in various places. So unlike minion, which didn't have an established use, this just follows the patter that exists across a range of kernel subsystems. So there's already a preference for topo_ in this circumstance, imho, but I'm keeping an open mind for the moment. Comment Actions You could also add the explicit topology locking into sysctl_hdac_pindump() and hdaa_sysctl_reconfig(), and remove CTLFLAG_NEEDGIANT from all 3 places in hda(4) driver. Or I can do it separately after, if you prefer. Comment Actions Not sure if it is "new-bus" or "newbus", should just be consistent in the comments for DEVICE_SUSPEND/RESUME and the new comment in bus.h. An interesting question is if you want to go ahead and annotate shared locks vs write locks? For example, the pci_user case is likely a read lock of the topology. Possibly not really worth worrying about though.
|