Commit Graph

1353 Commits

Author SHA1 Message Date
pooka c7b9619f12 the most karmic commit of all: fix tyop in comment 2008-08-04 13:37:33 +00:00
matt 5698938787 Make uvm_map.? use <sys/rb.h> instead of <sys/tree.h>. Change the
ambiguous members ownspace/space to gap/maxgap.  Add some evcnt for
evaluation of lookups using tree/list.  Drop threshold of using
tree for lookups from > 30 to > 15.

Bump kernel version to 4.99.71
2008-07-29 00:03:06 +00:00
matt 3e3119f9fe Default PMAP_KMPAGE to 0 unless it's been previously defined by
<machine/pmap.h>
2008-07-16 14:33:09 +00:00
matt ad65eb54bc Add PMAP_KMPAGE flag for pmap_kenter_pa. This allows pmaps to know that
the page being entered is being for the kernel memory allocator.  Such pages
should have no references and don't need bookkeeping.
2008-07-16 00:11:27 +00:00
skrll 84009eaecf English improvement in comments.
"seems good to me :)" from yamt.
2008-07-11 07:09:18 +00:00
ad a9c686e81a Scale the number of kernel reserve pages by the number of CPUs. 2008-07-04 10:56:59 +00:00
ad ecddde33a2 Update a comment. 2008-07-04 10:22:35 +00:00
ad 16a991e560 uvm_pageidlezero: fix a broken test which made it give up too easily. 2008-07-02 17:47:53 +00:00
matt 1906aa3e59 Switch from KASSERT to CTASSERT for those asserts testing sizes of types. 2008-07-02 14:47:34 +00:00
matt 5a4f0c6b2b Change tree op members/typedefs to rbto_compare_* from rb_compare_* 2008-06-30 20:14:09 +00:00
ad 321c12209b Don't swap kernel stacks of realtime threads. 2008-06-25 19:20:56 +00:00
ad 1c7f0a02df Use pool_cache. 2008-06-25 13:21:04 +00:00
tsutsui d7d2a525b1 Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t. 2008-06-17 16:17:21 +00:00
yamt 52d8b786fc - uvm_pagereplace: don't try to insert multiple pages with the same offset
into uvm_object rbtree.
- inline static -> static inline
2008-06-17 02:30:57 +00:00
yamt 90e623a314 initialize uvm_loanzero_object correctly after page-cache rbtree changes. 2008-06-17 02:29:10 +00:00
ad c0cd593d89 uvm_swapout: try to lock the vm_map before calling pmap_collect. 2008-06-16 10:19:57 +00:00
ad 6bb1c8bc6f swappable: invert previous so we check for SACTIVE or SSTOP. 2008-06-09 11:52:34 +00:00
ad a3196ec57e swappable: return false if l->l_proc->p_stat == SDYING. 2008-06-09 11:51:43 +00:00
ad 0cd7bfa598 uvm_proc_exit: use macros to disable preemption. 2008-06-09 11:49:54 +00:00
ad f00b42c246 Back out previous. 2008-06-06 14:01:32 +00:00
ad ad1863a64a Wrap an expensive check in DIAGNOSTIC. 2008-06-06 13:52:56 +00:00
he 7151c31712 Delete what appears to be a spurious assignment to an undeclared
'cpu' variable added in revision 1.133.  Restores buildability for this file.
2008-06-05 08:16:01 +00:00
ad 5d66fa5745 - Switch off the map evcnts by default.
- SAVE_HINT() doesn't need to be atomic.
2008-06-04 17:47:40 +00:00
ad 7a34cb95f0 Replace the global vm_page hash with a per vm_object rbtree.
Proposed on tech-kern@.
2008-06-04 15:06:04 +00:00
ad 4f702c0ce1 udv_fault: pmap_update before releasing locks. 2008-06-04 13:35:24 +00:00
ad 83828e8d22 listq -> listq.queue 2008-06-04 13:23:30 +00:00
ad cbbf514e2c - vm_page: put listq, pageq into a union alongside a LIST_ENTRY, so we can
use both types of list.

