Page MenuHomeFreeBSD

devfs: introduce a per-dev lock to protect ->si_devsw
ClosedPublic

Authored by mjg on Nov 25 2019, 4:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 29, 6:43 AM
Unknown Object (File)
Mar 7 2024, 7:06 PM
Unknown Object (File)
Jan 19 2024, 5:05 AM
Unknown Object (File)
Dec 23 2023, 12:13 AM
Unknown Object (File)
Nov 21 2023, 2:13 PM
Unknown Object (File)
Sep 27 2023, 10:59 PM
Unknown Object (File)
Sep 10 2023, 1:24 AM
Unknown Object (File)
Aug 7 2023, 9:41 AM

Details

Summary

This allows bumping threadcount without taking the global devmtx lock.

markj reports it eliminates contention on said lock on a sample system with 32 instances of bhyve. Also it went went through stress testing while hosting syzkaller. No issues found.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This absolutely requires a bump for D_VERSION.
May be add explicit order between devmtx and si_threadlock to the witness static table.

  • bump D_VERSION
  • annotate the lock in witness
sys/sys/conf.h
174 ↗(On Diff #64857)

After closer look, can we avoid this bump ? si_threadlock is used (should be used) only be devfs internals, so if you move the lock into cdev_priv it should still work.

  • move the lock to cdev_privdata

Except for the headers pollution, I am fine with the change.

sys/fs/devfs/devfs_int.h
43

Is that needed ? Even if it is, devfs_int.h is included in 5 or 6 files at all, so it is easy to arrange sys/mutex.h before it in .c files.

This revision is now accepted and ready to land.Nov 27 2019, 11:25 AM
  • drop _lock.h and _mtx.h

I included them towards self-contianment of the header file. universe MAKE_JUST_KERNELS builds just fine (except for powerpc* which were note tested)

This revision now requires review to proceed.Nov 27 2019, 3:34 PM
This revision is now accepted and ready to land.Nov 27 2019, 4:00 PM
This revision was automatically updated to reflect the committed changes.