Home | History | Annotate | Download | only in ddb
History log of /src/sys/ddb/db_xxx.c
RevisionDateAuthorComments
 1.80  02-Nov-2023  martin Back out the following revisions on behalf of core:

sys/sys/lwp.h: revision 1.228
sys/sys/pipe.h: revision 1.40
sys/kern/uipc_socket.c: revision 1.306
sys/kern/kern_sleepq.c: revision 1.84
sys/rump/librump/rumpkern/locks_up.c: revision 1.13
sys/kern/sys_pipe.c: revision 1.165
usr.bin/fstat/fstat.c: revision 1.119
sys/rump/librump/rumpkern/locks.c: revision 1.87
sys/ddb/db_xxx.c: revision 1.78
sys/ddb/db_command.c: revision 1.187
sys/sys/condvar.h: revision 1.18
sys/ddb/db_interface.h: revision 1.42
sys/sys/socketvar.h: revision 1.166
sys/kern/uipc_syscalls.c: revision 1.209
sys/kern/kern_condvar.c: revision 1.60

Add cv_fdrestart() [...]
Use cv_fdrestart() to implement fo_restart.
Simplify/streamline pipes a little bit [...]

This changes have caused regressions and need to be debugged.
The cv_fdrestart() addition needs more discussion.
 1.79  15-Oct-2023  martin When converting from db_expr_t to a pointer cast via uintptr_t
to help kernels where the size differs (e.g. 32bit sparc64 kernels)
 1.78  13-Oct-2023  ad Simplify/streamline pipes a little bit:

- Allocate only one struct pipe not two (no need to be bidirectional here).
- Then use f_flag (FREAD/FWRITE) to figure out what to do in the fileops.
- Never wake the other side or acquire long-term (I/O) lock unless needed.
- Whenever possible, defer wakeups until after locks have been released.
- Do some things locklessly in pipe_ioctl() and pipe_poll().

Some notable results:

- -30% latency on a 486DX2/66 doing 1 byte ping-pong within a single process.
- 2.5x less lock contention during "make cleandir" of src on a 48 CPU machine.
- 1.5x bandwith with 1kB messages on the same 48 CPU machine (8kB: same b/w).
 1.77  08-Oct-2023  martin For architectures (mips64) where sizeof(db_expr_t) != sizeof(kcondvar_t *)
cast through uintptr_t.
 1.76  07-Oct-2023  ad Add some simple DDB show commands: condvar, selinfo, sleepq
 1.75  23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.74  10-Mar-2020  christos Make the db_kernelonly() macro visible to all files and re-use it.
Register access is kernel only.
 1.73  01-Feb-2020  riastradh Load struct fdfile::ff_file with atomic_load_consume.

Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper. And a little clearer without a long comment.)
 1.72  01-Feb-2020  riastradh Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
=> This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
=> atomic_load_consume serves the same purpose now.
=> Was needed only on alpha anyway.
 1.71  27-Feb-2015  ozaki-r branches: 1.71.18; 1.71.22; 1.71.24;
Don't use an unset value as an address

Instead, show usage if no address is passed.
 1.70  05-Sep-2014  matt branches: 1.70.2;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.69  06-Jan-2013  christos remove previous, dmesg just works.
 1.68  06-Jan-2013  christos Add "show dmesg" that prints the contents of the message buffer.
 1.67  05-Jan-2013  christos Add "show panic" that shows the current panic string. two ports had it, and
it could be easily made MI.
 1.66  03-Dec-2011  christos branches: 1.66.8;
If we are DIAGNOSTIC don't try to go further if we failed to take the
lock, because we are going to trigger a KASSERT. Also hold the lock
longer and take the proc lock for kpsignal(). Maybe we should add
mutex_steal() and mutex_return() for the debugger? Lock correction
suggestion from jmcneill.
 1.65  02-Dec-2011  christos deal with the proc_lock mutex.
 1.64  12-Jun-2011  rmind branches: 1.64.2;
Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.63  31-May-2011  christos branches: 1.63.2;
re-instate db_kill_proc
 1.62  19-Jul-2009  rmind branches: 1.62.4; 1.62.6;
