Home | History | Annotate | Download | only in ddb
History log of /src/sys/ddb/db_command.c
RevisionDateAuthorComments
 1.190  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.189  15-Oct-2023  riastradh ddb: Don't restrict `show all tstiles' to wmesg `tstile'.

This is no longer the wmesg, as of last week -- now it's the name of
the underlying syncobj, like `mutex' or `rwlock'.
 1.188  15-Oct-2023  riastradh ddb: Constify db_syncobj_owner argument.

No need for it to be writable, and the actual type of the struct lwp
member is const.
 1.187  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.186  07-Oct-2023  ad Add some simple DDB show commands: condvar, selinfo, sleepq
 1.185  17-Jul-2023  riastradh ddb: Teach `show all tstiles' to show the type of each lock.
 1.184  11-Jul-2023  riastradh ddb: Cast pointer to uintptr_t first before db_expr_t.
 1.183  09-Jul-2023  riastradh ddb: New `show all tstiles' command.

Shows who's waiting for which locks and what the owner is up to.

XXX pullup-10
 1.182  25-May-2023  uwe ddb: PR kern/57435 - fix duplicate "show mount"

Bolivar cannot carry double. One of these commands should have been
"show mounts", cf. page/pages and a few others. While here fix the
function name to be db_show_all_mounts to conform to the pattern.
 1.181  28-Apr-2022  msaitoh branches: 1.181.4;
Remove 'a' modifier from "show vmem". It was removed in sbur_vmem.c rev. 1.55.
 1.180  20-Apr-2022  uwe ddb: guard invocation of db_cmd_on_enter properly.

db_command_loop - do not ignore the return value from setjmp used to
guard db_cmd_on_enter. We do not want to re-execute the enter command
if it fails. Note that "fails" includes e.g. aborting long output
from the enter command with "q" at the --db more-- prompt, which is
quite likely as the default enter command is "bt".

While here, don't even bother with the whole song and dance if the
enter command is not set.
 1.179  10-Oct-2021  thorpej Add a "show kqueue <addr>" command.
 1.178  21-Aug-2021  andvar fix mainly same typos as in my previous commit but outside sys/dev/dm.
 1.177  13-Aug-2021  andvar fix typos in words "pointer" and s/fram /frame/
 1.176  23-Feb-2021  mrg introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0. idea from rillig@.

all touched ports built, several booted.
 1.175  30-Oct-2020  skrll branches: 1.175.2;
Remove "also;"
 1.174  30-Oct-2020  skrll Add a "show fdt" ddb command
 1.173  30-Oct-2020  skrll Sort the db_show_cmd entries
 1.172  30-Oct-2020  skrll Put the 'added from all sub cmds' comment above the four commands that
were added as part of the work in r1.98
 1.171  30-Oct-2020  skrll Trailing whitespace
 1.170  13-Apr-2020  skrll Handle "no count" properly in db_kernhist_print_cmd
 1.169  10-Mar-2020  christos branches: 1.169.2;
Make the db_kernelonly() macro visible to all files and re-use it.
Register access is kernel only.
 1.168  09-Mar-2020  christos print a message for the commands crash does not support.
Allow "show lock"
 1.167  01-Jan-2020  thorpej - Introduce a new global kernel variable "shutting_down" to indicate that
the system is shutting down or rebooting.
- Set this global in a new function called kern_reboot(), which is currently
just a basic wrapper around cpu_reboot().
- Call kern_reboot() instead of cpu_reboot() almost everywhere; a few
places remain where it's still called directly, but those are in early
pre-main() machdep locations.

Eventually, all of the various cpu_reboot() functions should be re-factored
and common functionality moved to kern_reboot(), but that's for another day.
 1.166  27-Dec-2019  ad Redo the page allocator to perform better, especially on multi-core and
multi-socket systems. Proposed on tech-kern. While here:

- add rudimentary NUMA support - needs more work.
- remove now unused "listq" from vm_page.
 1.165  15-Dec-2019  joerg Teach ddb(4) about printing the full mount list.
 1.164  29-Sep-2019  uwe db_command - don't hide local static variable in the middle of other
local variable definitions. While here, get rid of the alignment of
variable names.
 1.163  29-Sep-2019  uwe db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.
 1.162  29-Sep-2019  uwe db_command - make sure count is always initialized.
 1.161  22-Sep-2019  mrg fix "show kernhist".

set addr = 0 if we don't have_addr and avoid using random garbage in addr.
 1.160  17-Sep-2018  kre branches: 1.160.4;

When this file is used when not building the kernel (eg: /usr/sbin/crash)
make cnpollc() go away.
 1.159  16-Sep-2018  mrg call cnpollc(1) and cnpollc(0) around cngetc().

(christos has a good idea to add a function that does all 3,
and we should switch all the callers in this sequence to use
it (and fix the MD ones missing it still). not all can, as
eg, line-grabbing functions can use cngetsn(), which only
calls cnpollc() twice.)
 1.158  15-Sep-2018  mrg call spl0() before cpu_reboot(), so that there's a chance that:
- interrupts can work afterwards
- this also means if IO stalls, serial break might work again.

this mimics how reboot(2) ends up calling cpu_reboot().
 1.157  13-Sep-2018  mrg always call lockdebug_dismiss() from DDB -- there are always some
minimal lockdebug checks in place, even without LOCKDEBUG.

adjust lockdebug_abort() to ignore problems after ld_panic is set
so that there's a chance of this working.

this fixes ddb 'reboot' on softiron od1000.
 1.156  13-Aug-2018  mrg extend the ddb "show kernhist" command. the synopsis is now:

show kernhist[/i] [addr[,count]]

the i modifier means display info instead of entries, and the count
restricts to the last count entries.

