Commit Graph

6544 Commits

Author SHA1 Message Date
christos bc44c7d780 don't hold locks in ddb (call ksyms_getval_unlocked()), pointed out by ad. 2008-10-24 13:55:42 +00:00
christos ff0507541f don't expose ksyms_lock 2008-10-23 20:41:13 +00:00
blymn 57614abcf2 Conditionalise bypass of veriexec routines on veriexec_strict to prevent
loophole if tables fail to load and strict is then raised.
2008-10-23 13:18:14 +00:00
ad 71781b4471 Set kern.posix_semaphores are runtime so it can be a module.
(Picked wrong header the last time.)
2008-10-22 11:25:19 +00:00
ad 52e9644b6b Make MODCTL_LOAD_FORCE do something. 2008-10-22 11:19:15 +00:00
ad c81717a5e1 Set kern.posix_semaphores are runtime so it can be a module. 2008-10-22 11:17:08 +00:00
ad 7b228b5a9c - Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
  can be safely checked.
2008-10-22 11:16:29 +00:00
matt 8f23ec634b Only define/use saemul_netbsd if KERN_SA is defined. (maybe this should be
moved to compat_sa.c)
2008-10-21 20:52:11 +00:00
matt 6e1d2d17ef Only init ksyms mutex if ksyms is present in the kernel 2008-10-21 20:51:11 +00:00
ad a9327b33e2 Undo revivesa damage to userret(). 2008-10-21 11:51:23 +00:00
ad 19463db480 Correct an error message. 2008-10-20 20:07:35 +00:00
ad ee66516bfd PR kern/38814 ksyms needs locking
- Make ksyms MT safe.
- Fix deadlock from an operation like "modload foo.lkm < /dev/ksyms".
- Fix uninitialized structure members.
- Reduce memory footprint for loaded modules.
- Export ksyms structures for kernel grovellers like savecore.
- Some KNF.
2008-10-20 10:24:18 +00:00
christos 90b563e4cb rename proc_representative_lwp to proc_active_lwp and clarify it is for
ps display purposes. suggested by rmind.
2008-10-19 03:10:09 +00:00
christos 6b9261b24b Select a "representative" lwp instead of the first lwp in the list. The
first lwp in the list is the last created and in the firefox and gtk-gnash
case this is usually a zombie, so the status in ps was ZLl. This now picks
the lwp in order ONPROC > RUN > SLEEP > STOP > SUSPENDED > IDL > DEAD > ZOMB
and breaks ties using cpticks.
2008-10-19 01:43:25 +00:00
rmind a8552a3a74 Obviously intention was to check for SCHED_OTHER, not SCHED_FIFO. 2008-10-18 19:24:04 +00:00
rmind b5eb577d50 - Initialize pool subsystem and kmem(9) earlier, when UVM is up enough.
- Remove uao_hashinit() workaround used for anon-objects.
- Replace malloc with kmem.

OK by <yamt>.
2008-10-18 03:46:22 +00:00
rmind 65af07bb0c Make SCHED_M2 nice with nice(1). Closes PR/38048. 2008-10-18 03:44:04 +00:00
rmind d5ea013e1d Disallow user priority adjustments for SCHED_OTHER policy, simplify
convert_pri().  Sync schedctl(8) with the change.  Closes PR/38009.
2008-10-18 03:40:18 +00:00
wrstuden 7e10f527c2 Regen syscall tables. I forgot to do it after revivesa. While pooka
did some, not all are regenerated. Do them all at once for consistency.
2008-10-16 20:12:23 +00:00
pooka e3b0fcf963 One more rump syscall: ioctl (required for interface configuration) 2008-10-16 19:30:49 +00:00
wrstuden 27724c38ae Adjust locking on the sadata::sa_vps list. The main time we
walk the list, we're looking for a vp to do something with. We do
this in the signal code and in the timer code. The signal code already
runs with proc::p_lock held, so it's a very natural lock to use. The
timer code, however, calls into the sa timer code with a spinlock held.
Since proc::p_lock is an adaptable mutex, we can sleep to get it. Sleeping
with a spinlock is BAD. So proc::p_lock is _not_ the right lock there,
and something like sadata::sa_mutex would be best.

Address this difficulty by noting that both uses actually just read
the list. Changing the list of VPs is rare - once one's added, it stays
until the process ends. So make the locking protocol that to write the
list you have to hold both proc::p_lock and sadata::sa_mutex (taken
in that order). Thus holding either one individually grants read access.

This removes a case where we could sleep with timer_lock, a spinlock at
IPL_SCHED (!!), while trying to get p_lock. If that ever happened, we'd
pretty much be dead. So don't do that!

This fixes a merge botch from how I handled our gaining p_lock - p_lock
should not have simply replaced p_smutex.

While here, tweak the sa_unblock_userret() code for the case
when the blessed vp is actually running (on another CPU). Make its
resched RESCHED_IMMED so we whack the CPU. Addresses a hang I've
observed in starting firefox on occasion when I see one thread running
in userland and another thread sitting in lwpublk, which means it's on
the list of threads for which we need an unblocked upcall. This list is
one on which things should NOT linger.
2008-10-16 18:21:45 +00:00
ad ad507e54f8 _lwp_kill: set SI_LWP in the siginfo, not SI_USER. 2008-10-16 08:47:07 +00:00
wrstuden e27861f46e Add a weak alias for ktr_saupcall, so things build w/o KTRACE compiled. 2008-10-15 16:03:29 +00:00
pooka d31071b90c Mark a few network-related calls as RUMP (needs more work) 2008-10-15 13:01:15 +00:00
ad b5ff001c46 Correction to previous. 2008-10-15 08:25:28 +00:00
ad 1ec58d56ef - Rename cpu_lookup_byindex() to cpu_lookup(). The hardware ID isn't of
interest to MI code. No functional change.
- Change /dev/cpu to operate on cpu index, not hardware ID. Now cpuctl
  shouldn't print confused output.