Add #ifdef MQUEUE for db_show_mqueue_cmd().

XXX: Wrong. DDB should be dynamic, modular, etc.
 1.61  24-May-2009  ad More changes to improve kern_descrip.c.

- Avoid atomics in more places.
- Remove the per-descriptor mutex, and just use filedesc_t::fd_lock.
It was only being used to synchronize close, and in any case we needed
to take fd_lock to free the descriptor slot.
- Optimize certain paths for the <NDFDFILE case.
- Sprinkle more comments and assertions.
- Cache more stuff in filedesc_t.
- Fix numerous minor bugs spotted along the way.
- Restructure how the open files array is maintained, for clarity and so
that we can eliminate the membar_consumer() call in fd_getfile(). This is
mostly syntactic sugar; the main functional change is that fd_nfiles now
lives alongside the open file array.

Some measurements with libmicro:

- simple file syscalls are like close() are between 1 to 10% faster.
- some nice improvements, e.g. poll(1000) which is ~50% faster.
 1.60  21-Mar-2009  ad Make 'show event', 'dmesg' work with crash(8).
XXX dmesg fails exactly the same way as /sbin/dmesg.
 1.59  09-Mar-2009  mrg include <stdbool.h> if not _KERNEL, and don't include kauth.h if _KERNEL.

now crash builds on i386.
 1.58  08-Mar-2009  mrg include ddb headers *after* sys/types.h or sys/param.h.
 1.57  07-Mar-2009  ad Make ddb compile and work in userspace. Mostly this is comprised of three
types of changes:

- Add a few new methods to replace stuff like p_find(), CPU_INFO_FOREACH.

- Use db_read_bytes() instead of accessing kernel structures directly,
and similar changes.

- Add ifdef _KERNEL where the above hasn't been done, and an XXX comment.
 1.56  18-Feb-2009  yamt - fix vmem unittest. rename VMEM_DEBUG so that it won't be abused again.
- reimplement vmem sanity checks with less code duplication.
- reimplement ddb vmem-related commands in a more consistent ways.
remove automatic whatis.
 1.55  04-Feb-2009  ad branches: 1.55.2;
Default 'show all procs' to /l. People tend to type 'ps' without modifiers
when providing information about deadlocks. Without the thread info it's
not very useful.
 1.54  25-Nov-2008  ad Add some basic DDB stuff for modules.
 1.53  14-Nov-2008  ad ifdef AIO
 1.52  03-Oct-2008  rmind branches: 1.52.2; 1.52.4;
Replace more intptr_t to uintptr_t when casting VA.
 1.51  14-Jul-2008  blymn Take care not to dereference NULL datapointer from fd table
Make output more readable and label what lock we are examining.
 1.50  10-Jul-2008  blymn Fix indents.
 1.49  10-Jul-2008  blymn Add a show files command that prints the vnodes associated with a
given struct proc and, if LOCKDEBUG is built in, the lock status of
the uvmobject.
 1.48  02-Dec-2007  ad branches: 1.48.14; 1.48.18; 1.48.20; 1.48.22; 1.48.24;
ps/w: display LWP info.
 1.47  07-Sep-2007  rmind branches: 1.47.6;
Implementation of POSIX message queues.

Reviewed by: <ad>, <tech-kern>
 1.46  19-Jul-2007  dsl branches: 1.46.4; 1.46.6; 1.46.8;
include cdefs.h before opt_xxx.h
 1.45  09-Jul-2007  ad branches: 1.45.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.44  17-May-2007  yamt 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.43  30-Apr-2007  rmind Import of POSIX Asynchronous I/O.
Seems to be quite stable. Some work still left to do.