the count option is only supported for specified histories. it
could be extended but requires more logic than the single history,
as multiple histories are merged during display.
 1.155  12-Aug-2018  mrg add a lockdebug_dismiss() function for DDB to use that tells
lockdebug to avoid asserts. use it for the ddb "reboot"
command, so that it doesn't matter how ddb was entered, the
reboot not trigger mutex checks and not work.
 1.154  20-Jul-2018  msaitoh Add "show socket" command written by Hiroki SUENAGA. It prints usage of
system's socket buffers.
 1.153  19-Mar-2018  ozaki-r branches: 1.153.2;
ddb: rename "show lockstat" to "show lockstats" to avoid conflicting with lockstat(8)

Requested by mrg@
 1.152  16-Mar-2018  ozaki-r Don't pass a unset address to lockdebug_lock_print
 1.151  16-Mar-2018  ozaki-r 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.
 1.150  16-Mar-2018  ozaki-r 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.
 1.149  04-Mar-2018  mlelstv branches: 1.149.2;
Add command to print device list.
 1.148  11-Jan-2017  joerg branches: 1.148.8;
Add ddb command to find a vnode by the address of its lock.
This makes it much easier to convert lockstat traces into understandable
data.
 1.147  13-Apr-2016  ozaki-r branches: 1.147.2;
ddb: rename show arptab to show routes

show arptab command of ddb is now inappropriate because it actually dumps
routes but arp entries aren't routes anymore. So rename it to show routes
and move the code from if_arp.c to route.c.

ok christos@
 1.146  06-Apr-2016  skrll Improve ddb(4) show kernhist

1) really prints all the histories merged together (rather than just the
"first" when no argument specified
2) dumps a single history when an argument is given, e.g.
"show kernhist usbhist"
3) uses db_printf correctly
 1.145  21-May-2015  mrg only call the on-enter commands if we're not recursing.
avoids having a fault in the on-enter commands repeating.
 1.144  08-Feb-2015  christos we can use show callout now from crash
 1.143  19-Oct-2013  christos branches: 1.143.6;
fix userland build, by moving all the unused stuff inside ifdef _KERNEL
 1.142  06-Jan-2013  christos branches: 1.142.2;
remove the new command not the old one.
 1.141  06-Jan-2013  christos remove previous, dmesg just works.
 1.140  06-Jan-2013  christos Add "show dmesg" that prints the contents of the message buffer.
 1.139  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.138  28-Apr-2012  rmind branches: 1.138.2;
Remove MALLOC_DEBUG and MALLOCLOG, which is dead code after malloc(9) move
to kmem(9). Note: kmem(9) has debugging facilities under DEBUG/DIAGNOSTIC.
However, expensive kmguard and debug_freecheck have to be enabled manually.
 1.137  13-Nov-2011  mrg branches: 1.137.4;
set panicstr to "reboot forced via kernel debugger" when rebooting
from ddb, similar to how sync from ddb works.

this avoids various asserts and other issues during ddb reboot.
 1.136  17-May-2011  mrg branches: 1.136.4;
move and rename the uvm history code out of uvm_stat to "kernhist".

rename "UVMHIST" option to enable the uvm histories.

TODO:
- make UVMHIST properly depend upon KERNHIST
- enable dynamic registration of histories. this is mostly just
allocating something in a bitmap, and is only for viewing multiple
histories in a merged form.


tested on amd64 and sparc64.
 1.135  10-Apr-2011  christos Add:
usage: show proc [/a] [/p] address|pid
/a == argument is an address of any lwp
/p == argument is a pid [default]
From: Vladimir Kirillov proger at wilab dot org dot ua
 1.134  13-Sep-2010  drochner branches: 1.134.2;
fix extern/static inconsistency
 1.133  19-Jul-2009  rmind branches: 1.133.2; 1.133.4;
Add #ifdef MQUEUE for db_show_mqueue_cmd().

XXX: Wrong. DDB should be dynamic, modular, etc.
 1.132  05-Jun-2009  mrg extend 'show event' to take /i /t and /m modifiers, to select interrupt,
trap or misc event types. you can mix them with /f as well, to show all
including zero events for traps and misc, "show event/ftm"
 1.131  21-Mar-2009  ad Make 'show event', 'dmesg' work with crash(8).
XXX dmesg fails exactly the same way as /sbin/dmesg.
 1.130  11-Mar-2009  nakayama Avoid "warning: cast from pointer to integer of different size"
on 32-bit sparc64 kernels.
 1.129  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.128  01-Mar-2009  haad Do not set last_count to zero after every db_command function call it is
static variable. This should fix PR 40712.
 1.127  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.126  05-Jan-2009  haad branches: 1.126.2;
Fix my bug introduced in rev 1.98 of db_command.c where command prefix
not ambiguous in one table was choosed even if it was ambiguous in another
table in same list. Also apply more KNF rules.

Patch was supplied by uwe@.
 1.125  07-Dec-2008  cegger ddb: new 'show vmem' and 'show all vmems' commands.
Useful to inspect vmem(9) structures.
 1.124  25-Nov-2008  nakayama Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.123  25-Nov-2008  ad Add some basic DDB stuff for modules.
 1.122  16-Nov-2008  pooka more <sys/buf.h> police
 1.121  14-Nov-2008  ad +ifdef AIO

XXX ddb needs a way to register commands at runtime!
 1.120  03-Oct-2008  rmind branches: 1.120.2; 1.120.4;
Replace more intptr_t to uintptr_t when casting VA.
 1.119  29-Sep-2008  rmind - Fix message queue permissions problems.
- Rake into account umask when creating mqueue.
- Restore DDB command, which was accidentally lost (hi martin).
- Misc.
 1.118  08-Aug-2008  skrll Make "show uvmhist" available to all arches (not just sparc*) in ddb.
 1.117  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.116  10-Jul-2008  blymn Whitespace clean up.
 1.115  28-Apr-2008  martin branches: 1.115.2; 1.115.4; 1.115.6;
