Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/kern_rwlock.c
RevisionDateAuthorComments
 1.76  15-Oct-2023  riastradh kern_rwlock.c: Sort includes. No functional change intended.
 1.75  15-Oct-2023  riastradh sys/lwp.h: Nix sys/syncobj.h dependency.

Remove it in ddb/db_syncobj.h too.

New sys/wchan.h defines wchan_t so that users need not pull in
sys/syncobj.h to get it.

Sprinkle #include <sys/syncobj.h> in .c files where it is now needed.
 1.74  04-Oct-2023  ad Turnstiles: use the syncobj name for ps/top wmesg when sleeping since it's
more informative than "tstile".
 1.73  23-Sep-2023  ad - Simplify how priority boost for blocking in kernel is handled. Rather
than setting it up at each site where we block, make it a property of
syncobj_t. Then, do not hang onto the priority boost until userret(),
drop it as soon as the LWP is out of the run queue and onto a CPU.
Holding onto it longer is of questionable benefit.

- This allows two members of lwp_t to be deleted, and mi_userret() to be
simplified a lot (next step: trim it down to a single conditional).

- While here, constify syncobj_t and de-inline a bunch of small functions
like lwp_lock() which turn out not to be small after all (I don't know
why, but atomic_*_relaxed() seem to provoke a compiler shitfit above and
beyond what volatile does).
 1.72  07-Sep-2023  ad Remove dodgy and unused mutex_owner_running() & rw_owner_running().
 1.71  17-Jul-2023  riastradh kern: New struct syncobj::sobj_name member for diagnostics.

XXX potential kernel ABI change -- not sure any modules actually use
struct syncobj but it's hard to rule that out because sys/syncobj.h
leaks into sys/lwp.h
 1.70  24-Feb-2023  riastradh rwlock(9): Omit needless macro indirection for membars.

No functional change intended.
 1.69  24-Feb-2023  riastradh kern: Eliminate most __HAVE_ATOMIC_AS_MEMBAR conditionals.

I'm leaving in the conditional around the legacy membar_enters
(store-before-load, store-before-store) in kern_mutex.c and in
kern_lock.c because they may still matter: store-before-load barriers
tend to be the most expensive kind, so eliding them is probably
worthwhile on x86. (It also may not matter; I just don't care to do
measurements right now, and it's a single valid and potentially
justifiable use case in the whole tree.)

However, membar_release/acquire can be mere instruction barriers on
all TSO platforms including x86, so there's no need to go out of our
way with a bad API to conditionalize them. If the procedure call
overhead is measurable we just could change them to be macros on x86
that expand into __insn_barrier.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html
 1.68  24-Feb-2023  riastradh rwlock(9): Fix membars.

rw_downgrade must be a release operation, and rw_tryupgrade must be
an acquire operation. membar_producer is not enough -- need to use
membar_release and membar_acquire.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/22/msg028726.html

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.67  27-Jan-2023  ozaki-r Sprinkle __predict_{true,false} for panicstr checks
 1.66  09-Apr-2022  riastradh branches: 1.66.4;
rwlock(9): Convert to membar_acquire/release.

Leave an XXX comment where I suspect there might be a missing membar
-- to be audited when I have more time to think!
 1.65  22-Feb-2020  ad Add rw_lock_op(): return either RW_READER or RW_WRITER for a lock that is
known to be held by the caller. Panic if the lock is not held.
 1.64  22-Jan-2020  ad Add a comment.
 1.63  21-Jan-2020  ad Add a rw_owner_running() for the pagedaemon.
 1.62  20-Jan-2020  ad PR kern/54880: -current hangs in mountroot

- Don't set the RW_NODEBUG flag on init, since assembly stubs can't handle it.
- rw_downgrade(): fix a case where the RW_NODEBUG flag was lost.
 1.61  19-Jan-2020  ad Tidy rwlocks a bit, no functional change intended. Mainly:

- rw_downgrade(): do it in a for () loop like all the others.
- Explicitly carry around RW_NODEBUG - don't be lazy.
- Remove pointless macros.
- Don't make assertions conditional on LOCKDEBUG, there's no reason.
- Make space for a new flag bit (not added yet).
 1.60  12-Jan-2020  ad - Shuffle some items around in struct lwp to save space. Remove an unused