Please note, that syscalls are not yet MP-safe, because
of the file and vnode subsystems.

Reviewed by: <tech-kern>, <ad>
 1.42  22-Feb-2007  matt branches: 1.42.4; 1.42.6;
Fix lossage from boolean_t -> bool and updated x86 bus_dma.
 1.41  09-Feb-2007  ad branches: 1.41.2;
Merge newlock2 to head.
 1.40  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.39  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.38  14-May-2006  elad branches: 1.38.8; 1.38.10;
integrate kauth.
 1.37  22-Jan-2006  uwe branches: 1.37.2; 1.37.4; 1.37.6; 1.37.8; 1.37.10;
db_show_sched_qs: fix pointer cast lint considers troublesome.
 1.36  22-Jan-2006  uwe Add /l to show all procs usage.
 1.35  22-Jan-2006  uwe This is not IOCCC. Replace " >"[cp == p] with conditional expression.
Makes lint happy. Probably generates better code too (does on sh3).
 1.34  03-Dec-2005  he branches: 1.34.2;
After addition of "show all pools", we now need <sys/pool.h> here.
Fixes build problem for mac68k.
 1.33  01-Dec-2005  yamt add "show all pools" command for ddb.
 1.32  15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.31  01-Jun-2005  drochner branches: 1.31.2;
more constification fallout
 1.30  26-Feb-2005  perry nuke trailing whitespace
 1.29  27-Jul-2004  nathanw branches: 1.29.4; 1.29.6;
Make ddb's "show sched_qs" aware of big-endian sched_qs arrangements.
 1.28  20-Sep-2003  thorpej Add a "show sched_qs" command to dump the run queues. Format is:
1 pid.lid (p_comm)
pid.lid (p_comm)
...

If a queue has procs, but no sched_whichqs bit, it shows:
!1 pid.lid (p_comm)
 1.27  07-Sep-2003  uwe Widen FLAGS column for ps/l so that all defined l_flag flags fit.
 1.26  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.25  02-Jul-2003  simonb branches: 1.25.2;
Allow the dmesg command to show the last N bytes of the kernel message
buffer.
 1.24  29-Jun-2003  fvdl Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.23  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.22  15-May-2003  atatat (1) Don't print the message buffer (via ddb's dmesg command) if the
message buffer has not yet been set up, mimicking code from the top of
the sysctl routine for retrieving the message buffer.

(2) Add a /l modifier to the trace command. This makes it print the
backtrace using printf() instead of db_printf(), which has the nice
side-effect of also putting it into the message buffer. A kernel with
ddb in it but disabled (ie, ddb.onpanic set to zero) will print a
backtrace (which ends up in the message buffer) before dumping (or
not, depending on the value of kern.dump_on_panic) and rebooting, but
if ddb is not disabled, the backtrace is not printed, and there's no
way to get it to display a backtrace such that you can retrieve it
after the dump. The backtrace printed by gdb is sometimes a little
different.

(3) Documentation for the above.
 1.21  28-Apr-2003  briggs Add a rudimentary 'trap to kgdb' command if KGDB is defined. This allows
systems with only one serial port for console, etc., to have at least some
basic access to remote-kgdb-over-serial, even if it is a bit awkward.
 1.20  04-Feb-2003  thorpej New callout implementation. This is based on callwheel implementation
done by Artur Grabowski and Thomas Nordin for OpenBSD, which is more
efficient in several ways than the callwheel implementation that it is
replacing. It has been adapted to our pre-existing callout API, and
also provides the slightly more efficient (and much more intuitive)
API (adapted to the callout_*() naming scheme) that the OpenBSD version
provides.

Among other things, this shaves a bunch of cycles off rescheduling-in-
the-future a callout which is already scheduled, which the common case
for TCP timers (notably REXMT and KEEP).

The API has been simplified a bit, as well. The (very confusing to
a good many people) "ACTIVE" state for callouts has gone away. There
is now only "PENDING" (scheduled to fire in the future) and "EXPIRED"
(has fired, and the function called).