Remove clause 3 and 4 from TNF licenses
 1.114  21-Feb-2008  uwe branches: 1.114.6; 1.114.8; 1.114.10;
Fix help string for "w" - it is "write" not "watch".
 1.113  02-Feb-2008  martin When doing a reboot from ddb, set panicstr, so that later LOCKDEBUG checks
show the same mercy as with a real panic.
 1.112  13-Dec-2007  yamt add ddb "whatis" command. inspired from solaris ::whatis dcmd.
 1.111  14-Nov-2007  martin branches: 1.111.2; 1.111.4; 1.111.6;
Add a missing "else". Should finally fix PR kern/37110.
 1.110  22-Oct-2007  martin branches: 1.110.2;
Pacify some gcc uninitialized warnings at -O3
 1.109  19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.108  14-Oct-2007  uwe branches: 1.108.2;
db_cmd_search: When we compare names we'd better stop at the nul byte.
Don't flip-flop between found and ambiguous. (hi, martin!)
 1.107  12-Oct-2007  martin Fix command name matching, avoid jumps to null function pointers and
some minor cosmetics.
 1.106  08-Oct-2007  martin Do another setjmp right before entering the command loop, we do not want
to execute the on-enter commands again on errors.
 1.105  02-Oct-2007  martin Some cleanup:
- When registering command tables, make sure the builtin commands are
already registered
- Make the command table entry structure private
- Do not bother to store the number of commands in a table, we can quickly
calc that if needed.
 1.104  01-Oct-2007  martin No need to db_init_commands() early any more - it will happen on first
entry to ddb.
 1.103  01-Oct-2007  martin Special case the initialization of builtin command tables to avoid using
malloc. Fixes PR kern/37042.
Allow "mach" commands registered by LKMs even if there is no builtin
mach command for the arch.
 1.102  23-Sep-2007  martin Minor clenaup - db_cmd_loop_done is a bool nowadays, so use true/false
instead of 0/1.
Also make db_init_commands() non-static.
 1.101  23-Sep-2007  martin Simplify the "tables are already setup" test.
Print a message on unknown commands (as we used to do before) and get rid
of the now unused macro previously used for that.
 1.100  23-Sep-2007  martin Fix build for archs w/o DB_MACHINE_COMMANDS.
Patch from KIYOHARA Takashi.
 1.99  23-Sep-2007  martin branches: 1.99.2;
Add missing argument - fixes compilation if KGDB is defined.
 1.98  22-Sep-2007  martin Add a new option DDB_VERBOSE_HELP that adds online help to ddb.
From Adam Hamsik.
Minor modifications by me, all bugs are probably mine.
 1.97  07-Sep-2007  rmind Implementation of POSIX message queues.

Reviewed by: <ad>, <tech-kern>
 1.96  30-Apr-2007  rmind branches: 1.96.2; 1.96.6; 1.96.8;
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.95  22-Feb-2007  thorpej branches: 1.95.4; 1.95.6;
TRUE -> true, FALSE -> false
 1.94  22-Feb-2007  matt Fix lossage from boolean_t -> bool and updated x86 bus_dma.
 1.93  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.92  09-Feb-2007  ad branches: 1.92.2;
Merge newlock2 to head.
 1.91  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.90  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.89  05-Sep-2006  uwe branches: 1.89.2; 1.89.4;
ANSIfy db_error.
 1.88  14-May-2006  elad integrate kauth.
 1.87  14-May-2006  he Move declaration up ahead of active code in the function, so that
this can be built again with gcc 2.95.3, as used by vax.
 1.86  10-May-2006  mrg quell GCC 4.1 uninitialised variable warnings.

XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
 1.85  14-Apr-2006  christos Coverity CID 1094: Protect against NULL deref.
 1.84  19-Feb-2006  bjh21 branches: 1.84.2; 1.84.4; 1.84.6;
Add a "show all pages" command to DDB which prints one line per physical
page in the system. Useful for getting some idea where all your memory's
gone, at least on a sufficiently small system.
 1.83  24-Jan-2006  yamt branches: 1.83.2; 1.83.4;
add ddb "sh mbuf" command.
 1.82  01-Dec-2005  yamt branches: 1.82.2;
add "show all pools" command for ddb.
 1.81  27-Nov-2005  yamt make DDB_COMMANDONENTER sysctl. (ddb.commandonenter)
suggested by Christos Zoulas.
 1.80  26-Nov-2005  yamt add a new option DDB_COMMANDONENTER.
which can be useful for eg. broken console input.
 1.79  01-Jun-2005  drochner branches: 1.79.2; 1.79.8;
more constification fallout
 1.78  29-May-2005  christos Add lots of const.
 1.77  29-Apr-2005  yamt move decl of db_machine_command_table from db_interface.h to db_command.c
to avoid an array of incomplete type. found by gcc4.
 1.76  27-Apr-2004  atatat branches: 1.76.4;
That's not supposed to be there. Sorry.
 1.75  24-Mar-2004  atatat branches: 1.75.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.74  18-Nov-2003  dbj add "show mount" ddb command
 1.73  10-Oct-2003  chs add "b" as a synonym for "break", since someone added "bt"
and made "b" an ambiguous prefix.
 1.72  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.71  16-May-2003  itojun branches: 1.71.2;
switch to use strlcpy() from libkern.
 1.70  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.69  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.68  13-Feb-2003  jmc Add a synonym for trace - 'bt' and document it
 1.67  20-Jan-2003  simonb Remove variable that is only assigned too but not referenced.
 1.66  26-Aug-2002  scw 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.65  15-Feb-2002  simonb branches: 1.65.8;
