Page MenuHomeFreeBSD

rangelock: add rangelock_cookie_assert
ClosedPublic

Authored by kevans on Sep 12 2019, 11:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 21, 1:24 PM
Unknown Object (File)
Tue, Nov 21, 1:24 PM
Unknown Object (File)
Tue, Nov 21, 1:24 PM
Unknown Object (File)
Tue, Nov 21, 1:24 PM
Unknown Object (File)
Tue, Nov 21, 1:12 PM
Unknown Object (File)
Nov 8 2023, 11:27 AM
Unknown Object (File)
Oct 7 2023, 10:24 AM
Unknown Object (File)
Sep 25 2023, 8:50 AM
Subscribers

Details

Summary

An approach to D21391 using rangelocks instead of an sx for the shm seal lock would have shm_dotruncate_locked take a cookie and assert that it's been granted a write lock to leave the locking out of the _locked function.

I do not yet know how I like the rangelock approach, but I think this is a good idea if we go that route.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 26449

Event Timeline

sys/kern/kern_rangelock.c
316

I would suggest to use KASSERT() instead of direct panic(9) call.

329

Why rl_q_flags instead of flags ?

Also I do not think that RCA_UNLOCKED assert could be made safe.

sys/sys/rangelock.h
101

I suspect it is too far in cargo cult. It is fine to define RCA_XXX as plain constants, I do not see a need in any services from sys/lock.h.

sys/kern/kern_rangelock.c
316

Hmm... this makes rangelock_cookie_assert useless if kernel is compiled with INVARIANT_SUPPORT but not INVARIANTS and one still wants to do rangelock cookie assertions in a module. Is this intended/desired?

329

Ah, missed converting that one.

True- I'll drop RCA_UNLOCKED.

sys/kern/kern_rangelock.c
316

I am not sure that we need support for rangelocking asserts without INVARIANTs, but I understand your point. In any case I do not insist on this.

Drop RCA_UNLOCKED and cookie cutter sys/lock.h dependency. Leaving the direct panic() as _rangelock_cookie_assert cannot be called on !INVARIANTS files anyways.

This revision is now accepted and ready to land.Sep 14 2019, 8:57 AM
This revision was automatically updated to reflect the committed changes.