Kernel version bump not done; we'll ride the 1.6N bump that happened
with the malloc(9) change.
 1.19  23-Jan-2003  pk Zombie procs have no lwps.
 1.18  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.17  26-Aug-2002  scw branches: 1.17.2;
Casting from a pointer, to a db_expr_t, has to go via an intptr_t.
(db_expr_t == int64_t on sh5, for example).
 1.16  15-Feb-2002  simonb branches: 1.16.8;
ANSIfy, KNF.
Make some variables and functions static when not used outside of a module.
Make variables in headers extern.
Delete the unused db_find_watchpoint() function.
 1.15  12-Nov-2001  lukem add RCSIDs
 1.14  15-Sep-2001  chs use a for loop instead of goto.
 1.13  11-Sep-2001  thorpej Optimization suggested by Bill Sommerfeld: Keep a hint as to the
"earliest" firing callout in a bucket. This allows us to skip
the scan up the bucket if no callouts are due in the bucket.

A cheap O(1) hint update is done at callout insertion (if new callout
is earlier than hint) and removal (is bucket empty). A thorough
refresh of the hint is done when the bucket is traversed.

This doesn't matter much on machines with small values of hz
(e.g. i386), but on systems with large values of hz (e.g. Alpha),
it has a definite positive effect.

Also, keep the callwheel stats in evcnts, so that you can view them
with "vmstat -e".
 1.12  31-Jul-2001  atatat branches: 1.12.2;
Add an easy way to dump the message buffer from ddb.
 1.11  28-Nov-2000  thorpej branches: 1.11.2; 1.11.4;
Make sure values for a %llx are long long.
 1.10  28-Nov-2000  eeh Implement db_show_callout() again.
 1.9  25-May-2000  jhawk Interface change: db_printsym() takes a third argument, pr, a function
pointer indicating how to print the symbol. This allows db_printsym()
to called in places where db_printf() is not an appropriate output
function.

While straightforward, apologies in advance if I've introduced any minor
syntax errors; I was unable to test compilation this on all the affected
platforms.
 1.8  26-Mar-2000  kleink Cast timeval members to types we know the printf conversions of.
 1.7  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.6  22-Jul-1999  thorpej branches: 1.6.2;
XXX LOCKING XXX of allproc; DDB runs with interrupts blocked, and MD
code should suspend other processors, so this probably isn't a problem,
but the comment is added anyhow.
 1.5  08-Sep-1998  thorpej branches: 1.5.8;
- Use proclists[], rather than checking allproc and zombproc explicitly.
- Add some comments about locking.
 1.4  13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3  31-Jan-1998  ross branches: 1.3.2;
Print more info on ps/w, note the current proc, and properly declare db_maxoff.
 1.2  24-Oct-1997  chuck fix printf formatting of "ps" (aka "show all proc") so that lines never
overflow (always hated that).