Add a "show event" ddb command to show the event counters.
 1.64  15-Feb-2002  simonb 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.63  12-Nov-2001  lukem add RCSIDs
 1.62  17-Aug-2001  thorpej Add `show malloc' to dump the internal state of the MALLOC_DEBUG code.
 1.61  31-Jul-2001  atatat Add an easy way to dump the message buffer from ddb.
 1.60  03-Jun-2001  matt branches: 1.60.2;
Default to kernel_map if no addr is available.
 1.59  02-Jun-2001  chs replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.58  30-May-2001  mrg use _KERNEL_OPT
 1.57  11-Feb-2001  jhawk branches: 1.57.2;
alphabetize db_command tables
 1.56  24-Jan-2001  jdolecek make db_command_table[] const; since there is no way to dynamically extend
or modify the table at the moment, there is no functionality lost.
See also the discussion on tech-kern (Subject: 'machine' DDB command).
 1.55  22-Jan-2001  jdolecek Require the machine-dependant DDB commands to be in db_machine_command_table[]
and link it directly to db_command_table[] so that it's not necessary
to do this at runtime. Make db_machine_command_table[] const on all ports.
g/c now unneded stuff, like db_machine_commands_install(), db_machine_init()

Patch written by enami.
 1.54  18-Jan-2001  enami db_command_table needs to be writable at least when DB_MACHINE_COMMANDS
is defined.
 1.53  17-Jan-2001  jdolecek constify a little
 1.52  28-Nov-2000  eeh Restore the top level `callout' command.
 1.51  24-Nov-2000  chs add ddb commands "show uvmexp" and "show ncache".
the former used to be "call uvm_dump", the latter is new.
 1.50  08-Jul-2000  sommerfeld printf format safety
 1.49  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.48  17-Jun-2000  jhawk In db_command(), fix indentation and add a missing db_skip_to_eol() which
previously caused the next command following a ","-style repitition
to not be properly executed.
 1.47  10-Jun-2000  sommerfeld In the "reboot" and (badly misnamed) "sync" commands, clear db_recover
before calling cpu_reboot() (which never returns) so we can debug
faults occurring in cpu_reboot().
 1.46  08-Jun-2000  jhawk Only define db_show_arptab if NARP>1;
pointed out by cgd in kern/10314
 1.45  06-Jun-2000  jhawk Stop using DDB-specific "%n" kprintf() format specifier. This was
important as db_sym() can be called through printf() rather than
db_printf(), causing a trap as the standard %n usage is invoked.

The DDB-specific %n code should disappear from subr_prf.c soon...
 1.44  28-May-2000  sommerfeld Change printing of cpu number in the prompt in the MULTIPROCESSOR case
 1.43  26-May-2000  jhawk branches: 1.43.2;
Rename the machine-specific stack trace printing functions
from db_stack_trace_cmd() to db_stack_trace_print(),
and add an additional argument, a function pointer for an
output routine (i.e. printf() or db_printf()).

Add db_stack_trace_cmd() in db_command.[ch], calling
db_stack_trace_print() with db_printf() as the printer.

Move count==-1 special handling from db_stack_trace_print() [nee
db_stack_trace_cmd()] to db_stack_trace_cmd() [nascent here].

Again, I'm unable to test compilation on all affected platforms,
so advance apologies for potential brokenness.
 1.42  23-May-2000  thorpej Fix a printf format.
 1.41  22-May-2000  jhawk Add a "sifting" command to ddb (named from the Sun OpenPROM command of
the same name); it searches the symbol table(s) for all symbols matching
a given substring, and prints.

Extremely useful for when you forget that critical symbol name.

Also, with /F support (cf. "ls -F") to print a char indicating the
symbol type.
 1.40  20-May-2000  jhawk Install "show arptab" (db_show_arptab) in the ddb command tree.
Move prototype from netinet/if_inarp.h to ddb/db_interface.h.
Change function to have standard ddb parameters (though they're
ignored).
 1.39  15-May-2000  jhawk "p" should be an alias for "print", and was until "ps" was added.
Now it is, again.
 1.38  13-Apr-2000  jhawk From kern/9569.
Preserve ddb's idea of "count" from one command to the next if
repeating a command via hitting newline.
 1.37  11-Apr-2000  chs actually add buf- and vnode-printing commands to the table.
 1.36  10-Apr-2000  chs add ddb commands for printing vnodes and bufs.
 1.35  30-Mar-2000  augustss Die, register, die!
 1.34  21-Feb-2000  sommerfeld On MP, print cpu number prior to prompt
 1.33  02-Nov-1999  jdolecek db_cmd_list(): variable ``width'' might have be used uninitialized, initialize
it to 0
 1.32  28-Oct-1999  lukem - change db_cmd_list() to list commands vertically rather than horizontally
- sort entries in the various command tables, so that the `help' lists
are easier to use. this included hacking db_machine_commands_install()
to search for the "machine" entry to change the `more cmds' pointer,
rather than assuming it was the first entry
- add a `sync' command, which is effectively `reboot 0x100'.
- remove db_help_cmd(); it was unused (and was almost a duplicate of
db_cmd_list()).
- move some extern decls to db_output.h, since they're used in more than one
place now
- rename NEXT_TAB to DB_NEXT_TAB and move to db_output.h
 1.31  10-May-1999  thorpej branches: 1.31.2; 1.31.4; 1.31.6;
Improve the pool allocator's diagnostic helpers, adding the ability to
log on a per-pool basis, reentrancy checking, and dumping various pool
information from DDB.
 1.30  12-Apr-1999  pk Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.29  06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.28  24-Mar-1999  mrg branches: 1.28.2;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.27  05-Jul-1998  tron branches: 1.27.4;
