Commit Graph

1533 Commits

Author SHA1 Message Date
rmind
4177c9beb4 Improve description on struct vm_page and explain locking a little bit more. 2012-01-28 19:12:10 +00:00
matt
64a05b1083 Replace locking checks with uvm_page_locked_p. 2012-01-28 15:43:34 +00:00
rmind
247885b64f Describe UVM object and explain lock sharing a little. 2012-01-28 14:37:35 +00:00
rmind
bc9403f1a3 pool_page_alloc, pool_page_alloc_meta: avoid extra compare, use const.
ffs_mountfs,sys_swapctl: replace memset with kmem_zalloc.
sys_swapctl: move kmem_free outside the lock path.
uvm_init: fix comment, remove pointless numeration of steps.
uvm_map_enter: remove meflagval variable.
Fix some indentation.
2012-01-28 00:00:06 +00:00
para
e62ee4d475 extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
2012-01-27 19:48:38 +00:00
chs
caaf3a9421 fix UVM_MAP_CLIP_* to only clip if the clip address is within the entry
(which would only not be true if the clip address is at one of the boundaries
of the entry).  fixes PR 44788.
2012-01-21 16:51:38 +00:00
reinoud
5bd510aeaa Revert MAP_NOSYSCALLS patch. 2012-01-05 15:19:52 +00:00
christos
4df396b653 prevent kernel from writing more than userland passed. 2011-12-30 19:01:07 +00:00
reinoud
9e3fb3728b Redo uvm_map_setattr() to never fail and remove the possible panic. The
possibility of failure was a C&P error.
2011-12-22 13:12:50 +00:00
reinoud
39568060d0 If we need to set the PK_CHKNOSYSCALL flag in struct proc be so nice to first
take the mutex. Tnx for pointing it out to me.
2011-12-20 19:49:36 +00:00
reinoud
ea698f7362 Ooops forgot the uvm_map.h 2011-12-20 15:41:01 +00:00
reinoud
d131102a3b Add a MAP_NOSYSCALLS flag to mmap. This flag prohibits executing of system
calls from the mapped region. This can be used for emulation perposed or for
extra security in the case of generated code.

Its implemented by adding mapping-attributes to each uvm_map_entry. These can
then be queried when needed.

Currently the MAP_NOSYSCALLS is only implemented for x86 but other
architectures are easy to adapt; see the sys/arch/x86/x86/syscall.c patch.
Port maintainers are encouraged to add them for their processor ports too.
When this feature is not yet implemented for an architecture the
MAP_NOSYSCALLS is simply ignored with virtually no cpu cost..
2011-12-20 15:39:35 +00:00
yamt
49cf653167 comment and assertion 2011-12-20 13:47:38 +00:00
mrg
9a4a666ff3 implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places.  avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.
2011-12-12 19:03:07 +00:00
matt
a617230f3e Redefine ptoa() to be the inverse of atop. If you were using a 32-bit vaddr_t
with 64-bit paddr_t and using managed addresses > 4GB, uvm_page_init would
silently discard the upper 32-bits of the physical address possibly double
mapping pages.
2011-11-29 07:43:54 +00:00
yamt
ef9d35249e comments 2011-11-28 14:06:59 +00:00
matt
4b00b594fa When allocating a page for a kernel stack and PMAP_ALLOC_POOLPAGE is
defined, use it.  (allows a MIPS N32 kernel to boot when there is memory
outside of KSEG0).
2011-11-23 01:07:50 +00:00
matt
c1be7fc1fe When allocating pages for kernel map entries and PMAP_ALLOC_POOLPAGE is
defined, use it.  (allows a MIPS N32 kernel to boot when there is memory
outside of KSEG0).
2011-11-23 01:00:52 +00:00
christos
cff1dac372 if you are going to dereference a variable, check the variable itself, not
it cousin.
2011-11-13 02:10:40 +00:00
hannken
2cc7a01f10 Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock.  Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
2011-10-14 09:23:28 +00:00
yamt
4e27ff24fc fix an integer promotion bug on 64 bit ports.
(signed + unsigned = unsigned)
2011-10-12 00:03:47 +00:00
yamt
8ddce5912c assertion 2011-10-11 23:57:50 +00:00
yamt
f8a2cce5e6 comment 2011-10-11 23:57:07 +00:00
uebayasi
5590d34021 Correct pagermap emergva allocation. From yamt@.
Tested by building i386 kernel with DTRACE defined which died 100%.
2011-10-06 12:26:03 +00:00
mrg
ad1c111812 re-arrange the end of uvm_page_recolor() to avoid the multiple exit
points.  move the call to uvm_pager_realloc_emerg() to after we
drop the uvm_fpageqlock, since it may be taken again in uvm_km_alloc().