2008-10-15 08:13:17 +00:00
wrstuden fc7511b00e Merge wrstuden-revivesa into HEAD. 2008-10-15 06:51:17 +00:00
pooka 2002727b2c Give maximum level of network softinterrupts a symbolic constant
(which happened to get bumbed from 32 to 33 (AF_MAX) now).
2008-10-14 17:15:20 +00:00
pooka a44cdde52c M_IOV is used all over the place, so stuff it in with malloc_stdtypes 2008-10-14 14:17:49 +00:00
ad 82e3c0b1ac Accept filters:
- Remove remaining #ifdef INET.
- Avoid holding locks so we don't need to do KM_NOSLEEP allocations.
- Use a rwlock to protect the accept filter list.
- Make it safe to unload accept filter modules.
- Minor KNF.
2008-10-14 13:45:26 +00:00
ad a68a7877a5 Correction to previous. 2008-10-14 09:17:23 +00:00
ad a65f991bb4 Redo kern_resource.c:1.146 by pooka@: change ui_sbsize to a u_long. 2008-10-14 09:16:32 +00:00
pooka 3a64aae825 Fix previous: weak symbols work so much better if they are exported
from the object as weak symbols...

There's also something to be said about "cosmetic" tweaks after
testing, but I do think I'll bother.
2008-10-13 18:16:33 +00:00
pooka cf05fbf706 Weak alias all rump system calls to rump_enosys() 2008-10-13 16:25:12 +00:00
plunky c827b856f4 fix problem pointed out by ad where sockopt may end up sleeping
inappropriately with the socket lock held.

    sockopt_init() may sleep

    sockopt_set() will not sleep

    sockopt_getmbuf() for legacy code will not sleep
2008-10-12 09:26:50 +00:00
tls cef30423d3 Address problems with accept filters noted by ad in his source-changes
mail: http://mail-index.netbsd.org/source-changes/2008/10/10/msg211109.html

	* Scary-looking socket locking stubs (changed to KASSERT of locked)

	* depends on INET inappropriately (though now you must add new
	  accept filter names to the uipc_accf.c line in conf/files if
	  you aren't using dataready or httpready)

	* New code uses MALLOC/FREE -- changed to kmem_alloc/kmem_free;
	  could be pool_cache, these are all fixed-size allocations.

We need to verify that this works as expected with protocols with per-socket
locking, like PF_LOCAL.  I'm a little concerned about the case where the
lock on the listen socket isn't the same lock as on the eventual connected
socket.
2008-10-11 16:39:07 +00:00
pooka 7e5aba5af0 Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.
2008-10-11 13:40:57 +00:00
pooka dc2ebb63b8 Put ui_lock back and use it to modify the socket buffer size.
Typecasting quad_t * to long * and using atomic_add_long can't
possibly be expected to work!

Another fine error caught by the gcc type-punning warning.  That
really really should be on by default in the kernel.
2008-10-11 13:04:39 +00:00
skrll af82972758 RCSID police. 2008-10-10 23:09:19 +00:00
plunky d56f5b8302 use kmem_alloc/kmem_free rather than malloc() for sockokpt 2008-10-10 19:49:49 +00:00
ad 22191248b6 Update CALLOUT_INVOKING correctly, seems to have been lost. 2008-10-10 11:42:58 +00:00
ad fbc0e2e6d3 Redo 1.169 correctly (dsl's fix doesn't do what I intended, either!). 2008-10-10 11:20:15 +00:00
pooka 6dbf67cea1 Atomic ops are unnecessary here. pointed out by ad 2008-10-09 12:14:06 +00:00
pooka 225570303b Rewrite once to use global locks and atomic ops to get rid of the
static simplelock initializer (and simplelock too).  The fastpath
is still lockless, so doesn't make a difference in terms of
performance.

Also fixes a hanging bug if the once routine returned an error.
It does not retry after an error occurs, as I can't really imagine
fruitful semantics for that.
2008-10-09 10:48:21 +00:00
rmind 337b081fed - Replace lwp_t::l_sched_info with union: pointer and timeslice.
- Change minimal time-quantum to ~20 ms.
- Thus remove unneeded pool in M2, and unused sched_lwp_exit().
- Do not increase l_slptime twice for SCHED_4BSD (regression fix).
2008-10-07 09:48:27 +00:00
rmind 68121d6afa - Allow changing of kern.ipc.shmmax, just to avoid confusion.
- Change type of kern.ipc.shmmax to CTLTYPE_QUAD.
2008-10-07 09:35:03 +00:00
ad 139d645eee PR kern/39681 ddb doesn't work with new MODULAR modules
Complete initialization of new symbol table record.
2008-10-06 11:49:44 +00:00
ad 1b31761afa kobj_read: plug a leak. 2008-10-06 10:46:58 +00:00
pooka b9a8d2f75a hardclock() itself doesn't schedule callout softintrs any more,
so update comment - less is more.
2008-10-05 21:57:20 +00:00
njoly ab896e4008 Small fix to make setpriority(2) with PRIO_PROCESS return ESRCH when
no valid process can be found.
2008-09-30 17:28:47 +00:00