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
F103071611: D33400.diff
Wed, Nov 20, 1:39 PM
Unknown Object (File)
Fri, Nov 8, 1:19 AM
Unknown Object (File)
Sep 18 2024, 4:50 PM
Unknown Object (File)
Sep 8 2024, 9:12 PM
Unknown Object (File)
Sep 7 2024, 5:11 PM
Unknown Object (File)
Sep 7 2024, 11:15 AM
Unknown Object (File)
Sep 2 2024, 3:11 AM
Unknown Object (File)
Aug 31 2024, 1:13 AM

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 43301
Build 40189: 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.