fixes LOCKDEBUG crashes with the previous change.
2011-09-30 05:29:12 +00:00
matt
d289edb2b2 Reallocate emergency pager va when ncolors is increased. (modication of
patch from mrg).
2011-09-28 22:52:15 +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
matt
3d901f1f5e Allocate color appropriate pages. 2011-09-06 16:41:55 +00:00
dyoung
78b0e18345 Report vmem(9) errors out-of-band so that we can use vmem(9) to manage
ranges that include the least and the greatest vmem_addr_t.  Update
vmem(9) uses throughout the kernel.  Slightly expand on the tests in
subr_vmem.c, which still pass.  I've been running a kernel with this
patch without any trouble.
2011-09-02 22:25:08 +00:00
matt
207bff18bc Forward some UVM from matt-nb5-mips64. Add UVM_KMF_COLORMATCH flag.
When uvm_map gets passed UVM_FLAG_COLORMATCH, the align argument contains
the color of the starting address to be allocated (0..colormask).
When uvm_km_alloc is passed UVM_KMF_COLORMATCH (which can only be used with
UVM_KMF_VAONLY), the align argument contain the color of the starting address
to be allocated.
Change uvm_pagermapin to use this.  When mapping user pages in the kernel,
if colormatch is used with the color of the starting user page then the kernel
mapping will be congruent with the existing user mappings.
2011-09-01 06:40:28 +00:00
christos
262ad41ded Add an optional pglist argument to uvm_obj_wirepages, to be
filled with the list of pages that were wired.
2011-08-27 09:11:52 +00:00
oki
32a22fa000 make compile without VMSWAP. no functional change. 2011-08-23 03:00:35 +00:00
yamt
a7b89fad2a uvm_aio_aiodone_pages: check disposed anon correctly. 2011-08-18 14:17:08 +00:00
yamt
2b339dd699 uvm_anon_release:
- don't forget to call uvm_anon_dispose.
- simplify code a little.
2011-08-18 14:13:59 +00:00
yamt
535ffbdf82 uvm_anon_freelst:
- clear an_link/an_ref when deferring anon disposal.  otherwise others can
  see bogus an_ref.
- fix the code to remove anon from the list.
2011-08-18 14:13:02 +00:00
rmind
e52f8e8779 amap_cow_now: just free the fresh anon on error, no need to dispose it. 2011-08-17 20:46:27 +00:00
rmind
eeaaf989e3 uvm_anon_freelst: do not free PG_RELEASED pages (change uvm_anon_dispose()
to indicate them with a return value).
2011-08-14 01:20:33 +00:00
rmind
39445b05bc - Rework uvm_anfree() into uvm_anon_freelst(), which always drops the lock.
- Free anons in uvm_anon_freelst() without lock held.
- Mechanic sync to unused loaning code.
2011-08-06 17:25:03 +00:00
martin
eef17f7b6c Make uvmspace_exec() deal with procs that have no vmspace (yet) at all.
Greatly simplifies the upcoming posix_spawn implementation.
2011-07-30 20:05:46 +00:00
martin
95377927e5 Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
2011-07-30 19:29:12 +00:00
yamt
b456aa6a56 - fix a use-after-free bug in uvm_km_free.
(after uvm_km_pgremove frees pages, the following pmap_remove touches them.)
- acquire the object lock for operations on pmap_kernel as it can actually be
  raced with P->V operations.  eg. pagedaemon.
2011-07-05 14:03:06 +00:00
yamt
7eec89b991 reduce the number of atomic ops in common cases. it's exceptional for
anons to remain longer than amap.
2011-07-05 13:47:24 +00:00
matt
dd6af2c565 Allow the MD code to decide to panic if cpu_uarea_alloc would return NULL.
If NULL is returned, just allocate the standard way.
2011-07-02 01:26:29 +00:00
matt
ebc746ad25 Move PMAP_* cache defines to before inclusion of <machine/pmap.h> 2011-06-30 00:49:14 +00:00
hannken
ea8870b58b Remove dead uvm_vnp_zerorange() after bump to 5.99.54. 2011-06-29 19:51:12 +00:00
hannken
79568783ba amap_copy(): Keep the source amap locked until its lock has been copied.
Kernel assertion "anon->an_lock == amap->am_lock" no longer fails.

Ok: Mindaugas Rasiukevicius <rmind@netbsd.org>
2011-06-27 15:56:36 +00:00
rmind
c59e31527c amap_copy: fix one more regression, thanks to enami@. 2011-06-24 01:48:43 +00:00
rmind
7be1d60258 Fix uvmplock regression - a lock against oneself case in amap_swap_off().
Happens since amap is NULL in uvmfault_anonget(), so uvmfault_unlockall()
keeps anon locked, when it should unlock it.
2011-06-24 01:39:22 +00:00
yamt
fa43ee9ddc uvm_anon_release: fix a locking error after the rmind-uvmplock merge 2011-06-24 01:23:05 +00:00
rmind
538c69f6e6 amap_pp_adjref: fix regression, spotted by nonaka@. 2011-06-24 01:03:08 +00:00