replaced "/m" flag with:
/a == show process address info
/n == show normal process info [currently the default]
/w == show process wait/emul info
 1.1  21-May-1997  gwr Move some DDB stuff here from kern_clock.c and kern_proc.c
 1.3.2.1  30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.5.8.1  02-Aug-1999  thorpej Update from trunk.
 1.6.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.6.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.11.4.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.4  16-Mar-2002  jdolecek Catch up with -current.
 1.11.4.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.4.2  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.11.4.1  03-Aug-2001  lukem update to -current
 1.11.2.8  27-Aug-2002  nathanw Catch up to -current.
 1.11.2.7  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.11.2.6  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.11.2.5  28-Feb-2002  nathanw Catch up to -current.
 1.11.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.11.2.3  21-Sep-2001  nathanw Catch up to -current.
 1.11.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.11.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.12.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.16.8.1  29-Aug-2002  gehenna catch up with -current.
 1.17.2.1  18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.25.2.9  11-Dec-2005  christos Sync with head.
 1.25.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.25.2.7  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.25.2.6  21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.2.5  18-Sep-2004  skrll Sync with HEAD.
 1.25.2.4  12-Aug-2004  skrll Sync with HEAD.
 1.25.2.3  03-Aug-2004  skrll Sync with HEAD
 1.25.2.2  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.25.2.1  02-Jul-2003  darrenr file db_xxx.c was added on branch ktrace-lwp on 2003-07-02 15:25:58 +0000
 1.29.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.4.1  29-Apr-2005  kent sync with -current
 1.31.2.6  07-Dec-2007  yamt sync with head
 1.31.2.5  27-Oct-2007  yamt sync with head.
 1.31.2.4  03-Sep-2007  yamt sync with head.
 1.31.2.3  26-Feb-2007  yamt sync with head.
 1.31.2.2  30-Dec-2006  yamt sync with head.
 1.31.2.1  21-Jun-2006  yamt sync with head.
 1.34.2.1  01-Feb-2006  yamt sync with head.
 1.37.10.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.37.8.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.37.8.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.37.6.1  24-May-2006  yamt sync with head.
 1.37.4.1  01-Jun-2006  kardel Sync with head.
 1.37.2.1  09-Sep-2006  rpaulo sync with head
 1.38.10.2  10-Dec-2006  yamt sync with head.
 1.38.10.1  22-Oct-2006  yamt sync with head
 1.38.8.2  18-Nov-2006  ad Sync with head.
 1.38.8.1  21-Oct-2006  ad Update for proc_representative_lwp() / calcru() signature change.
 1.41.2.4  07-May-2007  yamt sync with head.
 1.41.2.3  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.41.2.2  17-Feb-2007  yamt remove the now unused definition of RQMASK. from Daniel Sieger.
 1.41.2.1  17-Feb-2007  yamt - separate context switching and thread scheduling.
- introduce idle lwp.
- change some related MD/MI interfaces and implement i386 version.
 1.42.6.1  11-Jul-2007  mjf Sync with head.
 1.42.4.3  09-Oct-2007  ad Sync with head.
 1.42.4.2  08-Jun-2007  ad Sync with head.
 1.42.4.1  27-May-2007  ad ps/l: show the LWP name.
 1.45.2.2  10-Sep-2007  skrll Sync with HEAD.
 1.45.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.46.8.2  19-Jul-2007  dsl include cdefs.h before opt_xxx.h
 1.46.8.1  19-Jul-2007  dsl file db_xxx.c was added on branch matt-mips64 on 2007-07-19 21:54:52 +0000
 1.46.6.2  09-Jan-2008  matt sync with HEAD
 1.46.6.1  06-Nov-2007  matt sync with HEAD
 1.46.4.2  03-Dec-2007  joerg Sync with HEAD.
 1.46.4.1  02-Oct-2007  joerg Sync with HEAD.
 1.47.6.1  08-Dec-2007  mjf Sync with HEAD.
 1.48.24.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.48.24.1  19-Oct-2008  haad Sync with HEAD.
 1.48.22.1  18-Jul-2008  simonb Sync with head.
 1.48.20.2  10-Oct-2008  skrll Sync with HEAD.
 1.48.20.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.48.18.3  19-Aug-2009  yamt sync with head.
 1.48.18.2  20-Jun-2009  yamt sync with head
 1.48.18.1  04-May-2009  yamt sync with head.
 1.48.14.3  17-Jan-2009  mjf Sync with HEAD.
 1.48.14.2  05-Oct-2008  mjf Sync with HEAD.
 1.48.14.1  28-Sep-2008  mjf Sync with HEAD.
 1.52.4.1  24-Feb-2009  snj branches: 1.52.4.1.4;
