Page MenuHomeFreeBSD

kqueue: add knlist_init_sx() for shared/exclusive locks
AbandonedPublic

Authored by rew on Dec 13 2021, 2:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 4, 1:28 AM
Unknown Object (File)
Dec 20 2023, 2:04 AM
Unknown Object (File)
Nov 17 2023, 3:09 PM
Unknown Object (File)
Nov 7 2023, 7:41 PM
Unknown Object (File)
Nov 6 2023, 9:50 PM
Unknown Object (File)
Oct 6 2023, 6:37 PM
Unknown Object (File)
Oct 5 2023, 8:49 PM
Unknown Object (File)
Sep 3 2023, 3:44 PM

Details

Reviewers
markj
kib
pauamma_gundo.com
Group Reviewers
manpages
Summary

The intended consumer for this patch is https://reviews.freebsd.org/D33401.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46532
Build 43421: arc lint + arc unit

Event Timeline

rew requested review of this revision.Dec 13 2021, 2:08 AM

Other than my question about "may", the grammar and spelling LGTM. I'll leave reviewing the source and the consistency between them to domain experts.

share/man/man9/kqueue.9
328

Something for a content expert to assess; is "may" right here? That is, are both options about equally appropriate? Or would be "should", "must", or "needs to" more appropriate?

kevans added inline comments.
share/man/man9/kqueue.9
328

Right, the strength of 'may' is fine for this. It's a good idea and you'll probably prefer it if you have an sx, but there's nothing inherently wrong with not using it for whatever reason.

  • bump manpage date
  • use LA_LOCKED to be consistent with the other knlist assert routines

Manual page LGTM, but holding approval until someone/somegroup is added for kernel code review.

rew added reviewers: markj, kib.

Is it for single consumer? Did you tried to look in the source tree for any more uses (I doubt that we have that)?

In D33400#818876, @kib wrote:

Is it for single consumer?

Yes, OpenZFS would be the only consumer. I went in this direction because ZFS uses an sx lock to protect the zvol state. Most, if not all, users of the knlist_init() routines use a mutex to protect their device state. Using the global knlist lock instead of the zvol state lock didn't seem like the correct approach though?

Did you tried to look in the source tree for any more uses (I doubt that we have that)?

I didn't do an exhaustive audit but, I didn't see anything right off.

As a side note - knlist_init_rw_reader() was last used in afa85850e79c1839ec33efa1138206687b952cfa, I'm guessing it can be removed now.

In D33400#818950, @rew wrote:
In D33400#818876, @kib wrote:

Is it for single consumer?

Yes, OpenZFS would be the only consumer. I went in this direction because ZFS uses an sx lock to protect the zvol state. Most, if not all, users of the knlist_init() routines use a mutex to protect their device state. Using the global knlist lock instead of the zvol state lock didn't seem like the correct approach though?

I meant something different. There is a very little need to add knlist_init_sx(9), when we only have single consumer. Put the code into ZFS OS-specific file.

Did you tried to look in the source tree for any more uses (I doubt that we have that)?

I didn't do an exhaustive audit but, I didn't see anything right off.

Right.

As a side note - knlist_init_rw_reader() was last used in afa85850e79c1839ec33efa1138206687b952cfa, I'm guessing it can be removed now.

Sure, this should be a separate commit.

Assuming consistent with source.

share/man/man9/kqueue.9
27

Will need another bump.

This revision is now accepted and ready to land.Aug 8 2022, 10:04 AM
In D33400#818953, @kib wrote:

I meant something different. There is a very little need to add knlist_init_sx(9), when we only have single consumer. Put the code into ZFS OS-specific file.

Will do - it did feel slightly odd to drop it in here since it's likely to only be used by ZFS.

Thanks for looking at this.