- Make page coloring and idle zero state per-CPU.

- Maintain per-CPU page freelists. When freeing, put pages onto the local
  CPU's lists and the global lists. When allocating, prefer to take pages
  from the local CPU. If none are available take from the global list as
  done now. Proposed on tech-kern@.
2008-06-04 12:45:28 +00:00
ad 06c343ac94 vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both. 2008-06-04 12:41:40 +00:00
ad da4bdc8954 uvm_mmap: don't lock the map unless we need to. 2008-06-03 21:48:27 +00:00
ad e1be8408a0 uao_reference, uao_detach: we don't do reference counting on kernel objects,
so don't lock them needlessly.
2008-06-03 11:51:01 +00:00
ad 3a8db3158e Use atomics to maintain v_usecount. 2008-06-02 16:25:34 +00:00
ad bb29be511d One more. 2008-06-02 16:17:12 +00:00
ad fb8c6fcc83 Don't needlessly acquire v_interlock. 2008-06-02 16:16:27 +00:00
ad 0d151db6c9 Don't needlessly acquire v_interlock. 2008-06-02 16:00:33 +00:00
ad 1728b3636d UVM_PAGEZERO_TARGET -> UVM_PAGEZERO_LOWAT 2008-06-02 12:24:16 +00:00
ad 6dd8a2b97b uvm_pageidlezero:
- Use high and low water marks to try and reduce power consumption.
- Do trylock on uvm_fpageqlock, and bail if we can't get it.
- Only run on one CPU at a time.
2008-06-02 11:11:14 +00:00
ad 2feabc3836 PR kern/38812 race between lwp_exit_switchaway and exit1/coredump
Move the LWP RUNNING and TIMEINTR flags into the thread-private flag word.
2008-05-31 21:26:01 +00:00
ad 8350e2a9e8 Missing cv_destroy(). 2008-05-31 13:00:03 +00:00
mrg c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
chs a5e92dac93 if UVMHIST is defined, include headers necessary for its use. 2008-05-25 16:02:08 +00:00
kardel a70d0e6c97 keep dumpcdev and dumpdev consistent
allows savecore.c@1.72 to find the right dumpdev in case it was changed
from the default - hi ad@
2008-05-11 20:19:27 +00:00
ad e071d39c84 - Convert hashinit() to use kmem_alloc(). The hash tables can be large
and it's better to not have them in kmem_map.
- Convert a couple of minor items along the way to kmem_alloc().
- Fix some memory leaks.
2008-05-05 17:11:16 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad 7d6bc631b9 Disable preemption while swapping pmap. 2008-04-27 11:39:46 +00:00
yamt fb0cfeb7dd fix a locking botch. PR/38415 from Wolfgang Solfrank. 2008-04-26 13:44:00 +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
simonb 246143d6c1 Set up uvmhist in uvm_aio_aiodone_pages(). 2008-04-17 05:39:41 +00:00
yamt 1d737efc42 fix the order of printf arguments. 2008-04-11 15:47:15 +00:00
christos 9741037836 - use uarea_swapin, rather than duplicating the code.
- use __func__ where appropriate.
2008-04-11 15:31:37 +00:00
christos c7a574ed9e make this compile 2008-03-29 20:40:52 +00:00
dholland 132066c541 Fix broken build. hi skrll :-) 2008-03-29 20:15:54 +00:00
skrll 38b9530a91 Fix unsed variable when DEBUG isn't defined. 2008-03-29 18:49:13 +00:00
ad be04ac4896 Make rusage collection per-LWP and collate in the appropriate places.
cloned threads need a little bit more work but the locking needs to
be fixed first.
2008-03-27 19:06:51 +00:00
yamt d886e611bd remove a redundant pmap_update and add a comment instead. 2008-03-24 08:52:55 +00:00
bjs d5e8b5ed97 Allow this to compile if LISTQ is undefined:
- Put '#ifdef LISTQ' ... '#endif' pairs around pageq_insert_head()
	  and clockpro_insert_head().

	- Add missing argument to printf statement.