item or two.

- For lockstat, get a useful callsite for vnode locks (caller to vn_lock()).
 1.59  09-Dec-2019  ad branches: 1.59.2;
Expunge the panicstr checks, we don't need them.
 1.58  30-Nov-2019  ad Back out previous. It works on amd64 under stress test but not
evbarm-aarch64 for some reason. Will revisit.
 1.57  29-Nov-2019  ad A couple more tweaks to avoid reading the lock word.
 1.56  29-Nov-2019  riastradh Largely eliminate the MD rwlock.h header file.

This was full of definitions that have been obsolete for over a
decade. The file still remains for __HAVE_RW_STUBS but that's all.
Used only internally in kern_rwlock.c now, not by <sys/rwlock.h>.
 1.55  25-Nov-2019  ad Remove some unneeded memory barriers and reads of the lock word.
Prodded by Mateusz Guzik.
 1.54  09-May-2019  ozaki-r branches: 1.54.2;
Avoid prepending a timestamp to lock debug outputs on ddb

Lock printer functions (lockops_t#lo_dump) use printf_nolog to print, but
printf_nolog now prepends a timestamp which is unnecessary for ddb:

db{0}> show all locks/t
[Locks tracked through LWPs]
Locks held by an LWP (iperf):
Lock 0 (initialized at soinit)
lock address : 0xffffedeb84b06080 type : sleep/adaptive
initialized : 0xffffffff806d8c3f
shared holds : 0 exclusive: 1
shares wanted: 0 exclusive: 11
current cpu : 0 last held: 1
current lwp : 0xffffedeb849ff040 last held: 0xffffedeb7dfdb240
last locked* : 0xffffffff806d8335 unlocked : 0xffffffff806d8385
[ 79103.0868574] owner field : 0xffffedeb7dfdb240 wait/spin: 1/0

Fix it by passing a printer function to lo_dump functions, i.e., make the
functions use db_printf on ddb.
 1.53  17-Apr-2019  ozaki-r Don't check pserialize_not_in_read_section after panic

It can cause a false positive assertion failure.
 1.52  31-Aug-2018  ozaki-r Sprinkle __predict_false to dedicated assertions of mutex and rwlock
 1.51  14-Aug-2018  ozaki-r Check pserialize_not_in_read_section for adaptive mutexes and rwlocks

The overhead of the checks is not negligible so they're turned on only if both
DEBUG and LOCKDEBUG are enabled.
 1.50  05-Feb-2018  ozaki-r branches: 1.50.2; 1.50.4;
Obtain proper initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc

Initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
were not useful because the addresses were mutex_obj_alloc or rw_obj_alloc
itself. What we want to know are callers of them.
 1.49  30-Jan-2018  ozaki-r Apply C99-style struct initialization to syncobj_t
 1.48  25-Dec-2017  ozaki-r Apply C99-style struct initialization to lockops_t
 1.47  16-Sep-2017  christos more const
 1.46  26-Jan-2017  christos branches: 1.46.6;
For LOCKDEBUG:
Always provide the location of the caller of the lock as __func__, __LINE__.
 1.45  28-Nov-2014  uebayasi branches: 1.45.2; 1.45.4; 1.45.6;
Consistently use KPREEMPT_*() here.
 1.44  05-Sep-2014  matt Don't next structure and enum definitions.
Don't use C++ keywords new, try, class, private, etc.
 1.43  30-Jul-2014  ozaki-r Fix typo in comment
 1.42  19-Oct-2013  mrg branches: 1.42.2;
use __USE() where appropriate.
 1.41  04-Sep-2013  skrll Typo in comment.
 1.40  27-Apr-2013  mlelstv branches: 1.40.4;
Revert change that allowed rw_tryenter(&lock, RW_READER) to recurse
for vfs_busy(). This is no longer necessary.
 1.39  12-Dec-2012  yamt rw_vector_enter: reload owner in the case of no hand-off.
this fixes crashes in rw_oncpu().
 1.38  25-Feb-2012  rmind branches: 1.38.2;
{mutex,rw}_vector_enter: use macro versions to disable/enable preemption.
 1.37  20-Mar-2011  rmind branches: 1.37.4; 1.37.8;
Optimise mutex_onproc() and rw_onproc() by making them O(1), instead
of O(ncpu) for adaptive paths. Add an LWP destructor, lwp_dtor() with
a comment describing the principle of this barrier.

Reviewed by yamt@ and ad@.
 1.36  08-Feb-2010  skrll branches: 1.36.2; 1.36.4;
Re-apply:

Invert the sense of the bit to mark if LOCKDEBUG is enabled to
disabled.

This will help my fellow developers spot "use before initialised"
problems that hppa picks up very well.

but fix the !LOCKDEBUG case by defining the "no debug" bits to zero so
they have no effect on lock stubs.
 1.35  06-Feb-2010  cube branches: 1.35.2;
Revert commit from Fri Feb 5 06:43:17 UTC 2010 by skrll:

Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.

This will help my fellow developers spot "use before initialised" problems
that hppa picks up very well.

It has to be done differently, because the semantics of mtx_owner in the non-
LOCKDEBUG case can vary significantly between archs, and thus it is not
possible to simply flip a bit to 1.

Ok core@, as at least i386 is unbootable right now.
 1.34  05-Feb-2010  skrll Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.

This will help my fellow developers spot "use before initialised" problems
that hppa picks up very well.
 1.33  04-Nov-2009  pooka Heave-ho mutex/rwlock object routines into separate modules -- they
don't have anything to do with the lock internals.
 1.32  16-May-2009  yamt rw_vector_exit: remove a redundant condition.
 1.31  09-May-2009  yamt lockdebug fixes for rw_tryupgrade/rw_downgrade.
 1.30  24-Apr-2009  ad A workaround for a bug with some Opteron revisions where locked operations
sometimes do not serve as memory barriers, allowing memory references to
bleed outside of critical sections. It's possible that this is the
reason for pkgbuild's longstanding crashiness.

For rwlocks, always enable the explicit membars. They were disabled only
on x86, and since they are not in the fast-path it's not a big deal.
TODO: convert these to an atomic_membar_foo() or similar that does ordering
between regular data references and atomic references.
 1.29  19-Apr-2009  ad Add rw_obj_*() functions to mirror the existing mutex functions.
Proposed on tech-kern quite some time ago.
 1.28  29-Jul-2008  thorpej branches: 1.28.2; 1.28.4; 1.28.8; 1.28.10;
rw_vector_exit(): When doing direct hand-off to a writer, only set
RW_WRITE_WANTED if there are additional writers waiting.
 1.27  17-Jul-2008  rmind PR/39155: Wolfgang Solfrank: Invalid parameter to turnstile_exit in rw_downgrade.
 1.26  31-May-2008  ad branches: 1.26.2; 1.26.4;
Use __noinline.
 1.25  31-May-2008  ad LOCKDEBUG:

- Tweak it so it can also catch common errors with condition variables.
The change to kern_condvar.c is not included in this commit and will
come later.

- Don't call kmem_alloc() if operating in interrupt context, just fail
the allocation and disable debugging for the object. Makes it safe
to do mutex_init/rw_init/cv_init in interrupt context, when running
a LOCKDEBUG kernel.
 1.24  19-May-2008  ad Reduce ifdefs due to MULTIPROCESSOR slightly.
 1.23  06-May-2008  ad branches: 1.23.2;
Allow rw_tryenter(&lock, RW_READER) to recurse, for vfs_busy().
 1.22  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.21  22-Apr-2008  ad branches: 1.21.2;
mutex_owned, rw_read_held, rw_write_held, rw_lock_held: check for a NULL
pointer.
 1.20  11-Apr-2008  ad branches: 1.20.2;
rwlock changes, discussed on tech-kern:

- Use atomic ops directly, since rwlocks work the same way on all platforms.
- Try to make it a bit more cache efficient, and use branch hints.
- Fix a bug in rw_downgrade() where the turnstile lock was not released.
- Remove a couple of redundant assertions.
- Use atomic_swap instead of atomic_cas where it's safe to do so.
- After acquiring the turnstile lock in rw_vector_enter, check if the
owner is running again and spin if so.
- Introduce and use rw_onproc() instead of abusing mutex_onproc().
- Change the handoff/release algorithm to reduce the window when a rwlock
can held, but the owner not on a CPU.
 1.19  04-Apr-2008  ad Do adaptive spinning for rwlocks, but only if the lock is write held and
there are no waiters. This gives a major boost to build.sh on larger
systems as directory vnode locks are exclusive for lookup, but are often
only held for a very short period of time.

This change has the potential to more readily expose lock order reversals
and other types of deadlock.
 1.18  28-Jan-2008  ad branches: 1.18.6;
Fix error in previous. Spotted by yamt@.
 1.17  26-Jan-2008  ad rw_write_held: return true only if held by the current LWP.
 1.16  25-Jan-2008  ad - Prevent LOCKDEBUG from complaining if we do rw_tryenter() on a lock
that we already own.
- Add an assembly stub for rw_tryenter().
 1.15  04-Jan-2008  ad Need sys/lock.h for kernel_lock.
 1.14  04-Jan-2008  ad Pull in sys/atomic.h for memory barriers.
 1.13  04-Dec-2007  ad branches: 1.13.4;
rw_vector_enter: assert !cpu_intr_p().
 1.12  21-Nov-2007  yamt branches: 1.12.2;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.11  11-Oct-2007  ad branches: 1.11.2; 1.11.4;
Merge from vmlocking:

- G/C spinlockmgr() and simple_lock debugging.
- Always include the kernel_lock functions, for LKMs.
- Slightly improved subr_lockdebug code.
- Keep sizeof(struct lock) the same if LOCKDEBUG.
 1.10  21-Sep-2007  dsl branches: 1.10.2;
Include sys/cdefs.h first.
 1.9  17-Sep-2007  ad __FUNCTION__ -> __func__
 1.8  17-May-2007  yamt branches: 1.8.6; 1.8.8;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.7  30-Mar-2007  ad branches: 1.7.2;
Cosmetic changes.
 1.6  03-Mar-2007  itohy branches: 1.6.2; 1.6.4;
Remove extra space so that symbol renaming works properly.
 1.5  26-Feb-2007  ad Add a comment.
 1.4  26-Feb-2007  yamt implement priority inheritance.
 1.3  10-Feb-2007  ad branches: 1.3.2;
- Add/correct comments.
- Print correct function name when an assertion triggers.
 1.2  09-Feb-2007  ad Merge newlock2 to head.
 1.1  14-Mar-2002  thorpej branches: 1.1.2; 1.1.18; 1.1.36;
file kern_rwlock.c was initially added on branch newlock.
 1.1.36.10  09-Feb-2007  ad - Change syncobj_t::sobj_changepri() to alter both the user priority and
the effective priority of LWPs. How the effective priority is adjusted
depends on the type of object.
- Add a couple of comments to sched_kpri() and remrunqueue().
 1.1.36.9  06-Feb-2007  ad lockstat:

- Cache enabled/disabled status on entry.
- Don't read the cycle counter unless enabled.
 1.1.36.8  05-Feb-2007  ad - Decouple downgrade from rw_vector_exit(), and simplify a bit.
- Fix a problem that could cause stalls under load.
 1.1.36.7  31-Jan-2007  ad Catch deadlocks earlier.
 1.1.36.6  11-Jan-2007  ad Checkpoint work in progress.
 1.1.36.5  29-Dec-2006  ad Checkpoint work in progress.
 1.1.36.4  17-Nov-2006  ad Checkpoint work in progress.
 1.1.36.3  20-Oct-2006  ad - Update for lockdebug changes.
- Define mutex_getspl(), mutex_setspl() for modifying saved SPL value.
 1.1.36.2  11-Sep-2006  ad Don't do the simplelock check if panicstr is set.
 1.1.36.1  10-Sep-2006  ad Add updated locking primatives.
 1.1.18.6  04-Feb-2008  yamt sync with head.
 1.1.18.5  21-Jan-2008  yamt sync with head
 1.1.18.4  07-Dec-2007  yamt sync with head
 1.1.18.3  27-Oct-2007  yamt sync with head.
 1.1.18.2  03-Sep-2007  yamt sync with head.
 1.1.18.1  26-Feb-2007  yamt sync with head.
 1.1.2.5  22-Mar-2002  thorpej Add some basic debugging infrastructure as found in mutexes.
 1.1.2.4  17-Mar-2002  thorpej Change RWLOCK_ACQUIRE() and RWLOCK_RELEASE() to evaluate to true
or false depending on the success of the "compare and swap" operation.

This makes them a lot easier to implement on IA32.
 1.1.2.3  16-Mar-2002  thorpej Add a "nextproc" argument to turnstile_wakeup() to selectively
wake up a single thread. This will allow us to implement direct
handoff of rwlocks.
 1.1.2.2  16-Mar-2002  thorpej Make turnstiles actually have two queues (reader and writer). Users
of turnsitles still don't differentiate between them.
 1.1.2.1  14-Mar-2002  thorpej Reader/writer lock implementation, modeled after the Solaris rwlocks,
a description of which can be found in:

Solaris Internals: Core Kernel Architecture, Jim Mauro and
Richard McDougall, section 3.6.

XXX Does not currently distinguish between waiting readers and
waiting writers.
XXX Because of above, does not yet implement direct-handoff.
 1.3.2.4  19-Apr-2007  ad Pull up a change from the vmlocking branch:

- Ensure that LWPs going to sleep are on the sleep queue before releasing
any interlocks. This is so that calls to turnstile_wakeup will have the
correct locks held when adjusting priority. Avoids another deadlock.
- Assume that LWPs blocked on a turnstile will never be swapped out.
- LWPs blocking on a turnstile must have kernel priority, as they
are consuming kernel resources.
 1.3.2.3  15-Apr-2007  yamt sync with head.
 1.3.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.3.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.6.4.1  11-Jul-2007  mjf Sync with head.
 1.6.2.7  09-Oct-2007  ad Sync with head.
 1.6.2.6  20-Aug-2007  ad Track where locks were initialized.
 1.6.2.5  29-Jul-2007  ad Simplify the code a bit.
 1.6.2.4  15-Jul-2007  ad KASSERT(!cpu_intr_p()) in a couple of places.
 1.6.2.3  10-Apr-2007  ad - Ensure that that LWPs going to sleep are on the sleep queue and so
have their syncobj pointer updated, so that calls to turnstile_wakeup
will have the correct locks held when adjusting the current LWP's
priority. Avoids another deadlock.
- Assume that LWPs blocked on a turnstile will never be swapped out.
- LWPs blocking on a turnstile must have kernel priority, as they
are consuming kernel resources.
 1.6.2.2  10-Apr-2007  ad Sync with head.
 1.6.2.1  21-Mar-2007  ad GC the simplelock/spinlock debugging stuff.
 1.7.2.1  17-Apr-2007  thorpej In the simple case, provide a generic CAS macro if the MD header does
not provide one.
 1.8.8.3  23-Mar-2008  matt sync with HEAD
 1.8.8.2  09-Jan-2008  matt sync with HEAD
 1.8.8.1  06-Nov-2007  matt sync with HEAD
 1.8.6.4  09-Dec-2007  jmcneill Sync with HEAD.
 1.8.6.3  21-Nov-2007  joerg Sync with HEAD.
 1.8.6.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.8.6.1  02-Oct-2007  joerg Sync with HEAD.
 1.10.2.1  14-Oct-2007  yamt sync with head.
 1.11.4.2  18-Feb-2008  mjf Sync with HEAD.
 1.11.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.11.2.1  21-Nov-2007  bouyer Sync with HEAD
 1.12.2.1  08-Dec-2007  ad Sync with head.
 1.13.4.1  08-Jan-2008  bouyer Sync with HEAD
 1.18.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.18.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.20.2.2  04-Jun-2008  yamt sync with head
 1.20.2.1  18-May-2008  yamt sync with head.
 1.21.2.4  11-Mar-2010  yamt sync with head
 1.21.2.3  16-May-2009  yamt sync with head
 1.21.2.2  04-May-2009  yamt sync with head.
 1.21.2.1  16-May-2008  yamt sync with head.
 1.23.2.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.23.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.4.1  19-Oct-2008  haad Sync with HEAD.
 1.26.2.2  31-Jul-2008  simonb Sync with head.
 1.26.2.1  18-Jul-2008  simonb Sync with head.
 1.28.10.2  01-Jul-2009  snj branches: 1.28.10.2.2;
Pull up following revision(s) (requested by rmind in ticket #837):
sys/kern/kern_rwlock.c: revision 1.31
lockdebug fixes for rw_tryupgrade/rw_downgrade.
 1.28.10.1  13-May-2009  snj Pull up following revision(s) (requested by ad in ticket #725):
sys/kern/kern_rwlock.c: revision 1.30
A workaround for a bug with some Opteron revisions where locked operations
sometimes do not serve as memory barriers, allowing memory references to
bleed outside of critical sections. It's possible that this is the
reason for pkgbuild's longstanding crashiness.
For rwlocks, always enable the explicit membars. They were disabled only
on x86, and since they are not in the fast-path it's not a big deal.
TODO: convert these to an atomic_membar_foo() or similar that does ordering
between regular data references and atomic references.
 1.28.10.2.2.2  05-Feb-2011  cliff - include opt_multiprocessor.h for explicit MULTIPROCESSOR dependency
 1.28.10.2.2.1  21-Apr-2010  matt sync to netbsd-5
 1.28.8.2  23-Jul-2009  jym Sync with HEAD.
 1.28.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.4.2  01-Jul-2009  snj Pull up following revision(s) (requested by rmind in ticket #837):
sys/kern/kern_rwlock.c: revision 1.31
lockdebug fixes for rw_tryupgrade/rw_downgrade.
 1.28.4.1  13-May-2009  snj Pull up following revision(s) (requested by ad in ticket #725):
sys/kern/kern_rwlock.c: revision 1.30
A workaround for a bug with some Opteron revisions where locked operations
sometimes do not serve as memory barriers, allowing memory references to
bleed outside of critical sections. It is possible that this is the
reason for pkgbuild's longstanding crashiness.
For rwlocks, always enable the explicit membars. They were disabled only
on x86, and since they are not in the fast-path it's not a big deal.
TODO: convert these to an atomic_membar_foo() or similar that does ordering
between regular data references and atomic references.
 1.28.2.1  28-Apr-2009  skrll Sync with HEAD.
 1.35.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.36.4.1  06-Jun-2011  jruoho Sync with HEAD.
 1.36.2.1  21-Apr-2011  rmind sync with head
 1.37.8.1  04-Mar-2012  mrg sync to latest -current.
 1.37.4.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.37.4.2  16-Jan-2013  yamt sync with (a bit old) head
 1.37.4.1  17-Apr-2012  yamt sync with head
 1.38.2.4  03-Dec-2017  jdolecek update from HEAD
 1.38.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.2.2  23-Jun-2013  tls resync from head
 1.38.2.1  25-Feb-2013  tls resync with head
 1.40.4.1  18-May-2014  rmind sync with head
 1.42.2.1  10-Aug-2014  tls Rebase.
 1.45.6.1  21-Apr-2017  bouyer Sync with HEAD
 1.45.4.1  20-Mar-2017  pgoyette Sync with HEAD
 1.45.2.1  05-Feb-2017  skrll Sync with HEAD
 1.46.6.4  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1861):

sys/kern/kern_rwlock.c: revision 1.68 (patch)

rwlock(9): Fix membars.

rw_downgrade must be a release operation, and rw_tryupgrade must be
an acquire operation. membar_producer is not enough -- need to use
membar_release and membar_acquire.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/22/msg028726.html
 1.46.6.3  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1860):

sys/kern/kern_rwlock.c: revision 1.67
sys/kern/kern_lock.c: revision 1.182
sys/kern/kern_mutex.c: revision 1.102
(all via patch)

Sprinkle __predict_{true,false} for panicstr checks
 1.46.6.2  02-Apr-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #687):
sys/kern/kern_rwlock_obj.c: revision 1.4
sys/rump/librump/rumpkern/locks.c: revision 1.80
sys/kern/kern_rwlock.c: revision 1.50
sys/arch/x86/x86/db_memrw.c: revision 1.5,1.6
sys/ddb/db_command.c: revision 1.150-1.153
share/man/man4/ddb.4: revision 1.175 (via patch),1.176-1.178
sys/kern/kern_mutex_obj.c: revision 1.6
sys/kern/subr_lockdebug.c: revision 1.61-1.64
sys/sys/lockdebug.h: revision 1.17
sys/kern/kern_mutex.c: revision 1.71
sys/sys/lockdebug.h: revision 1.18,1.19
sys/kern/subr_xcall.c: revision 1.26

Obtain proper initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc

Initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
were not useful because the addresses were mutex_obj_alloc or rw_obj_alloc
itself. What we want to know are callers of them.

Spinkle ASSERT_SLEEPABLE to xcall functions

Use db_printf instead of printf in ddb

Add a new command, show lockstat, which shows statistics of locks
Currently the command shows the number of allocated locks.
The command is useful only if LOCKDEBUG is enabled.

Add a new command, show all locks, which shows information of active locks

The command shows information of all active (i.e., being held) locks that are
tracked through either of LWPs or CPUs by the LOCKDEBUG facility. The /t
modifier additionally shows a backtrace for each LWP additionally. This
feature is useful for debugging especially to analyze deadlocks.
The command is useful only if LOCKDEBUG is enabled.

Don't pass a unset address to lockdebug_lock_print

x86: avoid accessing invalid addresses in ddb like arm32
This avoids that a command stops in the middle of an execution if
a fault occurs due to an access to an invalid address.

Get rid of a redundant output

Improve wording. Fix a Cm argument.

ddb: rename "show lockstat" to "show lockstats" to avoid conflicting with lockstat(8)
Requested by mrg@
 1.46.6.1  13-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #495):
lib/librumpuser/rumpfiber.c: revision 1.13
lib/librumpuser/rumpuser_pth.c: revision 1.46
lib/librumpuser/rumpuser_pth_dummy.c: revision 1.18
sys/kern/kern_condvar.c: revision 1.40
sys/kern/kern_lock.c: revision 1.161
sys/kern/kern_mutex.c: revision 1.68
sys/kern/kern_rwlock.c: revision 1.48
sys/rump/include/rump/rumpuser.h: revision 1.115
sys/rump/librump/rumpkern/locks.c: revision 1.76-1.79
Apply C99-style struct initialization to lockops_t
--
Tweak LOCKDEBUG macros (NFC)
--
Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG
Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.
Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
--
rump: check if the mutex is surely owned by the caller in mutex_exit
Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).
If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
 1.50.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.50.4.1  10-Jun-2019  christos Sync with HEAD
 1.50.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.54.2.2  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1678):

sys/kern/kern_rwlock.c: revision 1.68 (patch)

rwlock(9): Fix membars.

rw_downgrade must be a release operation, and rw_tryupgrade must be
an acquire operation. membar_producer is not enough -- need to use
membar_release and membar_acquire.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/22/msg028726.html
 1.54.2.1  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1677):

