OpenBSD CVS

CVS log for src/sys/sys/rwlock.h


[BACK] Up to [local] / src / sys / sys

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.28 / (download) - annotate - [select for diffs], Mon Jan 11 18:49:38 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, HEAD
Changes since 1.27: +23 -1 lines
Diff to previous 1.27 (colored)

New rw_obj_init() API providing reference-counted rwlock.

Original port from NetBSD by guenther@, required for upcoming amap & anon
locking.

ok kettenis@

Revision 1.27 / (download) - annotate - [select for diffs], Tue Dec 15 10:23:01 2020 UTC (3 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.26: +24 -1 lines
Diff to previous 1.26 (colored)

Add helpers around rw_status(9) to help checking if a lock is held.

ok visa@

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jul 16 01:40:49 2019 UTC (4 years, 10 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Make rrw_init/rrw_init_flags take a const name argument matching
rw_init/rw_init_flags and rwlock(9).

ok visa@ anton@ mpi@

Revision 1.25 / (download) - annotate - [select for diffs], Tue Apr 23 13:35:12 2019 UTC (5 years, 1 month ago) by visa
Branch: MAIN
Changes since 1.24: +9 -20 lines
Diff to previous 1.24 (colored)

Remove file name and line number output from witness(4)

Reduce code clutter by removing the file name and line number output
from witness(4). Typically it is easy enough to locate offending locks
using the stack traces that are shown in lock order conflict reports.
Tricky cases can be tracked using sysctl kern.witness.locktrace=1 .

This patch additionally removes the witness(4) wrapper for mutexes.
Now each mutex implementation has to invoke the WITNESS_*() macros
in order to utilize the checker.

Discussed with and OK dlg@, OK mpi@

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jun 8 15:38:15 2018 UTC (6 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.23: +8 -6 lines
Diff to previous 1.23 (colored)

Constipate all the struct lock_type's so they go into .rodata

ok visa@

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jun 4 04:46:07 2018 UTC (6 years ago) by guenther
Branch: MAIN
Changes since 1.22: +2 -1 lines
Diff to previous 1.22 (colored)

Add RW_DUPOK for suppressing witness checks for specific rw_enter() calls

ok deraadt@ visa@

Revision 1.22 / (download) - annotate - [select for diffs], Sat Aug 12 23:27:44 2017 UTC (6 years, 9 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.21: +3 -1 lines
Diff to previous 1.21 (colored)

Add rw_assert_anylock(), for assering you have it either read or write locked

ok tedu@ mpi@

Revision 1.21 / (download) - annotate - [select for diffs], Thu Apr 20 13:33:00 2017 UTC (7 years, 1 month ago) by visa
Branch: MAIN
Changes since 1.20: +81 -12 lines
Diff to previous 1.20 (colored)

Hook up rwlock(9) to witness(4).

Loosely based on a diff from Christian Ludwig

Revision 1.20 / (download) - annotate - [select for diffs], Wed Sep 21 10:19:13 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.19: +29 -29 lines
Diff to previous 1.19 (colored)

straighten the chairs

Revision 1.19 / (download) - annotate - [select for diffs], Wed Sep 21 07:44:36 2016 UTC (7 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.18: +29 -25 lines
Diff to previous 1.18 (colored)

Sprinkle some #ifdef _KERNEL, autumn is here.

ok dlg@

Revision 1.18 / (download) - annotate - [select for diffs], Wed Feb 11 00:14:11 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.17: +1 -5 lines
Diff to previous 1.17 (colored)

make the rwlock implementation MI.

each arch used to have to provide an rw_cas operation, but now we
have the rwlock code build its own version. on smp machines it uses
atomic_cas_ulong. on uniproc machines it avoids interlocked
instructions by using straight loads and stores. this is safe because
rwlocks are only used from process context and processes are currently
not preemptible in our kernel. so alpha/ppc/etc might get a benefit.

ok miod@ kettenis@ deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Tue Feb 10 10:04:27 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.16: +2 -7 lines
Diff to previous 1.16 (colored)

remove #ifndef handling of __HAVE_MD_RWLOCK. it's never set, and with a
reasonable compiler it isnt necessary.

ok miod@ art@

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jul 9 13:32:00 2014 UTC (9 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.15: +7 -1 lines
Diff to previous 1.15 (colored)

Teach rw_status() and rrw_status() to return LK_EXCLOTHER if it's write
locked by a different thread.  Teach lockstatus() to return LK_EXCLUSIVE
if an exclusive lock is held by some other thread.

ok beck@ tedu@

Revision 1.15 / (download) - annotate - [select for diffs], Sat Mar 29 18:09:31 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

It's been a quarter century: we can assume volatile is present with that name.

ok dlg@ mpi@ deraadt@

Revision 1.14 / (download) - annotate - [select for diffs], Wed May 1 17:13:05 2013 UTC (11 years, 1 month ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.13: +35 -31 lines
Diff to previous 1.13 (colored)

exorcise lockmgr. the api remains, but is now backed by recursive rwlocks.
originally by thib.
ok deraadt jsing and anyone who tested

Revision 1.13 / (download) - annotate - [select for diffs], Fri Sep 24 13:21:30 2010 UTC (13 years, 8 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.12: +7 -1 lines
Diff to previous 1.12 (colored)

Add stricter asserts to DIAGNOSTIC kernels to help catch mutex and
rwlock misuse.  In particular, this commit makes the following
changes:

  1. i386 and amd64 now count the number of active mutexes so that
assertwaitok(9) can detect attempts to sleep while holding a mutex.

  2. i386 and amd64 check that we actually hold mutexes when passed to
mtx_leave().

  3. Calls to rw_exit*() now call rw_assert_{rd,wr}lock() as
appropriate.

ok krw@, oga@; "sounds good to me" deraadt@; assembly bits double
checked by pirofti@

Revision 1.12 / (download) - annotate - [select for diffs], Thu Aug 13 21:22:29 2009 UTC (14 years, 10 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.11: +5 -1 lines
Diff to previous 1.11 (colored)

rwlock assertion functions, currently unused

ok art@

Revision 1.11 / (download) - annotate - [select for diffs], Tue May 29 00:17:32 2007 UTC (17 years ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

Add a name argument to the RWLOCK_INITIALIZER macro.
Pick reasonble names for the locks involved..

ok tedu@, art@

Revision 1.10 / (download) - annotate - [select for diffs], Fri May 4 12:56:15 2007 UTC (17 years, 1 month ago) by art
Branch: MAIN
Changes since 1.9: +4 -2 lines
Diff to previous 1.9 (colored)

- Rename rw_test_and_set to rw_cas, since most litterature uses the
  test_and_set name for some other operation, while cas is generally
  used for compare and set (cmpxchg in intel land, cas in sparc land).

- Make rw locks properly MP safe (provided that rw_cas is implemented
  in MD code). Most operations were MP safe except the sleep where we
  could have set the "I'm sleeping" flag before actually going to sleep
  so that the wakeup could miss us. Now, using the split tsleep,
  we first setup the sleep (put us on the sleep queues), then set
  the flag aborting the sleep if the lock has changed and then finally
  go to sleep.

miod@ ok (and he's been prodding me for days to get this in)

Revision 1.9 / (download) - annotate - [select for diffs], Wed Apr 4 18:01:57 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.8: +4 -2 lines
Diff to previous 1.8 (colored)

Implement RW_DOWNGRADE that downgrades an exclusive lock to a shared lock
without letting any other exclusive locks in between. As opposed to upgrading
locks, this is easy and solves real problems.

deraadt@ ok

Revision 1.8 / (download) - annotate - [select for diffs], Mon Jun 5 05:15:22 2006 UTC (18 years ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored)

fix really stupid botch i made in last commit. RW_WRITE and RW_READ are
array indices not flags, and can't be renumbered trivially.
noticed by sturm

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 2 05:02:34 2006 UTC (18 years ago) by tedu
Branch: MAIN
Changes since 1.6: +7 -9 lines
Diff to previous 1.6 (colored)

remove upgrade/downgrade, they are useless.
rework the main entry points to just use rw_test_and_set.
rework exit paths to be more like enter paths.
add sleepfail so more lockmgr can be replaced.
some from art, ok sturm

Revision 1.6 / (download) - annotate - [select for diffs], Sun May 7 20:12:41 2006 UTC (18 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.5: +3 -2 lines
Diff to previous 1.5 (colored)

add a name to rwlock so that we can tell where procs are getting stuck
without breaking into ddb.  doubles the size of rwlock [1], but moving
forward this really helps.  ok/tested pedro fgsch millert krw
[1 - next person to add a field to this struct gets whipped with a wet noodle]

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jan 6 06:50:31 2006 UTC (18 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.4: +18 -13 lines
Diff to previous 1.4 (colored)

check in of "rwlock.20051230" from art.
mostly cleanup and simplification, though now also supporting
upgrade and downgrade via the magic wand.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jul 21 12:10:20 2004 UTC (19 years, 10 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

I was wrong. The assymetry created by the proc argument to rw_enter_write
is horrible and doesn't add anything.

Remove it.
XXX - the fdplock macro will need a separate cleanup.

niklas@ markus@ ok

Revision 1.3.2.1 / (download) - annotate - [select for diffs], Thu Feb 19 11:01:34 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.3: +1 -1 lines
Diff to previous 1.3 (colored) next main 1.4 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.3 / (download) - annotate - [select for diffs], Sun Jan 11 00:42:03 2004 UTC (20 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_5_BASE, OPENBSD_3_5
Branch point for: SMP
Changes since 1.2: +4 -1 lines
Diff to previous 1.2 (colored)

let lsof compile again.  report and fix confirmed pvalchev@

Revision 1.2 / (download) - annotate - [select for diffs], Sun Dec 28 17:14:33 2003 UTC (20 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.1: +5 -1 lines
Diff to previous 1.1 (colored)

multiple include protection

Revision 1.1 / (download) - annotate - [select for diffs], Tue Nov 18 06:11:10 2003 UTC (20 years, 6 months ago) by tedu
Branch: MAIN

add lightwight reader/writer locks from art@.  we will be using these
later.  have been looked over for quite some time now.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.