2008-03-22 05:50:42 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
martin 813190b43d Swap sysctl -d description of vm.filemin and vm.execmin. Noted by
Raymond Meyer on current-users.
2008-03-07 08:44:51 +00:00
yamt 5f4f3b8ca8 fix "stale map" assertions. PR/38153 from Sarton O'Brien. 2008-03-04 09:32:01 +00:00
yamt 19b9de9868 uvm_swap_io: if pagedaemon, don't wait for iobuf. 2008-02-29 20:35:23 +00:00
yamt 569bb6b4dc update comment 2008-02-29 12:08:04 +00:00
matt 41b4feae9a Convert two inlines from old-style-definitions to ansi. 2008-02-27 19:38:57 +00:00
ad 0fe23ea49b Assert uvm_fpageqlock is held in a few more places. 2008-02-27 14:24:24 +00:00
ad 185d25c158 Minor corrections to comments. 2008-02-27 14:23:33 +00:00
yamt 0a2b10db61 uao_put: fix a race with pageout. 2008-02-27 13:46:20 +00:00
chris 855792073c Add some more missing pmap_update()s following pmap_kremove()s. 2008-02-23 17:27:58 +00:00
yamt f7048cc403 uvm_uarea_init: fix compilation where PAGE_SIZE is not a constant. (sparc)
reported by Tom Spindler.
2008-02-08 11:49:40 +00:00
yamt 79c62b78b6 nonresident_rotate: avoid too long loops which can happen on some workloads. 2008-02-07 12:27:38 +00:00
yamt 7608362b58 swapcluster_flush: handle nused==0, which can happen if swapcluster_add failed.
PR/37669 from Andrew Doran.
2008-02-07 12:24:16 +00:00
yamt cb964fe917 uvm_uarea_init: make #if about PR_NOALIGN clearer and add a comment
to explain it.
2008-02-07 12:21:24 +00:00
hannken ee150e014e Lock swapdev_vp for VOP_OPEN.
From: YAMAMOTO Takashi <yamt@netbsd.org>
2008-01-30 14:25:21 +00:00
yamt 52838e34f5 remove a special allocator for uareas, which is no longer necessary.
use pool_cache instead.
2008-01-28 12:22:46 +00:00
hannken ce34b417f9 uvm_swap_init(): Call VOP_OPEN() on swapdev_vp to make I/O through the
swap device work with specnodes.

Ok: Andrew Doran <ad@netbsd.org>
2008-01-27 17:18:09 +00:00
reinoud 6383f534f7 Remove extra '(' that prevented kernel with UVMHIST to be compiled 2008-01-22 21:36:23 +00:00
yamt 2b40f35040 push pmap_clear_reference calls into pdpolicy code, where reference bits
actually matter.
2008-01-18 10:48:23 +00:00
yamt 729c3a185b unwrap short lines. 2008-01-13 16:46:47 +00:00
yamt b0fbe32ddf nonresident_rotate: micro optimization 2008-01-13 16:28:41 +00:00
yamt 74e0872eca simplify locking and remove vm_map_upgrade/downgrade.
this fixes a deadlock due to read-lock recursion of map->lock.
2008-01-08 13:09:55 +00:00
matt 2414d5854f Make sys_swapctl match syscallargs.h 2008-01-08 06:25:55 +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 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
christos 65c680cad7 Add PaX ASLR (Address Space Layout Randomization) [from elad and myself]
For regular (non PIE) executables randomization is enabled for:
    1. The data segment
    2. The stack

For PIE executables(*) randomization is enabled for:
    1. The program itself
    2. All shared libraries
    3. The data segment
    4. The stack

(*) To generate a PIE executable:
    - compile everything with -fPIC
    - link with -shared-libgcc -Wl,-pie

This feature is experimental, and might change. To use selectively add
    options PAX_ASLR=0
in your kernel.

