Commit Graph

540 Commits

Author SHA1 Message Date
skrll 127563b6bc Fix alignment of ddb 'ps/[lw]' output. LID matches PID and has more digits. 2024-04-15 06:48:06 +00:00
skrll 16c8614d82 Fix column alignment in ps/w output 2024-01-22 07:57:48 +00:00
riastradh fddc6b2f61 ddb: New db_stack_trace_print_ra.
Takes an optional extra argument for the return address so that the
stack parser has a chance to use instruction-dependent interpretation
of the frame to find parent frames.

Implemented only on Alpha for now, which needs it.  Other
architectures just ignore the extra argument.

PR port-alpha/57716

XXX pullup-10
XXX pullup-9
XXX pullup-8
2023-11-21 14:35:01 +00:00
martin 3007f1403a 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.
2023-11-02 10:31:55 +00:00
martin 94e15f8436 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)
2023-10-15 10:40:52 +00:00
riastradh 016ac93b65 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'.
2023-10-15 10:27:33 +00:00
riastradh 5a1f45c803 ddb: Constify db_syncobj_owner argument.
No need for it to be writable, and the actual type of the struct lwp
member is const.
2023-10-15 10:27:25 +00:00
riastradh fac91bbe0f 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.
2023-10-15 10:27:11 +00:00
ad 61757a071b 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).
2023-10-13 19:07:08 +00:00
martin 4df38a4d2b For architectures (mips64) where sizeof(db_expr_t) != sizeof(kcondvar_t *)
cast through uintptr_t.
2023-10-08 15:03:16 +00:00
ad 9bf2517556 Add some simple DDB show commands: condvar, selinfo, sleepq 2023-10-07 20:27:20 +00:00
ad 794b808fb8 Oops, fix crash(8) build 2023-10-07 20:22:53 +00:00
ad 6c5a6d0ac2 Add db_print_timespec(). 2023-10-07 20:00:39 +00:00
andvar 8339635ecf s/unnsupported/unsupported/ in message. 2023-09-01 10:55:23 +00:00
riastradh 6674f75395 ddb: Teach `show all tstiles' to show the type of each lock. 2023-07-17 12:55:03 +00:00
riastradh 8b1de3a2b9 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.
2023-07-12 12:50:46 +00:00
riastradh e000c055ec ddb: Cast pointer to uintptr_t first before db_expr_t. 2023-07-11 11:03:31 +00:00
riastradh 70ecadb004 ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

XXX pullup-10
2023-07-09 17:10:47 +00:00
uwe 053fb2b498 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.
2023-05-25 21:46:55 +00:00
riastradh 7b4abd4b1d ddb(4): Declare extern db_active if _KMEMUSER too, not just DDB.
crash(8) is built with _KMEMUSER defined but DDB not defined except
for a few specific files or on MIPS.

Seems to me crash(8) should really be built with DDB defined in all
.c files but that leads to other fallout I'm not really inclined to
diagnose right now.
2022-10-27 20:00:24 +00:00
riastradh dbfa10e52a ddb/db_active.h: New home for extern db_active.
This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero.  Reduces need for #include opt_ddb.h, #ifdef DDB.
2022-10-26 23:38:05 +00:00
riastradh 5ec46ddfac ddb(9): Make db_symstr safe to use concurrently with pserialize(9). 2022-08-30 22:38:01 +00:00
riastradh 953ad39a79 ddb(4): Use db_num_to_strbuf in db_symstr.
Simplifies it and will make safer to use.
2022-08-30 22:37:36 +00:00
riastradh 3566aefb0b ddb(9): New db_num_to_strbuf.
Like db_num_to_str, but writes to caller-provided buffer instead of
returning pointer to static storage.
2022-08-30 22:37:03 +00:00
msaitoh 5082768d7f Remove 'a' modifier from "show vmem". It was removed in sbur_vmem.c rev. 1.55. 2022-04-28 07:08:38 +00:00
uwe 6b33e13a13 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.
2022-04-20 19:06:35 +00:00
andvar 75d2abaeb1 fix various typos in comments and output/log messages. 2022-04-10 09:50:44 +00:00
riastradh b6c8c37ff6 sys: Split struct device into a private device_impl.h.
Include this only inside autoconf itself, and a few files that abuse
autoconf in ways I can't confidently make easy fixes for.

XXX kernel ABI change requires bump -- no more use of struct device
internals allowed, previously done by some drivers
2022-03-28 12:38:57 +00:00
kre 30ec2d6e25 mv out: label into the #ifdef _KERNEL section, as it is only
referenced from there.  Hopefully ubbreak buikd of usr.sbin/crash
2021-12-13 03:17:50 +00:00
chs 6ee08449c7 ddb: fix function names of "noreturn" functions in stack traces.
when looking up function names for stack traces (where the addresses are the
return addresses of function calls), if the address is the first instruction
in the function, assume that the function being called is marked "noreturn"
and that the function containing the call is actually the function immediately
before the address that we looked up.  to find the correct function name,
do the lookup again with (address - 1) and then add one to the offset within
the function that we find.
2021-12-13 01:25:29 +00:00
thorpej c5931c832d Add a "show kqueue <addr>" command. 2021-10-10 18:08:12 +00:00
uwe 4d98da76c8 Sort variable declarations. Add short comments while here.
The list was neither sorted nor grouped logically when db_dumpstack
and db_panicstackframes were added to modify the panic behavior.
2021-10-06 17:04:49 +00:00
uwe 3051541536 KNF: The function type must be declared on a line by itself. 2021-10-06 12:18:20 +00:00
uwe 74286622f8 Add DDB_DUMPSTACK to opt_ddbparam.h.
PR kern/56445
2021-10-06 12:14:51 +00:00
uwe aeaee0d51e One option per-line for opt_ddbparam.h options. Sort. 2021-10-06 12:12:39 +00:00
andvar c69f42d323 fix mainly same typos as in my previous commit but outside sys/dev/dm. 2021-08-21 23:00:30 +00:00
andvar ebbc7028d3 fix typos in words "pointer" and s/fram /frame/ 2021-08-13 20:47:54 +00:00
andvar 6584ea569e fix various typos in compatibility, mainly in comments. 2021-08-09 20:49:08 +00:00
christos bf4e24e79b need <sys/param.h> for COHERENCY_UNIT 2021-07-20 11:39:16 +00:00
mrg d3874c24e6 don't provide db_lstacktrace() for crash (yet?). 2021-04-18 01:28:50 +00:00
mrg e2d256dc93 db_lstacktrace() can't use db_stacktrace_print and log() directly.
log() takes a 'int level' first argument, that must be supplied.
add an inline wrapper that calls vlog() with LOG_INFO, and the
supplied va_list.

(not noticed because this macro is not used anywhere in src but
i have a use in some uncommited code, that now failed to compile.)
2021-04-18 01:05:23 +00:00
mrg b80645cc71 avoid assigning both signed and unsigned variables in the same statement. 2021-04-12 02:49:02 +00:00
mrg 110ac605f8 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.
2021-02-23 07:13:51 +00:00
simonb 5267a28fdc Allow for MD code to use a different function than db_stack_trace_print()
to be used with db_stacktrace() and friends by pre-defining the
db_stacktrace_print macro.
2021-02-10 07:17:39 +00:00
dbj 99cd27f7ea defparam DB_MAX_WIDTH 2021-02-06 16:03:26 +00:00
simonb 0df872764f For "ps/a" print all of p_comm instead of just the first 10 chars, add a
space after PID, left justify the command name.
2021-01-11 07:49:04 +00:00
mrg e17ac28afe update several items that are done or dead. 2020-12-19 23:32:36 +00:00
skrll d20ab3a0c2 Remove "also;" 2020-10-30 16:29:49 +00:00
skrll 155f2770cc Add a "show fdt" ddb command 2020-10-30 16:08:44 +00:00
skrll 3d56dc6d58 Sort the db_show_cmd entries 2020-10-30 07:17:29 +00:00