Commit Graph

159 Commits

Author SHA1 Message Date
pooka d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
riastradh 67d6ba47fb Convert remaining MI <sys/rnd.h> stragglers. Many MD ones left. 2015-04-13 16:46:33 +00:00
msaitoh 2e202f47c6 Remove useless semicolon reported by Henning Petersen in PR#49635. 2015-02-04 07:10:47 +00:00
apb 5f48354283 If mutex_tryenter() fails, don't call mutex_exit(). 2014-08-15 11:05:35 +00:00
mrg e1e8d3be37 avoid calling into time code when cold, and avoid calling nanotime()
if we're not going to use the result anyway.

XXX: not necessarily the best fix, but better than crashing *early*
boot due to too-early nanotime() calls.

XXX: pullup.
2014-08-15 07:39:25 +00:00
tls ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
christos e9ba8bc5a2 remove {v,}sprintf 2014-03-26 18:03:47 +00:00
joerg c9ec0f85a6 Revert, breaks the build due to missing rumpns_delay in librump.so. 2014-01-12 00:29:15 +00:00
christos 71826933a0 Sleep 10 seconds before rebooting due to panic()
To give an opportunity to screencap a panic(), or pause a VM to attach
a debugger.  (Richard Hansen)
2014-01-11 17:07:45 +00:00
apb bb0eb3bd82 Move the DDB-specific part of vpanic() to a new db_panic() function,
defined in ddb/db_panic.c and declared in ddb/ddbvar.h.  No functional
change.

The copyright years in db_panic.c are the years in which changes were
made to the code that has now been moved to db_panic.c.  No pre-NetBSD
copyright notice is needed because revision 1.12 of subr_prf.c had only
the trivial "#ifdef DDB \\ Debugger(); \\ #endif"
2013-02-10 11:04:19 +00:00
dholland 48a4d49b28 Repeated typo/varargs anachronism in comments. 2012-03-12 19:21:07 +00:00
christos 947906bba8 - fixed signed/unsigned comparison
- don't write/increment sbuf if NULL
2011-11-24 01:45:39 +00:00
christos 2413151944 - don't let arguments in macros have side effects
- nul terminate properly
2011-11-24 01:14:19 +00:00
christos 32c78aacbc Increment the source buffer when we overflow so that we don't get stuck in
an infinite loop.
2011-11-22 21:25:04 +00:00
christos 9873d290d6 - use va_copy where needed
- always nul terminate vsnprintf()
- make snprintf() call vsnprintf()
2011-11-21 01:44:26 +00:00
christos 3f19719796 snprintf/vsnprintf can accept NULL/0 buffers and work properly as expected.
Before they used to return incorrect length on short buffers. Remove unused
error path.
2011-11-20 23:01:18 +00:00
christos 01035c71fc Add vpanic() 2011-09-29 20:52:39 +00:00
jym 9ce680e4f1 Use a scratch space in panic(9) so we can store a more meaningful
message for panicstr instead of just the format string.

Keep setting the panicstr to fmt beforehand though for safety precaution.

ok joerg@.
2011-09-08 18:15:56 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
rmind bd5b92d68b - Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.
2011-04-24 18:46:22 +00:00
dyoung 56f6a5a11c Move device_printf() from ath_netbsd.c to subr_prf.c for reuse in a new
driver.
2011-01-21 17:46:19 +00:00
he ce1061323d On a recursive panic(), don't try to take a dump, as that may very
well have triggered the recursive panic.
Fix the comment for panic() to reflect now-current reality: the code
was already changed never to sync() on panic(), now we avoid dumping
core on a recursive panic.
2010-01-26 12:59:50 +00:00
dyoung e48f8429d1 Add a kernel configuration flag, SPLDEBUG, that activates a per-CPU log
of transitions to IPL_HIGH from lower IPLs.  SPLDEBUG is only available
on i386 and Xen kernels, today.

'options SPLDEBUG' adds instrumentation to spllower() and splraise() as
well as routines to start/stop debugging and to record IPL transitions:
spldebug_start(), spldebug_stop(), spldebug_raise(), spldebug_lower().
2009-11-03 05:23:27 +00:00
rmind fe55ad324c panic: use MI cpu_index(), instead of cpu_number(), which could be sparse. 2009-06-28 15:30:30 +00:00
cegger 4765113ada Return type of cpu_number(9) is cpuid_t which is effectively unsigned long.
So cast return type to unsigned long.
Fixes build for alpha GENERIC kernel.
2009-06-20 11:10:40 +00:00
mrg 8520c31093 when printing a ddb stack trace when entering ddb, include the cpu number 2009-06-18 06:26:58 +00:00
rmind 440e5485e0 - Rearrange pg_delete() and pg_remove() (renamed pg_free), thus
proc_enterpgrp() with proc_leavepgrp() to free process group and/or
  session without proc_lock held.
- Rename SESSHOLD() and SESSRELE() to  to proc_sesshold() and
  proc_sessrele().  The later releases proc_lock now.

Quick OK by <ad>.
2009-04-25 15:06:31 +00:00
cegger b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
mlelstv 046c06b035 Make curlwp accesses conditional on wether the data structures
have been initialized. Fixes PR kern/38599.
2009-03-10 10:48:09 +00:00
pooka 42356a10b5 Quote PR number in XXX comment. No functional change. 2009-01-30 21:16:51 +00:00
pooka 3c58d5b25f My clever hack was not enough. Disable DELAY via ifndef _RUMPKERN in
subr_prf until I manage to get all archs in line with a proper MI
signature.
2009-01-02 22:03:00 +00:00
pooka ff1136dede We use CPU_INFO_FOREACH here -> include sys/cpu.h 2009-01-02 11:08:32 +00:00
pooka 167269d42c Include kernel printf routines in rump instead of relying on the
magic libc symbol.  This also allows to bid farewell to subr_prf2.c
and merge the contents back to subr_prf.c.  The host kernel bridging
is now done via rumpuser_putchar().
2009-01-02 02:54:13 +00:00
pooka 0e983d35cf * unexpose kprintf locking internals
* migrate from simplelock to kmutex

Don't bother to bump kernel version, since nothing outside of subr_prf
used KPRINTF_MUTEX_ENXIT()
2009-01-01 15:10:20 +00:00
ad 7ca206492d Don't try to sync if panicing:
- It doesn't work and a dead system that can't be reset from the console is
  worse than a system that has painced and rebooted. If you can make it work
  reliably please do so.

- If the system is paniced there is every reason to suspect VM structures
  and the contents of the buffer cache.
2008-12-21 10:23:10 +00:00
pooka 2134732d08 Move [hH][eE][xX][dD][iI][gG][iI][tT][sS](*) from subr_prf to subr_prf2
for use with rumps.

*) yes, I just had to.  Notably though, there were only two
   symbols instead of 128.
2008-09-23 22:20:24 +00:00
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