Currently we are using 12 bits for the stack, program, and data segment and
16 or 24 bits for mmap, depending on __LP64__.
2007-12-26 22:11:47 +00:00
perry 970ad9314d Remove __attribute__((__noreturn__)) from things already marked __dead
Found by the department of redundancy department.
2007-12-24 15:46:45 +00:00
ad 9aef0fdbce Specify PR_LARGECACHE for anon_cache (which is insanely busy). 2007-12-20 23:50:00 +00:00
dsl 7e2790cf6f Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
2007-12-20 23:02:38 +00:00
yamt 0c38201391 add ddb "whatis" command. inspired from solaris ::whatis dcmd. 2007-12-13 02:45:09 +00:00
pooka db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
ad 371ba00b4a Allocate amaps from a pool_cache. 2007-12-08 15:46:31 +00:00
ad de874f619c Merge from vmlocking2 (use cdev_mmap()). 2007-12-08 15:33:09 +00:00
yamt bdc83d4098 g/c uvm_vnp_sync 2007-12-05 09:37:34 +00:00
yamt 83e62acd43 fix UBC_WANT_UNMAP.
- check PMAP_CACHE_VIVT after pulling pmap.h.
	- VTEXT -> VI_TEXT.
2007-12-05 09:35:46 +00:00
yamt e8abff70f2 constify pagerops. 2007-12-01 10:40:27 +00:00
yamt 7355a3c4f8 remove a duplicated decl. of aobj_pager. 2007-12-01 10:40:03 +00:00
yamt 062f8e82a2 use designated initiaizers for uvm_pagerops. 2007-12-01 10:18:21 +00:00
yamt 4450b52eeb uvm_pager_init: use __arraycount. 2007-12-01 10:08:21 +00:00
ad e81b22bdcb Make {anon,file,exec}pages unsigned. 2007-11-30 22:43:17 +00:00
ad e9e11b98df Use atomics to maintain uvmexp.{anon,exec,file}pages. 2007-11-29 18:07:11 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
xtraeme f444fd7856 Make this build without LOCKDEBUG (the if statement that uses
LOCKDEBUG_MEM_CHECK).
2007-11-26 08:22:32 +00:00
yamt 1a95aafc2b uvm_map_extract: for UVM_EXTRACT_QREF, mark entries UVM_MAP_NOMERGE. 2007-11-26 08:20:46 +00:00
yamt 89169ed40b uvm_unmap1: LOCKDEBUG_MEM_CHECK for kernel_map. 2007-11-26 08:15:19 +00:00
yamt f638ba54b7 call debug_init earlier. ie. before malloc is used. 2007-11-14 11:04:07 +00:00
yamt 7bc2fdc746 g/c unused uvm_anon_pool. 2007-11-13 08:48:28 +00:00
ad d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
ad d831186d55 Merge scheduler changes from the vmlocking branch. All discussed on
tech-kern:

- Invert priority space so that zero is the lowest priority. Rearrange
  number and type of priority levels into bands. Add new bands like
  'kernel real time'.
- Ignore the priority level passed to tsleep. Compute priority for
  sleep dynamically.
- For SCHED_4BSD, make priority adjustment per-LWP, not per-process.
2007-11-06 00:42:39 +00:00
yamt 23005df1e0 defparam PAGER_MAP_SIZE. 2007-10-25 13:03:03 +00:00
yamt c3ee5a2d35 uvm_mremap: fix alignment check for the easy cases. 2007-10-15 11:26:13 +00:00
yamt 0de985a71c uvm_map_reserve: don't ignore alignment. fixes mremap. 2007-10-15 11:24:30 +00:00
hannken 988890176c When swapping to a regular file use a workqueue to signal I/O completion.
VOP_STRATEGY() no longer gets called from interrupt context via
biodone() -> sw_reg_iodone() -> sw_reg_start().

Removes a deadlock condition reported in PR 37109.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
2007-10-15 08:12:13 +00:00
skrll 0d58a1f020 Don't restrict the offset when allocating a map entry for in-kernel map -
use UVM_UNKNOWN_OFFSET in the call to uvm_map_prepare.

This fixes a '"panic: malloc: out of space in kmem_map" when it's not
really' testcase of mine, and one reported to me by chuq. This is likely
to fix PR/35587 as well.

