Commit Graph

123 Commits

Author SHA1 Message Date
dyoung 8f34c216d0 Add printf_tolog(), which writes to the kernel message buffer,
only.  I believe this is the safest way to log serious conditions
indicated by NMI.
2008-05-31 20:27:24 +00:00
ad 245f0726ac Reduce ifdefs due to MULTIPROCESSOR slightly. 2008-05-19 17:06:02 +00:00
ad cefdd6012a In panic, we busy wait if another CPU is already panicking. Don't spl0(),
because we could recurse and run off the end of the stack. Pointed out by
chs@.
2008-05-13 11:54:45 +00:00
ad 27168d9d58 - Rename crit_enter/crit_exit to kpreempt_disable/kpreempt_enable.
DragonflyBSD uses the crit names for something quite different.
- Add a kpreempt_disabled function for diagnostic assertions.
- Add inline versions of kpreempt_enable/kpreempt_disable for primitives.
- Make some more changes for preemption safety to the x86 pmap.
2008-04-27 11:37:48 +00:00
ad 6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
yamt 69bbf68c6e acquire proclist_lock for SESSHOLD/SESSRELE. 2008-04-17 14:07:31 +00:00
ad b60416c0e2 Move the LW_BOUND flag into the thread-private flag word. It can be tested
by other threads/CPUs but that is only done when the LWP is known to be in a
quiescent state (for example, on a run queue).
2008-04-12 17:16:09 +00:00
dogcow ed79311de3 Always include <sys/cpu.h>, to pick up CPU_INFO_ITERATOR et al. 2008-02-19 07:46:51 +00:00
ad 5408e000be panic: allow only one CPU to panic. Try to make the panicing thread bound
and try take all CPUs offline, in case we can block at some point in the
future.
2008-02-18 14:46:58 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad f479e1b23b - Always include kprintf_slock.
- sys/lock.h -> sys/simplelock.h
2008-01-04 18:21:06 +00:00
pooka c7ac51486c tablefull: subr_prf -> subr_prf2 2007-12-30 22:55:21 +00:00
ad c3f5a622f9 Merge from vmlocking. 2007-11-07 00:19:08 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
he 2bf864fe60 Add an explicit include of <sys/device.h> to make sparc64 and sun2
build.  Needed for device_xname() and device_t, use added by previous
change.
2007-09-26 07:40:36 +00:00
joerg f381694bae Extend the aprint family with _dev and _ifnet versions that take
a device_t or struct ifnet * as first argument and prefix the log
message with the corresponding device/interface name.
2007-09-24 20:01:03 +00:00
pooka e97d926940 Move bitmask_snprintf() from subr_prf.c to subr_prf_bitmask.c to permit
standalone compilation.  No functional change.
2007-07-29 09:38:01 +00:00
isaki e7c552f22e Fix format of the combination of 'F\B\L' and ':\V' in
bitmask_snprintf(9).
2007-04-28 13:11:53 +00:00
thorpej 4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
martin e0c4f3147e Fix %X in kernel printf, from Arnaud Degroote in PR kern/34459. 2006-09-03 17:06:36 +00:00
darrenr 5987976cc1 if db_onpanic is -1, do not invoke any ddb functions at all when handling
a panic.  This allows ddb's behaviour on a panic to be controlled via
sysctl rather than just compiling it in/out.
2006-01-28 14:37:31 +00:00
darrenr 76f9e99eec Introduce a new style of behaviour for ddb_onpanic == 2.
When set to 0 or 1, behaviour is normal (today)
When set to 2, kernel will display a stack trace and then enter ddb.
2006-01-28 07:23:37 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
thorpej 2f6855b6ca Use ANSI function decls. 2005-06-23 18:46:17 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
christos 362a4a0bd5 Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
2005-05-17 04:14:57 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
reinoud 22f1132820 Implement ddb setting that allows all ddb output to be teed into the
kernel message buffer/log. Its off by default and can be switched on in the
kernel configuration on build time, be set as a variable in ddb and be set
using sysctl.

This adds the sysctl value
	ddb.tee_msgbuf = 0
by default.

The functionality is especially added and aimed for developers who are not
blessed with a serial console and wish to keep all their ddb output in the
log. Specifying /l as a modifier to some selected commands will also put
the output in the log but not all commands provide one nor has the same
meaning for all commands.

