Page MenuHomeFreeBSD

newbus: Push down the locking in driver_module_handler
Needs ReviewPublic

Authored by imp on Mon, Nov 10, 10:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 11, 9:26 PM
Unknown Object (File)
Tue, Nov 11, 9:25 PM
Unknown Object (File)
Tue, Nov 11, 5:00 PM
Unknown Object (File)
Tue, Nov 11, 10:12 AM
Unknown Object (File)
Tue, Nov 11, 9:35 AM
Unknown Object (File)
Tue, Nov 11, 5:39 AM
Unknown Object (File)
Tue, Nov 11, 5:11 AM
Unknown Object (File)
Tue, Nov 11, 3:23 AM
Subscribers

Details

Reviewers
jhb
markj
Summary

Hold the topo lock over the calls to newbus, but not for chaining
function. Also, we should only create the devclase for MOD_LOAD, but not
for any other case. This also avoids calling any newbus functions for
module unknown MOD_ cases (which in practice is no actual chanage).

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68522
Build 65405: arc lint + arc unit

Event Timeline

imp requested review of this revision.Mon, Nov 10, 10:08 PM
sys/kern/subr_bus.c
5298

Why exactly don't we want to hold the lock here?

What's an example of a chainevh in the tree? I can't find any uses with a quick look, but I'm probably missing something obvious.

sys/kern/subr_bus.c
5298

That's because it's set in a macro that's used all over the place, but often takes NULL parameters.
grep -r sys/dev MOD_LOAD: gives a good proxy for what to grep for. Many of them are for DEV_MODULE which is for dev_t not device_t.
Others are for DEVICE_MODULE where the next to last parameter is non NULL.
Some clearly require locking. Others ambiguously require it, but maybe not. Some are safe. I'm thinking for the first round we may want to keep the topo lock over these calls.
.... but some newer ones like nvmf look like they should be called unlocked.
So maybe I need to do a careful audit before proceeding. Today we call them all with Giant locked though.

5298

oh, and things like

moduledata_t icl_soft_data = {
        "icl_soft",
        icl_soft_modevent,
        0
};