Pull up following revision(s) (requested by ad in ticket #488):
share/man/man4/ddb.4: revision 1.122
sys/ddb/db_xxx.c: revision 1.55 via patch
Default 'show all procs' to /l. People tend to type 'ps' without modifiers
when providing information about deadlocks. Without the thread info it's
not very useful.
 1.52.4.1.4.1  16-Feb-2012  matt Make ps /l also printout the uarea.
 1.52.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.52.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.52.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.55.2.2  23-Jul-2009  jym Sync with HEAD.
 1.55.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.62.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.62.4.2  12-Jun-2011  rmind sync with head
 1.62.4.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.63.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.64.2.2  23-Jan-2013  yamt sync with head
 1.64.2.1  17-Apr-2012  yamt sync with head
 1.66.8.2  03-Dec-2017  jdolecek update from HEAD
 1.66.8.1  25-Feb-2013  tls resync with head
 1.70.2.1  06-Apr-2015  skrll Sync with HEAD
 1.71.24.1  29-Feb-2020  ad Sync with head.
 1.71.22.1  20-Nov-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1921):

sys/kern/kern_event.c: revision 1.106
sys/kern/sys_select.c: revision 1.51
sys/kern/subr_exec_fd.c: revision 1.10
sys/kern/sys_aio.c: revision 1.46
sys/kern/kern_descrip.c: revision 1.244
sys/kern/kern_descrip.c: revision 1.245
sys/ddb/db_xxx.c: revision 1.72
sys/ddb/db_xxx.c: revision 1.73
sys/miscfs/fdesc/fdesc_vnops.c: revision 1.132
sys/kern/uipc_usrreq.c: revision 1.195
sys/kern/sys_descrip.c: revision 1.36
sys/kern/uipc_usrreq.c: revision 1.196
sys/kern/uipc_socket2.c: revision 1.135
sys/kern/uipc_socket2.c: revision 1.136
sys/kern/kern_sig.c: revision 1.383
sys/kern/kern_sig.c: revision 1.384
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.107
sys/miscfs/procfs/procfs_vnops.c: revision 1.208
sys/kern/subr_exec_fd.c: revision 1.9
sys/kern/kern_descrip.c: revision 1.252
(all via patch)

Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:
- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
=> This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
=> atomic_load_consume serves the same purpose now.
=> Was needed only on alpha anyway.

Load struct fdfile::ff_file with atomic_load_consume.
Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper. And a little clearer without a long comment.)
kern_descrip.c: Fix membars around reference count decrement.

In general, the `last one out hit the lights' style of reference
counting (as opposed to the `whoever's destroying must wait for
pending users to finish' style) requires memory barriers like so:

... usage of resources associated with object ...
membar_release();
if (atomic_dec_uint_nv(&obj->refcnt) != 0)
return;
membar_acquire();
... freeing of resources associated with object ...

This way, all usage happens-before all freeing. This fixes several
errors:
- fd_close failed to ensure whatever its caller did would
happen-before the freeing, in the case where another thread is
concurrently trying to close the fd (ff->ff_file == NULL).
Fix: Add membar_release before atomic_dec_uint(&ff->ff_refcnt) in
that branch.
- fd_close failed to ensure all loads its caller had issued will have
happened-before the freeing, in the case where the fd is still in
use by another thread (fdp->fd_refcnt > 1 and ff->ff_refcnt-- > 0).
Fix: Change membar_producer to membar_release before
atomic_dec_uint(&ff->ff_refcnt).
- fd_close failed to ensure that any usage of fp by other callers
would happen-before any freeing it does.
Fix: Add membar_acquire after atomic_dec_uint_nv(&ff->ff_refcnt).
- fd_free failed to ensure that any usage of fdp by other callers
would happen-before any freeing it does.
Fix: Add membar_acquire after atomic_dec_uint_nv(&fdp->fd_refcnt).

While here, change membar_exit -> membar_release. No semantic
change, just updating away from the legacy API.
 1.71.18.1  08-Apr-2020  martin Merge changes from current as of 20200406

RSS XML Feed