Looks/seems fine to me from chuq and yamt. Thanks.
2007-10-12 06:45:17 +00:00
ad 4c92a21547 Remove LOCK_ASSERT(!simple_lock_held(&foo)); 2007-10-11 19:53:37 +00:00
ad 7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
ad 451aacda90 Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
2007-10-08 15:12:05 +00:00
ad 82f39f6568 Fix merge error. 2007-10-08 14:14:55 +00:00
ad 4de14a3313 Pad the hashlocks to 32-byte boundaries. 2007-10-08 14:06:15 +00:00
yamt d71c563a36 make RANGE_TEST a function. 2007-09-23 16:05:40 +00:00
ad f5096e38d8 uvm_swapin: disable the swaplock assertion. uvm_lwp_hold() can't take
the lock yet.
2007-09-21 00:18:35 +00:00
pooka 3f3cac88a3 Make bioops a pointer and point it to the softdeps struct in softdep
init.  Decouples "options SOFTDEP" from the main kernel and ffs code.
2007-09-01 23:40:21 +00:00
ad a412ed5978 Also initialize map->lock for INTRSAFE maps. 2007-08-20 13:34:52 +00:00
ad f6481c29d3 uvmspace_free: destroy locks. 2007-08-20 13:33:47 +00:00
ad 09e7c477d8 Include sys/cpu.h for CPU_INFO_FOREACH. 2007-08-18 10:07:55 +00:00
ad ee1c78315b Fix error in previous. 2007-08-18 00:31:32 +00:00
ad b5866eb299 Make the uarea cache per-CPU and drain in batches of 4. 2007-08-18 00:21:10 +00:00
drochner a6b978e197 Round up size arguments as mmap() does.
This is for consistency, and to have semantics similar to Linux --
a Python selftest secceeds now.
2007-08-08 11:08:18 +00:00
pooka 4d42eff4e1 In uao_get(), drop object lock only after dropswap to avoid KASSERT panic.
Should fix tmpfs problem reported by riz on current-users.  yamt ok.
2007-08-05 10:19:23 +00:00
pooka 38ed0b2878 Use VSIZENOTSET only in KASSERTs 2007-08-04 09:42:58 +00:00
yamt 603d434b1b use separate nreslookup evcnt for obj and anon pages. 2007-08-01 14:49:55 +00:00
ad a0d1fd8d0c It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 13:31:07 +00:00
yamt 3822af7031 ubc_uiomove: add an "advice" argument rather than using UVM_ADV_RANDOM blindly. 2007-07-27 09:50:36 +00:00
yamt 828aae6ba6 remove a debug printf. 2007-07-27 09:33:58 +00:00
pooka 1ce406a846 Change unused fflags parameter in VOP_MMAP to prot and pass in
desired vm protection.
2007-07-27 08:26:38 +00:00
ad 615eff98fc In order to pacify assertions, make uao_list_lock + uvm_swap_data_lock
spinlocks for the time being.
2007-07-24 19:59:35 +00:00
he e7a46bb8e3 When _KERNEL is defined, we have now grown a dependency on
<sys/proc.h>, since one of the inline functions now refer to curlwp.
Fix this by including <sys/proc.h> when _KERNEL is defined.
2007-07-22 21:07:47 +00:00
pooka 05ce20f4a0 Retire uvn_attach() - it abuses VXLOCK and its functionality,
setting vnode sizes, is handled elsewhere: file system vnode creation
or spec_open() for regular files or block special files, respectively.

Add a call to VOP_MMAP() to the pagedvn exec path, since the vnode
is being memory mapped.