Include required "opt_ddb.h" header file.
 1.26  04-Jul-1998  jonathan defopt DDB.
 1.25  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.24  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly. :-)
 1.23  11-Sep-1997  scottr Add a 'reboot' command with a single parameter specifying the boot flags.
 1.22  07-May-1997  gwr branches: 1.22.4;
Add a "kill" command that calls db_kill_proc().
 1.21  03-Feb-1997  mycroft db_expr_t became a long.
 1.20  30-Mar-1996  christos Fix db_printf format specifications.
 1.19  13-Mar-1996  christos Kernel version of longjmp() does not take the return value of setjmp() as
an argument. setjmp() always returns 1.
 1.18  07-Mar-1996  christos Bring setjmp/longjmp prototypes into scope.
 1.17  13-Feb-1996  gwr eliminate setjmp.h
 1.16  05-Feb-1996  christos DDB prototype changes.
 1.15  26-Oct-1995  gwr Need to include <vm/vm.h>
 1.14  16-Oct-1995  mycroft Fix nits pointed out by GCC 2.7.
 1.13  09-Oct-1994  mycroft Clean up #includes.
 1.12  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.11  27-Apr-1994  pk Add "show callout".
 1.10  23-Mar-1994  pk struct command => struct db_command, and define it in db_command.h
 1.9  09-Jan-1994  mycroft Pointers to arrays behave oddly in C...
 1.8  09-Jan-1994  mycroft Push and pop db_recover for error handling, so we can set up temporary catch
points easily. (Alluded to by m68k code, but not implemented yet for some
reason.)
 1.7  18-Dec-1993  mycroft Canonicalize all #includes.
 1.6  13-Sep-1993  brezak Call vm_map_print and vm_object_print with func ptr to db_printf. Add DDB_MACHINE_COMMANDS from Mach 3.0 version.
 1.5  02-Aug-1993  mycroft branches: 1.5.2;
Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
 1.4  15-Jul-1993  brezak Add 'ps' command. Add -more- pager to output from Mach ddb.
 1.3  20-May-1993  cgd add explicit rcs id
 1.2  21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.2.2  14-Nov-1993  mycroft Canonicalize all #includes.
 1.5.2.1  14-Sep-1993  mycroft Incorporate changes from main branch.
 1.22.4.1  16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.4.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.28.2.2  12-Apr-1999  pk branches: 1.28.2.2.2;
