Commit Graph

310 Commits

Author SHA1 Message Date
christos 4fbdf206cb Split p_xstat (composite wait(2) status code, or signal number depending
on context) into:
1. p_xexit:		exit code
2. p_xsig:		signal number
3. p_sflag & WCOREFLAG	bit to indicated that the process core-dumped.

Fix the documentation of the flag bits in <sys/proc.h>
2016-04-04 20:47:57 +00:00
pgoyette 01f3fada24 When clearing out the scheduler queues during system shutdown, we move
all processes to the SSTOP state.  Make sure we update each process's
p_waited and the parents' p_nstopchild counters to maintain consistent
values.  Should not make any real difference this late in the shutdown
process, but we should still be consistent just in case.

Fixes PR kern/50318

Pullups will be requested for:

       NetBSD-7, -6, -6-0, -6-1, -5, -5-0, -5-1, and -5-2
2015-10-13 00:25:51 +00:00
skrll dd7bb1e0a8 G/C sys/simplelock.h includes 2014-02-28 10:16:51 +00:00
martin fd52abfdd4 Remove __CT_LOCAL_.. hack 2013-09-15 13:03:59 +00:00
martin d0c00269ee Guard a function local CTASSERT with prologue/epilogue 2013-09-14 20:49:31 +00:00
mlelstv a73007ba40 The field ci_curlwp is only defined for MULTIPROCESSOR kernels. 2012-09-02 16:00:00 +00:00
matt 99af3c507e Add a new more KASSERT/KASSERTMSG 2012-08-30 02:26:38 +00:00
christos 8547430828 PR/46811: Tetsua Isaki: Don't handle cpu limits when runtime is negative. 2012-08-18 08:54:06 +00:00
matt f96ef7b3c5 Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).
2012-07-27 05:36:09 +00:00
rmind 4b8ea8ed96 Improve the assert message. 2012-04-21 22:38:25 +00:00
yamt 673662ef94 comment 2012-04-18 13:42:11 +00:00
matt 0fb436b313 If IPL_SAFEPRI is defined, use it to initialize safepri. 2012-03-03 00:22:24 +00:00
rmind ad12c77015 Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
2012-02-19 21:05:51 +00:00
rmind 9a80847a9f Remove obsolete ltsleep(9) and wakeup_one(9). 2012-01-28 12:22:33 +00:00
dholland 60230be848 time_t isn't necessarily "long". PR 45577 from taca@ 2011-11-06 14:11:00 +00:00
njoly 2695ecca0a Include sys/syslog.h for log(9). 2011-10-05 20:37:40 +00:00
apb 790ba6ca6f revert revision 1.291. log(LOG_WARNING) is not strictly more
noisy than printf().
2011-10-05 14:28:08 +00:00
apb 93dc43bb50 When killing a process due to RLIMIT_CPU, also log a message
with LOG_NOTICE, and print a message to the user with uprintf.