reviewed by tech-kern & wrstuden
2007-07-22 19:16:04 +00:00
ad e7e35c1d1d Temporarily work around an assertion from mutex_enter. 2007-07-21 22:14:42 +00:00
ad 6e948e8304 Fix DEBUG build. 2007-07-21 20:52:59 +00:00
ad 4688843d2b Merge unobtrusive locking changes from the vmlocking branch. 2007-07-21 19:21:53 +00:00
joerg e4fc1154a4 Add native mremap system call based on the UVM implementation for
Linux compat. Add code to enforce alignment of the new location.
Special thanks to wizd for helping with the man page.
2007-07-17 17:42:07 +00:00
macallan a1457f5905 change pmap_phys_address()s parameter to paddr_t since that's what it gets
fed from mmap*() anyway
approved by gimpy
2007-07-16 23:48:03 +00:00
ad 63873b9b21 Revert unintentially committed change. 2007-07-14 22:27:15 +00:00
rmind 20bbb87e34 Implementation of per-CPU work-queues support for workqueue(9) interface.
WQ_PERCPU flag for workqueue and additional argument for workqueue_enqueue()
to assign a CPU might be used. Notes:
 - For now, the list is used for workqueue_queue, which is non-optimal,
   and will be changed with array, where index would be CPU ID.
 - The data structures should be changed to be cache-friendly.

