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)
Mon, Dec 9, 11:08 AM
Unknown Object (File)
Wed, Dec 4, 10:14 AM
Unknown Object (File)
Oct 17 2024, 8:40 AM
Unknown Object (File)
Sep 9 2024, 10:22 PM
Unknown Object (File)
Sep 7 2024, 6:40 PM
Unknown Object (File)
Sep 5 2024, 2:57 AM
Unknown Object (File)
Sep 5 2024, 1:22 AM
Unknown Object (File)
Sep 2 2024, 2:51 PM

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

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

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 ↗(On Diff #64923)

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.