Pullup copyright text corrections.
 1.28.2.1  07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.28.2.2.2.2  21-Jun-1999  thorpej Sync w/ -current.
 1.28.2.2.2.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.31.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.31.4.1  15-Nov-1999  fvdl Sync with -current
 1.31.2.4  12-Mar-2001  bouyer Sync with HEAD.
 1.31.2.3  11-Feb-2001  bouyer Sync with HEAD.
 1.31.2.2  08-Dec-2000  bouyer Sync with HEAD.
 1.31.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.43.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.57.2.5  27-Aug-2002  nathanw Catch up to -current.
 1.57.2.4  28-Feb-2002  nathanw Catch up to -current.
 1.57.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.57.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.57.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.60.2.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.60.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.60.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.60.2.2  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.60.2.1  03-Aug-2001  lukem update to -current
 1.65.8.1  29-Aug-2002  gehenna catch up with -current.
 1.71.2.5  11-Dec-2005  christos Sync with head.
 1.71.2.4  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.71.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.71.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.71.2.1  03-Aug-2004  skrll Sync with HEAD
 1.75.2.1  29-Apr-2004  jmc Pullup rev 1.76 (requested by atatat in ticket #207)

Not supposed to be there
 1.76.4.1  29-Apr-2005  kent sync with -current
 1.79.8.1  29-Nov-2005  yamt sync with head.
 1.79.2.9  27-Feb-2008  yamt sync with head.
 1.79.2.8  04-Feb-2008  yamt sync with head.
 1.79.2.7  21-Jan-2008  yamt sync with head
 1.79.2.6  15-Nov-2007  yamt sync with head.
 1.79.2.5  27-Oct-2007  yamt sync with head.
 1.79.2.4  03-Sep-2007  yamt sync with head.
 1.79.2.3  26-Feb-2007  yamt sync with head.
 1.79.2.2  30-Dec-2006  yamt sync with head.
 1.79.2.1  21-Jun-2006  yamt sync with head.
 1.82.2.2  01-Mar-2006  yamt sync with head.
 1.82.2.1  01-Feb-2006  yamt sync with head.
 1.83.4.2  01-Jun-2006  kardel Sync with head.
 1.83.4.1  22-Apr-2006  simonb Sync with head.
 1.83.2.1  09-Sep-2006  rpaulo sync with head
 1.84.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.84.4.2  11-May-2006  elad sync with head
 1.84.4.1  19-Apr-2006  elad sync with head.
 1.84.2.2  14-Sep-2006  yamt sync with head.
 1.84.2.1  24-May-2006  yamt sync with head.
 1.89.4.2  10-Dec-2006  yamt sync with head.
 1.89.4.1  22-Oct-2006  yamt sync with head
 1.89.2.2  05-Feb-2007  ad - Dump the contents of a lock's turnstile when an error is detected.
- Add a 'show lock' command to DDB.
 1.89.2.1  18-Nov-2006  ad Sync with head.
 1.92.2.2  07-May-2007  yamt sync with head.
 1.92.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.95.6.1  11-Jul-2007  mjf Sync with head.
 1.95.4.5  23-Oct-2007  ad Sync with head.
 1.95.4.4  17-Oct-2007  ad Sync with head (fix ddb).
 1.95.4.3  12-Oct-2007  ad Sync with head.
 1.95.4.2  09-Oct-2007  ad Sync with head.
 1.95.4.1  08-Jun-2007  ad Sync with head.
 1.96.8.3  23-Mar-2008  matt sync with HEAD
 1.96.8.2  09-Jan-2008  matt sync with HEAD
 1.96.8.1  06-Nov-2007  matt sync with HEAD
 1.96.6.3  14-Nov-2007  joerg Sync with HEAD.
 1.96.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.96.6.1  02-Oct-2007  joerg Sync with HEAD.
 1.96.2.1  10-Sep-2007  skrll Sync with HEAD.
 1.99.2.2  14-Oct-2007  yamt sync with head.
 1.99.2.1  06-Oct-2007  yamt sync with head.
 1.108.2.2  18-Nov-2007  bouyer Sync with HEAD
 1.108.2.1  25-Oct-2007  bouyer Sync with HEAD.
 1.110.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.110.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.110.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.111.6.1  13-Dec-2007  bouyer Sync with HEAD
 1.111.4.1  13-Dec-2007  yamt sync with head.
 1.111.2.1  26-Dec-2007  ad Sync with head.
 1.114.10.5  09-Oct-2010  yamt sync with head
 1.114.10.4  19-Aug-2009  yamt sync with head.
 1.114.10.3  20-Jun-2009  yamt sync with head
 1.114.10.2  04-May-2009  yamt sync with head.
 1.114.10.1  16-May-2008  yamt sync with head.
 1.114.8.1  18-May-2008  yamt sync with head.
 1.114.6.5  17-Jan-2009  mjf Sync with HEAD.
 1.114.6.4  05-Oct-2008  mjf Sync with HEAD.
 1.114.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.114.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.114.6.1  21-Feb-2008  mjf file db_command.c was added on branch mjf-devfs2 on 2008-06-02 13:23:10 +0000
 1.115.6.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.115.6.1  19-Oct-2008  haad Sync with HEAD.
 1.115.4.1  18-Jul-2008  simonb Sync with head.
 1.115.2.2  10-Oct-2008  skrll Sync with HEAD.
 1.115.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.120.4.2  09-Jan-2009  snj Pull up following revision(s) (requested by haad in ticket #241):
sys/ddb/db_command.c: revision 1.126
sys/ddb/db_command.h: revision 1.34
Fix my bug introduced in rev 1.98 of db_command.c where command prefix
not ambiguous in one table was choosed even if it was ambiguous in
another table in same list. Also apply more KNF rules.
Patch was supplied by uwe@.
 1.120.4.1  27-Nov-2008  snj Pull up following revision(s) (requested by nakayama in ticket #131):
sys/arch/sparc64/sparc64/db_disasm.c: revision 1.15
sys/arch/sparc64/sparc64/db_trace.c: revision 1.41
sys/arch/sparc64/sparc64/db_interface.c: revision 1.113
sys/ddb/db_command.c: revision 1.124
sys/arch/sparc64/include/db_machdep.h: revision 1.26
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.120.2.3  28-Apr-2009  skrll Sync with HEAD.
 1.120.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.120.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.126.2.2  23-Jul-2009  jym Sync with HEAD.
 1.126.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.133.4.3  31-May-2011  rmind sync with head
 1.133.4.2  21-Apr-2011  rmind sync with head
 1.133.4.1  05-Mar-2011  rmind sync with head
 1.133.2.1  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.134.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.136.4.4  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.136.4.3  23-Jan-2013  yamt sync with head
 1.136.4.2  23-May-2012  yamt sync with head.
 1.136.4.1  17-Apr-2012  yamt sync with head
 1.137.4.1  29-Apr-2012  mrg sync to latest -current.
 1.138.2.3  03-Dec-2017  jdolecek update from HEAD
 1.138.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.138.2.1  25-Feb-2013  tls resync with head
 1.142.2.1  18-May-2014  rmind sync with head
 1.143.6.5  05-Feb-2017  skrll Sync with HEAD
 1.143.6.4  22-Apr-2016  skrll Sync with HEAD
 1.143.6.3  06-Apr-2016  skrll Pull across ddb(4) show kernhist updates from HEAD
 1.143.6.2  06-Jun-2015  skrll Sync with HEAD
 1.143.6.1  06-Apr-2015  skrll Sync with HEAD
 1.147.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.148.8.5  27-Sep-2018  martin Pull up following revision(s) (requested by mrg in ticket #1037):

sys/dev/usb/uhub.c: revision 1.139
sys/external/bsd/dwc2/dwc2.c: revision 1.55
sys/ddb/db_output.c: revision 1.34
sys/ddb/db_command.c: revision 1.160
sys/dev/usb/ehci.c: revision 1.264
sys/dev/usb/xhci.c: revision 1.99
sys/dev/usb/ehci.c: revision 1.265
sys/kern/subr_userconf.c: revision 1.27
sys/dev/usb/ehcivar.h: revision 1.46
sys/dev/usb/ohci.c: revision 1.287
sys/dev/usb/uhci.c: revision 1.284
sys/dev/usb/usbdi.c: revision 1.178
sys/dev/usb/usb.c: revision 1.172
sys/dev/pci/xhci_pci.c: revision 1.14
sys/dev/usb/usb.c: revision 1.173
sys/dev/usb/usb.c: revision 1.174
share/man/man4/usb.4: revision 1.110
sys/ddb/db_command.c: revision 1.159
sys/dev/usb/usb_subr.c: revision 1.227
sys/dev/usb/uhcivar.h: revision 1.56
(all via patch)

consolidate the handling of polling across HC drivers, and generic USB:
- don't take mutexes if polling
- normalise the code across all drivers
- add some not yet code to block discovery to/from polling
- minor CSE
- adjust comment for usbd_set_polling() to reality now i properly
understand what it is used for and why.

this, with a hack to make RB_ASKNAME to wait 5 seconds allows boot -a
work with USB keyboards. there are still multiple issues remaining:
- discovery and polling need to be mutually exclusive
- attachment of ukbd and wskbd is not handled by config_pending, and
the 5 second delay isn't going to always be enough.

call cnpollc(1) and cnpollc(0) around cngetc().
(christos has a good idea to add a function that does all 3,
and we should switch all the callers in this sequence to use
it (and fix the MD ones missing it still). not all can, as
eg, line-grabbing functions can use cngetsn(), which only
calls cnpollc() twice.)


When this file is used when not building the kernel (eg: /usr/sbin/crash)
make cnpollc() go away.


reorder some struct members to remove holes.


add config_pending usage to uhub and general USB device attachment.
- call config_pending_incr() and config_pending_decr() around attaching
devices against "usbdevif" attribute.

uhub:
- convert sc_explorepending and sc_running to bool. add new sc_first_explore.
- call config_pending_incr() at the start of uhub_attach(). dropped in
uhub_explore(), if this is the first explore.


implement a gross hack to fix "boot -a" on systems with usb keyboards on
systems with ehci handover to uhci (and maybe ohci), and fix a similar
problem for "boot -s".

there is effort to ensure that all devices attached via USB are probed
before RB_ASKNAME or RB_SINGLE attempts to ask any questions on the console,
and largely this works, often by chance, today, for USB disks and root.
i've recently pushed this more into uhub and general USB device attachment
as well, and kept a config_pending reference across the first explore of
a bus. these fix many issues with directly attached hubs.

however, on systems where devices connected to ehci ports are handed over
to a companion uhci or ohci port, it may not be the first, or even second,
bus explore that finds the device finally before attachment, and at this
point all config_pending references are dropped.

there is no direct communication between drivers, the potentials are
looked up but their device_t is only used for generic things like the name,
so informing the correct companion to expect a device and deal with the
config_pending references is not possible without some fairly ugly layer
violations or multi-level callbacks (eg, we have "ehci0", and usually an
the relevant companion, eg, "uhci2", but it is the uhub that uhci2 has
attached that will deal with the device attachment.)

with the above fixes to generic USB code, the disown happens during the
first explore. the hack works by, at this point, checking if (a) root
is not mounted, (b) single user or ask name are set, and (c) if the hack
as not been triggered already. if all 3 conditions are true, then a
config_pending_incr() is called and a callback is triggered for (default)
5 seconds to call config_pending_decr(). ehci detach pauses waiting for
this callback if scheduled.

this allows enough time for the uhub and the ukbd/wskbd to attach before
the RK_ASKROOT prompts appear. testing shows it takes between 1.5 and
2 seconds for the keyboard to appear after the disown occurs.

Index: dev/usb/ehcivar.c
- new sc_compcallout, sc_compcallout, sc_complock, and a state for th
handover hack.

Index: dev/usb/ehci.c
ehci_init():
- use aprint_normal_dev() instead of manual device_xname().
- initialise sc_compcallout, sc_compcallout, sc_complock, and sc_comp_state.
ehci_detach():
- if there are companion controllers, tear own the above, including waiting
if there is a callback scheduled.
ehci_disown_callback():
- new callout to call config_pending_decr() in the the future.
schedule this ca
ehci_disown_sched_callback():
- if booting to single user or asking names, call config_pending_incr() and
schedule the callout above, default 5 second delay.
ehci_disown():
- if disowning a port call ehci_disown_sched_callback().
deal with partial attach failures in usb_attach vs usb_detach aka PR 53598.
- make sure xhci's sc->sc_ios is NULL if failure happens.
- rearrange usb_attach() / usb_doattach() to make it simpler to clean up.
- move usb_async_intr softint into usb_once_init(). previously, each USB
controller would start a new one, and leave the old one leaked.
- handle controller interrupts without a bus attached


remove usb(4)'s "flags 1" code. it has been dead for a while,
as it runs during the interrupts part of configuration now,
and all the devices try attach as early as possible, including
any root or boot required disk or keyboard device, which is
what this flag was for.
 1.148.8.4  23-Sep-2018  martin Pull up following revision(s) (requested by mrg in ticket #1024):

sys/ddb/db_command.c: revision 1.157
sys/ddb/db_command.c: revision 1.158
sys/kern/subr_lockdebug.c: revision 1.67

always call lockdebug_dismiss() from DDB -- there are always some
minimal lockdebug checks in place, even without LOCKDEBUG.

adjust lockdebug_abort() to ignore problems after ld_panic is set

so that there's a chance of this working.
this fixes ddb 'reboot' on softiron od1000.

call spl0() before cpu_reboot(), so that there's a chance that:
- interrupts can work afterwards
- this also means if IO stalls, serial break might work again.

this mimics how reboot(2) ends up calling cpu_reboot().
 1.148.8.3  07-Sep-2018  martin Pull up following revision(s) (requested by mrg in ticket #1013):

sys/sys/lockdebug.h: revision 1.20
sys/ddb/db_command.c: revision 1.155
sys/kern/subr_lockdebug.c: revision 1.65

add a lockdebug_dismiss() function for DDB to use that tells
lockdebug to avoid asserts. use it for the ddb "reboot"
command, so that it doesn't matter how ddb was entered, the
reboot not trigger mutex checks and not work.
 1.148.8.2  31-Jul-2018  martin Pull up following revision(s) (requested by msaitoh in ticket #954):

sys/sys/socketvar.h: revision 1.157
share/man/man4/ddb.4: revision 1.180
share/man/man4/ddb.4: revision 1.181
sys/kern/uipc_socket2.c: revision 1.131
sys/ddb/db_command.c: revision 1.154

Add "show socket" command written by Hiroki SUENAGA. It prints usage of
system's socket buffers.
Improve wording.
 1.148.8.1  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.149.2.4  30-Sep-2018  pgoyette Ssync with HEAD
 1.149.2.3  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.149.2.2  28-Jul-2018  pgoyette Sync with HEAD
 1.149.2.1  22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.153.2.4  21-Apr-2020  martin Sync with HEAD
 1.153.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.153.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.153.2.1  10-Jun-2019  christos Sync with HEAD
 1.160.4.1  26-Jan-2020  martin Pull up following revision(s) (requested by uwe in ticket #656):

sys/ddb/db_command.c: revision 1.162
sys/ddb/db_command.c: revision 1.163
sys/ddb/db_command.c: revision 1.164

db_command - make sure count is always initialized.
db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.
db_command - don't hide local static variable in the middle of other
local variable definitions. While here, get rid of the alignment of
variable names.
 1.169.2.1  20-Apr-2020  bouyer Sync with HEAD
 1.175.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.181.4.2  09-Aug-2023  martin Pull up following revision(s) (requested by maya in ticket #316):

sys/arch/m68k/include/mutex.h: revision 1.13
sys/arch/arm/include/cpu.h: revision 1.125
sys/arch/sun68k/include/intr.h: revision 1.21
sys/arch/arm/include/mutex.h: revision 1.28
sys/sys/rwlock.h: revision 1.18
sys/arch/powerpc/include/mutex.h: revision 1.7
sys/arch/arm/include/mutex.h: revision 1.29
sys/arch/powerpc/include/mutex.h: revision 1.8
sys/uvm/uvm_param.h: revision 1.42
sys/sys/ksem.h: revision 1.16
sys/arch/x86/include/mutex.h: revision 1.10
sys/sys/proc.h: revision 1.372
sys/sys/ksem.h: revision 1.17
sys/arch/ia64/include/mutex.h: revision 1.8
sys/arch/evbarm/include/intr.h: revision 1.29
sys/sys/lua.h: revision 1.9
sys/arch/next68k/include/intr.h: revision 1.23
sys/arch/ia64/include/mutex.h: revision 1.9
sys/arch/hp300/include/intr.h: revision 1.35
sys/arch/hp300/include/intr.h: revision 1.36
sys/arch/sparc/include/cpu.h: revision 1.111
sys/arch/hppa/include/mutex.h: revision 1.16
sys/arch/vax/include/intr.h: revision 1.31
sys/arch/hppa/include/mutex.h: revision 1.17
sys/arch/news68k/include/intr.h: revision 1.28
sys/arch/hppa/include/mutex.h: revision 1.18
sys/arch/hppa/include/intr.h: revision 1.3
sys/arch/hppa/include/mutex.h: revision 1.19
sys/arch/hppa/include/intr.h: revision 1.4
sys/sys/sched.h: revision 1.92
sys/opencrypto/cryptodev.h: revision 1.51
sys/arch/vax/include/mutex.h: revision 1.20
sys/arch/sparc64/include/mutex.h: revision 1.10
sys/arch/ia64/include/sapicvar.h: revision 1.2
sys/arch/riscv/include/mutex.h: revision 1.5
sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
sys/arch/riscv/include/mutex.h: revision 1.6
sys/ddb/files.ddb: revision 1.16
sys/arch/mac68k/include/intr.h: revision 1.32
share/man/man4/ddb.4: revision 1.203
sys/ddb/db_command.c: revision 1.183
sys/arch/mips/include/mutex.h: revision 1.10
sys/ddb/db_command.c: revision 1.184
sys/arch/x68k/include/intr.h: revision 1.22
sys/arch/sparc/include/psl.h: revision 1.51
sys/arch/or1k/include/mutex.h: revision 1.4
sys/arch/mips/include/mutex.h: revision 1.11
sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
sys/arch/sparc64/include/cpu.h: revision 1.134
sys/arch/sparc/include/psl.h: revision 1.52
sys/arch/or1k/include/mutex.h: revision 1.5
sys/arch/mvme68k/include/intr.h: revision 1.22
sys/arch/luna68k/include/intr.h: revision 1.16
external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
sys/arch/sparc/include/mutex.h: revision 1.12
sys/arch/sparc/include/mutex.h: revision 1.13
sys/arch/usermode/include/mutex.h: revision 1.5
sys/arch/usermode/include/mutex.h: revision 1.6
sys/kern/kern_core.c: revision 1.38
usr.sbin/crash/Makefile: revision 1.49
sys/arch/amiga/include/intr.h: revision 1.23
sys/arch/alpha/include/mutex.h: revision 1.12
sys/arch/alpha/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
sys/ddb/ddb.h: revision 1.6
sys/arch/sparc64/include/mutex.h: revision 1.8
sys/arch/sh3/include/mutex.h: revision 1.12
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
sys/ddb/db_syncobj.c: revision 1.1
sys/arch/vax/include/mutex.h: revision 1.18
sys/arch/sparc64/include/psl.h: revision 1.63
sys/arch/sparc64/include/mutex.h: revision 1.9
sys/arch/sh3/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/obio.c: revision 1.13
sys/arch/atari/include/intr.h: revision 1.23
sys/ddb/db_syncobj.c: revision 1.2
sys/arch/vax/include/mutex.h: revision 1.19
sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
sys/arch/cesfic/include/intr.h: revision 1.14
sys/ddb/db_syncobj.h: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.134
sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
sys/arch/cesfic/include/intr.h: revision 1.15
sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
sys/sys/cpu_data.h: revision 1.54
sys/arch/m68k/include/mutex.h: revision 1.12
sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes. Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h. avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
 1.181.4.1  03-Jun-2023  martin Pull up following revision(s) (requested by uwe in ticket #188):

sys/ddb/db_command.c: revision 1.182

ddb: PR kern/57435 - fix duplicate "show mount"

Bolivar cannot carry double. One of these commands should have been
"show mounts", cf. page/pages and a few others. While here fix the
function name to be db_show_all_mounts to conform to the pattern.

RSS XML Feed