sys/kern/kern_rwlock.c: revision 1.67
sys/kern/kern_lock.c: revision 1.182
sys/kern/kern_mutex.c: revision 1.102

Sprinkle __predict_{true,false} for panicstr checks
 1.59.2.7  29-Feb-2020  ad Sync with head.
 1.59.2.6  25-Jan-2020  ad Sync with head.
 1.59.2.5  25-Jan-2020  ad Remove unintentional differences to base.
 1.59.2.4  22-Jan-2020  ad Back out previous.
 1.59.2.3  19-Jan-2020  ad Adaptive rwlocks proposed on tech-kern and working well on this branch
with vnode locks.
 1.59.2.2  19-Jan-2020  ad Sync with head.
 1.59.2.1  17-Jan-2020  ad Sync with head.
 1.66.4.2  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #266):

sys/kern/kern_rwlock.c: revision 1.68

rwlock(9): Fix membars.

rw_downgrade must be a release operation, and rw_tryupgrade must be
an acquire operation. membar_producer is not enough -- need to use
membar_release and membar_acquire.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/22/msg028726.html
 1.66.4.1  31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #265):

sys/kern/kern_rwlock.c: revision 1.67
sys/kern/kern_lock.c: revision 1.182
sys/kern/kern_mutex.c: revision 1.102

Sprinkle __predict_{true,false} for panicstr checks

RSS XML Feed