Page MenuHomeFreeBSD

kern_conf: fully initialize cloned devices with make_dev_args, too
ClosedPublic

Authored by kevans on Oct 5 2019, 12:55 PM.
Tags
None
Referenced Files
F82047124: D21904.diff
Wed, Apr 24, 11:50 PM
Unknown Object (File)
Feb 2 2024, 11:55 AM
Unknown Object (File)
Dec 20 2023, 12:30 AM
Unknown Object (File)
Dec 13 2023, 3:34 AM
Unknown Object (File)
Aug 26 2023, 4:01 AM
Unknown Object (File)
Aug 24 2023, 2:45 PM
Unknown Object (File)
Aug 4 2023, 4:17 PM
Unknown Object (File)
Aug 4 2023, 4:17 PM
Subscribers

Details

Summary

Attempting to initialize si_drv{1,2} with mda_si_drv{1,2} does not work if you are operating on cloned devices.

clone_create must be called prior to the make_dev* family to create/return the device on the clonelist as needed. This device is later returned early in newdev(), prior to si_drv{0,1,2} initialization.

This patch simply breaks out of the loop if we've found a non-(SI_CHEAPCLONE | SI_NAMED) device and finishes init. I'm not convinced SI_CHEAPCLONE needs to stick around from a brief poke around this stuff, but I've made sure we don't touch these devices if they are already initialized here.

Later check of !SI_NAMED in make_dev_sv could be removed now that newdev() should catch it earlier, but I've not done so.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
sys/kern/kern_conf.c
586 ↗(On Diff #62930)

I do not believe we ever set the SI_CHEAPCLONE flag anywhere. It probably should be removed finally. Or at least new uses should not be added.

This revision is now accepted and ready to land.Oct 5 2019, 7:08 PM
sys/kern/kern_conf.c
586 ↗(On Diff #62930)

grep seemed to think that SI_CHEAPCLONE was effectively a read-only flag. I added it here because make_dev_sv expects that it can happen. Do you mind if I commit it with SI_CHEAPCLONE then subsequently rip out SI_CHEAPCLONE altogether?

I think it's a good idea to make sure we're honoring callers' expectations until we rip it out, in case any downstream projects use it (for what reason, I do not understand).

sys/kern/kern_conf.c
586 ↗(On Diff #62930)

Do not add it there. Remove in follow-up commit.

sys/kern/kern_conf.c
586 ↗(On Diff #62930)

Alrighty then.