Page MenuHomeFreeBSD

inpcb: Upgrade some lock assertions
AbandonedPublic

Authored by markj on Feb 2 2023, 10:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 8 2024, 9:01 AM
Unknown Object (File)
Nov 21 2024, 6:46 AM
Unknown Object (File)
Oct 2 2024, 8:30 AM
Unknown Object (File)
Sep 29 2024, 9:45 PM
Unknown Object (File)
Sep 22 2024, 6:29 AM
Unknown Object (File)
Sep 21 2024, 1:56 AM
Unknown Object (File)
Sep 20 2024, 5:22 AM
Unknown Object (File)
Sep 19 2024, 7:59 PM
Subscribers

Details

Reviewers
glebius
Group Reviewers
network
Summary

INP_HASH_LOCK_ASSERT() asserts that the caller is either in an SMR read
section, or holds the hash lock, which is not in fact a rwlock but is
simply a mutex. However, most users of INP_HASH_LOCK_ASSERT() really
require the mutex, so let's tighten the assertions a bit.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 49499
Build 46389: arc lint + arc unit

Event Timeline

markj requested review of this revision.Feb 2 2023, 10:42 PM
glebius requested changes to this revision.Feb 2 2023, 11:57 PM

I don't agree with this change. Right now these assertions document that a function does not require write access to the hash. The fact that most callers call them with write lock is a problem, not a feature.

This revision now requires changes to proceed.Feb 2 2023, 11:57 PM

I don't agree with this change. Right now these assertions document that a function does not require write access to the hash. The fact that most callers call them with write lock is a problem, not a feature.

Are you suggesting that the hash lock should become a true reader/writer lock?

A different approach would be to add something like INP_HASH_SMR_ASSERT() which asserts that the SMR read section is entered or the hash lock is held. Then that assertion would be used in hash lookup routines. Does that sound reasonable?

Are you suggesting that the hash lock should become a true reader/writer lock?

I didn't suggest that, but it is potentially possible. Why not? If this happens, the current assertions would work. The new assertions that this revision suggests may start failing.

A different approach would be to add something like INP_HASH_SMR_ASSERT() which asserts that the SMR read section is entered or the hash lock is held. Then that assertion would be used in hash lookup routines. Does that sound reasonable?

So you are suggesting to rename INP_HASH_LOCK_ASSERT() into something else that would have a better name. No objection from me! This name of course is inherited from pre-SMR times.