This feature could in the future also be implemented as an ddb command but
that could lead to more bloat allthough maybe easier for non developpers to
use when mailing their backtraces from kernel crashes.
2004-09-29 23:54:11 +00:00
junyoung a222c81884 Nuke __P(). 2004-03-23 13:22:03 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
matt 6221ccd63f Make sure to flush each line after printf. 2003-03-06 00:39:42 +00:00
christos e5323a474c - remove __STDC__ crap. It did not work anyway with pre-ansi compilers, since
va_start() takes one arg, and va_alist must be the only argument of a
  varyadic in the K&R world.
- pass flags to tputchar.
2003-02-17 22:21:52 +00:00
atatat a8481319cb Add a kern.dump_on_panic sysctl variable (and documentation, and a
kernel config option) that controls whether the kernel dumps to the
dump device on panic.  Dumps can still be forced via the ``sync''
command from ddb.  Defaults to ``on''.
2003-02-10 00:35:15 +00:00
thorpej f631b51555 Add aprint_error(), which is like aprint_normal(), but also records
the number of times it is called.  This allows subsystems to report
the number of errors that occurred during a quiet/silent subsystem
startup.  aprint_get_error_count() reports this count and resets it
to 0.

Also add printf_nolog(), which is like printf(), but prevents the
output from hitting the system log.
2002-12-31 23:45:36 +00:00
thorpej 3770328cab Add the following message printing routines, designed for printing
autoconfiguration messages:

aprint_normal: Send to console unless AB_QUIET.  Always goes to the log.
aprint_naive: Send to console only if AB_QUIET.  Never goes to the log.
aprint_verbose: Send to console only if AB_VERBOSE.  Always goes to the log.
aprint_debug: Send to console and log only if AB_DEBUG.

API inspired by the same routines in BSD/OS.

Will be used to address kern/5155.
2002-12-31 17:48:03 +00:00
thorpej 438dc24855 Partially expose some of the kernel printf internals in the new
<sys/kprintf.h> header file.  This allows subsystems that need
printf semantics other than what are provided by the standard
kernel printf routines to implement exactly what they want.
2002-12-31 16:53:26 +00:00
perry 6858187df6 /*CONTCOND*/ while (0)'ed macros 2002-11-02 07:20:42 +00:00
scw a82718b34d 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).
2002-08-26 11:34:27 +00:00
drochner 49c4cfb2c5 provide a db_vprintf() which is exactly what the name suggests 2002-06-05 17:53:52 +00:00
enami 6a043f1db9 Protect multi statement macro with do {} while (0). This is not cosmetic. 2001-11-21 00:55:39 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
fvdl 75e45c9dee Check msgbufenabled before referencing msgbufp in panic. Avoids
a NULL ptr reference if there is an early panic (i.e. before
initmsgbuf() was called).
2001-07-10 20:40:56 +00:00
lukem d84d2c6c85 add missing #include "opt_kgdb.h" 2001-05-30 15:24:23 +00:00
simonb 6a2acde042 Save the start and end positions in the message buffer of the formatted
panic string.

Suggested by Jason Thorpe eons ago.
2001-05-06 13:23:42 +00:00
kleink 50d738a0f0 Add %j, %t and %z modifiers. 2001-04-30 21:29:45 +00:00
tsutsui d507b847c6 Declare constty extern. 2001-03-09 13:35:50 +00:00
tv 5b0a45ec9b Strip %b and DDB formats out of kprintf, as they are no longer supported. 2000-08-09 10:22:31 +00:00
jdolecek 1ec07d7439 change tablefull() to accept one more parameter - optional hint
use that to inform about way to raise current limit when we reach maximum
number of processes, descriptors or vnodes

XXX hopefully I catched all users of tablefull()
2000-07-04 15:33:28 +00:00
sommerfeld e964d558a7 Fix assorted bugs around shutdown/reboot/panic time.
- add a new global variable, doing_shutdown, which is nonzero if
vfs_shutdown() or panic() have been called.
- in panic, set RB_NOSYNC if doing_shutdown is already set on entry
so we don't reenter vfs_shutdown if we panic'ed there.
 - in vfs_shutdown, don't use proc0's process for sys_sync unless
curproc is NULL.
 - in lockmgr, attribute successful locks to proc0 if doing_shutdown
&& curproc==NULL, and  panic if we can't get the lock right away; avoids the
spurious lockmgr DIAGNOSTIC panic from the ddb reboot command.
 - in subr_pool, deal with curproc==NULL in the doing_shutdown case.
 - in mfs_strategy, bitbucket writes if doing_shutdown, so we don't
wedge waiting for the mfs process.
 - in ltsleep, treat ((curproc == NULL) && doing_shutdown) like the
panicstr case.

Appears to fix: kern/9239, kern/10187, kern/9367.
May also fix kern/10122.
2000-06-10 18:44:43 +00:00