From PR 45421 by Greg Woods, but I changed the log priority (the user
might think it's an error, but the kernel is just doing its job) and the
wording of the message, and I edited a nearby comment.
2011-10-05 13:22:13 +00:00
apb a2f92979cd Print "WARNING: negative runtime; monotonic clock has gone backwards\n"
using log(LOG_WARNING, ...), not just printf(...).

From PR 45421 by Greg Woods.
2011-10-05 13:05:49 +00:00
jym 325494fe33 Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
2011-09-27 01:02:33 +00:00
christos 44968cba76 Add an implementation of passive serialization as described in expired
US patent 4809168. This is a reader / writer synchronization mechanism,
designed for lock-less read operations.
2011-07-30 17:01:04 +00:00
rmind f132c365c0 Sprinkle __cacheline_aligned and __read_mostly. 2011-05-13 22:16:43 +00:00
rmind 38d699a20d Extend PCU:
- Add pcu_ops_t::pcu_state_release() operation for PCU_RELEASE case.
- Add pcu_switchpoint() to perform release operation on context switch.
- Sprinkle const, misc.  Also, sync MIPS with changes.

Per discussions with matt@.
2011-05-02 00:29:53 +00:00
matt 05f173a862 Add an assert to make sure no unexpected spinlocks are held in mi_switch 2011-04-14 05:33:20 +00:00
pooka a27f30410a update comment 2011-01-03 13:22:32 +00:00
rmind a5d3437d2b mi_switch: remove invalid assert and add a note that preemption/interrupt
may happen while migrating LWP is set.

Reported by Manuel Bouyer.
2010-12-18 01:13:36 +00:00
pooka 37653ea90a KASSERT we don't kpause indefinitely without interruptability.
XXX: using timo == 0 to mean "sleep as long as you like, and forever
if you're really tired" is not the smartest interface considering
the the hz/n idiom used to specify timo.  This leads to unwanted
behaviour when hz gets below some impossible-to-know limit.  With
a usec2ticks() routine it at least be a little more tolerable.
2010-11-02 15:17:37 +00:00
martin ffb5896ed4 Add a CTASSERT to make sure the cexp and ldavg arrays are kept in sync 2010-04-30 10:02:00 +00:00
rmind f08aebed01 sched_pstats: fix previous, exclude system/softintr threads from loadavg. 2010-04-20 16:49:48 +00:00
rmind 5f0ac9a4fa - Merge sched_pstats() and uvm_meter()/uvm_loadav(). Avoids double loop
through all LWPs and duplicate locking overhead.

- Move sched_pstats() from soft-interrupt context to process 0 main loop.
  Avoids blocking effect on real-time threads.  Mostly fixes PR/38792.

Note: it might be worth to move the loop above PRI_PGDAEMON.  Also,
sched_pstats() might be cleaned-up slightly.
2010-04-16 03:21:49 +00:00
yamt b1521a3612 remove redundant checks of PK_MARKER. 2010-03-03 00:47:30 +00:00
darran 383b7f700b DTrace: Get rid of the KDTRACE_HOOKS ifdefs in the kernel. Replace the
functions with inline function that are empty when KDTRACE_HOOKS is not
defined.
2010-02-23 22:19:27 +00:00
darran 2c398f9ea9 DTrace: Add __predict_false() to the DTrace hooks per rmind's suggestion. 2010-02-21 07:39:18 +00:00
darran 37422f86b0 Added a defflag option for KDTRACE_HOOKS and included opt_dtrace.h in the
relevant files. (Per Quentin Garnier - thanks!).
2010-02-21 07:01:57 +00:00
darran 1bc28ea1e9 Add the DTrace hooks to the kernel (KDTRACE_HOOKS config option).
DTrace adds a pointer to the lwp and proc structures which it uses to
manage its state.  These are opaque from the kernel perspective to keep
the kernel free of CDDL code. The state arenas are kmem_alloced and freed
as proccesses and threads are created and destoyed.

Also add a check for trap06 (privileged/illegal instruction) so that
DTrace can check for D scripts that may have triggered the trap so it
can clean up after them and resume normal operation.

Ok with core@.
2010-02-21 02:11:39 +00:00
skrll f3c7b2c4cd Fix comment(s).
OK'ed by rmind
2010-02-18 20:58:23 +00:00
rmind ac4dea4ab5 - nextlwp: do not set l_cpu, it should be returned correct (add assert).
- resched_cpu: avoid double set of ci.
2009-12-30 23:54:30 +00:00
pooka d2445bdd09 tsleep() on lbolt is now illegal. Convert cv_wakeup(&lbolt) to
cv_broadcast(&lbolt) and get rid of the prior.
2009-12-05 22:38:19 +00:00
pooka faa8e1b3e3 Convert tsleep(&lbolt) to kpause(). Make ltsleep/mtsleep on lbolt
illegal.  I examined all places where lbolt is referenced to make
sure there were pointer aliases of it passed to tsleep, but put a
KASSERT in m/ltsleep() just to be sure.
2009-12-05 22:34:43 +00:00
rmind 40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
elad b2f3768346 - Move sched_listener and co. from kern_synch.c to sys_sched.c, where it
really belongs (suggested by rmind@),

- Rename sched_init() to synch_init(), and introduce a new sched_init()
  in sys_sched.c where we (a) initialize the sysctl node (no more
  link-set) and (b) listen on the process scope with sched_listener.

Reviewed by and okay rmind@.
2009-10-03 22:32:56 +00:00
elad 458410e7b5 Oops, forgot to make sched_listener static. Pointed out by rmind@, thansk! 2009-10-03 21:21:56 +00:00
elad 452ced03bd Move sched policy back to the subsystem. 2009-10-03 01:30:25 +00:00
yamt 0436400c70 set LP_RUNNING when starting lwp0 and idle lwps.
add assertions.
2009-07-19 10:11:55 +00:00
yamt 6d375e715d update a comment 2009-06-29 23:39:00 +00:00
rmind 5c68e5d0ee Ephemeral mapping (emap) implementation. Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.
2009-06-28 15:18:50 +00:00
ad acf9701a7e kpreempt: fix another bug, uintptr_t -> bool truncation. 2009-04-16 21:19:23 +00:00
rmind 523acc7d68 Avoid few #ifdef KSTACK_CHECK_MAGIC. 2009-04-16 00:17:19 +00:00
yamt f0cdb5ac8d kpreempt: report a failure of cpu_kpreempt_enter. otherwise x86 trap()
loops infinitely.  PR/41202.
2009-04-15 11:44:20 +00:00
rmind f70325ee02 - kpreempt_disabled: constify l.
- Few predictions.
- KNF.
2009-03-28 21:43:16 +00:00