Reviewed by: <yamt>, <tech-kern>
2007-07-12 20:39:56 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 751a3d3a74 handle UVM_UNKNOWN_OFFSET. 2007-06-24 22:56:58 +00:00
yamt 670c065b9a ubc_alloc: break loans on UBC_FAULTBUSY.
it's necessary after recent file overwrite changes.
(http://mail-index.NetBSD.org/source-changes/2007/06/05/0014.html)
it should fix the problem reported by Sarton O'Brien on
current-users@/port-xen@.
(http://mail-index.NetBSD.org/current-users/2007/06/22/0001.html)
2007-06-22 15:15:48 +00:00
ad 6820f4664f Add a sysctl to disable swapout of kernel stacks. Discussed on tech-kern@. 2007-06-15 18:28:39 +00:00
yamt da51d139a4 improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
2007-06-05 12:31:30 +00:00
yamt f03010953f merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.
2007-05-17 14:51:11 +00:00
elad 6700cfccd6 Some Veriexec stuff that's been rotting in my tree for months.
Bug fixes:
  - Fix crash reported by Scott Ellis on current-users@.

  - Fix race conditions in enforcing the Veriexec rename and remove
    policies. These are NOT security issues.

  - Fix memory leak in rename handling when overwriting a monitored
    file.

  - Fix table deletion logic.

  - Don't prevent query requests if not in learning mode.


KPI updates:
  - fileassoc_table_run() now takes a cookie to pass to the callback.

  - veriexec_table_add() was removed, it is now done internally. As a
    result, there's no longer a need for VERIEXEC_TABLESIZE.

  - veriexec_report() was removed, it is now internal.

  - Perform sanity checks on the entry type, and enforce default type
    in veriexec_file_add() rather than in veriexecctl.

  - Add veriexec_flush(), used to delete all Veriexec tables, and
    veriexec_dump(), used to fill an array with all Veriexec entries.


New features:
  - Add a '-k' flag to veriexecctl, to keep the filenames in the kernel
    database. This allows Veriexec to produce slightly more accurate
    logs under certain circumstances. In the future, this can be either
    replaced by vnode->pathname translation, or combined with it.

  - Add a VERIEXEC_DUMP ioctl, to dump the entire Veriexec database.
    This can be used to recover a database if the file was lost.
    Example usage:

        # veriexecctl dump > /etc/signatures

    Note that only entries with the filename kept (that is, were loaded
    with the '-k' flag) will be dumped.

    Idea from Brett Lymn.

  - Add a VERIEXEC_FLUSH ioctl, to delete all Veriexec entries. Sample
    usage:

        # veriexecctl flush

  - Add a 'veriexec_flags' rc(8) variable, and make its default have
    the '-k' flag. On systems using the default signatures file
    (generaetd from running 'veriexecgen' with no arguments), this will
    use additional 32kb of kernel memory on average.

  - Add a '-e' flag to veriexecctl, to evaluate the fingerprint during
    load. This is done automatically for files marked as 'untrusted'.


Misc. stuff:
  - The code for veriexecctl was massively simplified as a result of
    eliminating the need for VERIEXEC_TABLESIZE, and now uses a single
    pass of the signatures file, making the loading somewhat faster.

  - Lots of minor fixes found using the (still under development)
    Veriexec regression testsuite.

  - Some of the messages Veriexec prints were improved.

  - Various documentation fixes.


All relevant man-pages were updated to reflect the above changes.

Binary compatibility with existing veriexecctl binaries is maintained.
2007-05-15 19:47:43 +00:00
christos 67695a4835 Make us standards compliant again. Return EINVAL in all cases (except for
mmap) so we cannot tell what went wrong.
2007-05-11 21:30:23 +00:00
christos 5e0b06ff45 Improve on previous and write a RANGE_TEST macro and do it on all the
system calls instead of doing a half-assed job on some of them and none
on others.
2007-05-11 20:41:14 +00:00
christos c5a89b37a0 fix bogus wrap tests; ssize_t != int... 2007-05-11 20:05:50 +00:00
tsutsui 31c6ef6761 Add temporary workaround for PR kern/36019 (panic on sun2 and sun3).
Ok'ed by yamt.
2007-05-11 12:11:09 +00:00
yamt e332a34211 add an evcnt and some assertions. 2007-05-07 12:39:45 +00:00
pooka c65d708ad2 adjust misleading comment: PGO_SYNCIO does not depend on PGO_CLEANIT 2007-04-23 20:10:50 +00:00
dsl b8fbaf8c4b Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
  - which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
  the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
  during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
  search for absolute pathnames in the emulation root, if that fails it will
  retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
  of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
  relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
  inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
  the real root is returned instead (matching the behaviour of emul_lookup,
  but being a cheap comparison here) so that programs that scan "../.."
  looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
  CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
  TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
2007-04-22 08:29:55 +00:00
chs aba740b225 define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
2007-04-16 05:14:54 +00:00
perseant 9bab95b2ae Track lwp as well as proc owner with UVM_PAGE_TRKOWN 2007-04-14 07:01:33 +00:00
rmind 60e35a7f80 Export uvm_uarea_free() to the rest.
Make things compile again.
2007-03-24 21:15:39 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
yamt e781af39bd implement priority inheritance. 2007-02-26 09:20:52 +00:00
skrll e7f4fd07df -#include <sys/sa.h> 2007-02-23 08:18:35 +00:00
thorpej b3667ada6d TRUE -> true, FALSE -> false 2007-02-22 06:05:00 +00:00
matt 93feeb1203 Fix lossage from boolean_t -> bool and updated x86 bus_dma. 2007-02-22 04:38:02 +00:00
thorpej dd962f8680 Pick up some additional files that were missed before due to conflicts
with newlock2 merge:

Replace the Mach-derived boolean_t type with the C99 bool type.  A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 23:48:10 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
ad 7df3c36a6c uvm_kick_scheduler(): do nothing until the swap subsystem is initialized. 2007-02-19 01:35:19 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
rmind 27c80c165c Mention rmind@ as an author in the license. No functional change. 2007-02-17 20:45:36 +00:00
ad 2a34d8467a Fix load average calculation:
- Don't consider kernel threads when calculating the load average. Their
  priorities are no longer adjusted by the scheduler, and their level of
  activity is dependent upon running user processes.
- Change the (l->l_priority > PZERO) check in uvm_meter() to (l->l_flag &
  L_SINTR). I think this check was originally intended to weed out
  processes sleeping interruptably.
2007-02-15 20:22:43 +00:00
ad d91014721f Add uvm_kick_scheduler() (MP safe) to replace wakeup(&proc0). 2007-02-15 20:21:13 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
elad d60f1f435f If Veriexec prevents indirect execution of the binary, in addition to just
blocking the mmap() if exec bit is requested, also strip exec bit from
maxprot for further mprotect() calls.

Okay joerg@.
2007-02-03 01:11:50 +00:00
hubertf 142c2a33ba Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
2007-01-24 13:08:11 +00:00
skrll 4b3e98dc1b Remove useless double assignment.
PR 35442
2007-01-19 15:52:24 +00:00
elad fa26351488 Cosmetic nit in the 'filename' passed to veriexec_verify(). 2007-01-11 14:26:07 +00:00
alc 2fc133de08 CID-4192: ensure we have 'uobj != NULL` here
ok christos@ and yamt@
2006-12-27 17:59:08 +00:00
yamt 8bf7662829 merge yamt-splraiseipl branch.
- finish implementing splraiseipl (and makeiplcookie).
	  http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
	- complete workqueue(9) and fix its ipl problem, which is reported
	  to cause audio skipping.
	- fix netbt (at least compilation problems) for some ports.
	- fix PR/33218.
2006-12-21 15:55:21 +00:00
skrll 03c2b891e6 Update uvm_grow to support stacks that grow upwards.
Use on hppa and fix a bug in the hppa trap handler.
2006-12-18 09:39:14 +00:00
yamt fc88d88996 put ->K loaned pages on the page queue, so that page loaning doesn't
disturb pagedaemon/pdpolicy.
2006-12-15 13:51:30 +00:00
chs c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
elad b8e4702fb2 Back out uvm_is_swap_device(). 2006-12-07 14:06:51 +00:00
elad cbcd623862 We are required to hold uvm.swap_data_lock here too. 2006-12-02 03:23:38 +00:00
yamt 10cd898fb8 uvm_fault: fix an assertion. PR/35134 from Christos Zoulas.
it can be triggered by minherit as well.
2006-12-01 19:15:22 +00:00
elad a6c2dfb16d Introduce uvm_is_swap_device(), to check if the passed struct vnode * is
used as a swap device or not.

Okay mrg@.
2006-12-01 16:06:09 +00:00
yamt c6970b82a3 uvm_fault: unwrap a short line. 2006-11-28 13:16:37 +00:00
yamt ec1dd90a2a uvmpdpol_pagedequeue: clear PQ_INITIALREF.
otherwise, dequeue/enqueue cycles (eg. page loaning) can cause
an assertion failure in clockpro_pageenqueue.
2006-11-28 13:14:53 +00:00
christos df031f1edc PR/34837: Mindaguas: Add SysV SHM dynamic reallocation and locking to the
physical memory
2006-11-25 21:40:04 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
yamt 1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
yamt b89279d039 revert malloc -> kmem_alloc part of uvm_swap.c rev.1.110 because
the current implementation of kmem_free can sleep.
2006-10-27 15:06:04 +00:00
uwe 5704a46a71 uvm_page_printall: With new PQ_* flags pg->pqflags no longer fits and
makes the output of "show all pages" ragged.  Widen the field to 4 chars.
2006-10-26 20:00:52 +00:00
yamt e95cf416a6 extent/malloc -> vmem_alloc/kmem_alloc. 2006-10-22 09:44:21 +00:00
mrg 648bbec934 in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the
dumpdev.  this occurs when we try to set the dumpdev to a device
with no driver loaded.  this fixes PR#34872.

in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV
before calling cpu_dumpconf().  (this also fixes PR#34872.)

XXX: cpu_dumpconf() should probably be changed to take a dumpdev
XXX: and return an error in such cases, but that is a much more
XXX: intrusive change.

XXX2: this is only run-tested on sparc64 and compile tested on a
XXX2: couple of platforms.
2006-10-21 05:54:31 +00:00
yamt 4ba42a7148 add an assertion. 2006-10-19 09:34:00 +00:00
yamt a7dbf2d5e5 uvm_loanbreak: transfer dirtiness of the old page to the new page,
rather than blindly mark it dirty.  fix a part of PR/33513.
2006-10-14 09:23:56 +00:00
yamt 61934cf2b4 uvm_vnp_setsize: put back v_size assignment after uvn_put.
PR/34147 from Juergen Hannken-Illjes.
2006-10-14 09:20:35 +00:00
uwe bb003f9487 More __unused (in cpp conditionals not touched by i386). 2006-10-12 21:35:00 +00:00
dogcow e0909532c0 even more __unused. 2006-10-12 20:18:19 +00:00
yamt 0a8c1584c7 remove unnecessary #include of vnode.h. 2006-10-12 10:14:43 +00:00
yamt 9de1cdc8fe move some knowledge about vnode into uvm_vnode.c. 2006-10-12 10:14:20 +00:00