Commit Graph

1431 Commits

Author SHA1 Message Date
rmind 7146b2f61d Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete.  Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
2011-01-14 02:06:22 +00:00
enami eaefa873fe Fix bugs introduced by previous commit; allocated page needs to be bound
with the anon, and uvmfault_anonget may be called with ufi NULL.
2011-01-06 05:51:57 +00:00
enami 7b2a66bec9 Fix format string; use PRIu64 for uint64_t. 2011-01-05 21:20:44 +00:00
matt 4d8e8a7e36 Add better color matching selecting free pages. KM pages will now allocated
so that VA and PA have the same color.  On a page fault, choose a physical
page that has the same color as the virtual address.

When allocating kernel memory pages, allow the MD to specify a preferred
VM_FREELIST from which to choose pages.  For machines with large amounts
of memory (> 4GB), all kernel memory to come from <4GB to reduce the amount
of bounce buffering needed with 32bit DMA devices.
2011-01-04 08:26:33 +00:00
matt 5d3db402fb Add a MD hook to indicate a change of vmspace due to exec. (This is useful
to update any cpu flag due to a change to/from a 64bit and a 32bit address
space).  This can set the state needed for copyout/copyin before setregs
is invoked.
2011-01-04 08:21:18 +00:00
matt b3322481fa Print the number of page colors in use with db> show uvm 2011-01-04 08:17:01 +00:00
matt 6a66466f0c Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits.  Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
2010-12-20 00:25:23 +00:00
yamt 473b1715a5 cosmetics. no functional changes.
- constify
- wrap long lines
- assertions
- comments
2010-12-17 22:00:43 +00:00
pooka fe0a6aa142 Remove duplicate asserts from when uvm_fault_lower1() was merged
into uvm_fault_lower() (the duplicates were there already before,
just in different functions).

reported by Alexander Nasonov on tech-kern
2010-12-15 13:44:17 +00:00
matt 9898b7c4fd When panicing due a non-power of 2 pagesize, include the pagesize in the
panic message.
2010-12-11 22:34:03 +00:00
uebayasi 565a3d3094 Make UVM_PAGE_TRKOWN a real flag. 2010-12-09 01:48:05 +00:00
hannken bd8f6f0b8f Always take the object lock before changing vmpage flags. Fixes a deadlock
where a thread is waiting on "genput" but the page in question is neither
BUSY nor WANTED.

No objections from tech-kern@.
2010-11-30 10:55:25 +00:00
mrg 05061c6ad9 put the kernel-only externs back before <machine/pmap.h>. fixes ofppc build. 2010-11-29 09:49:33 +00:00
christos a9bdee4f4d don't leak kernel variables to userland! 2010-11-26 18:51:19 +00:00
uebayasi f4ae5ecf6e Put back VM_PAGE_TO_MD(); pointed out by skrll@, thanks. 2010-11-26 00:45:27 +00:00
uebayasi e3b768e416 Revert vm_physseg allocation changes. A report says that it causes
panics when used with mplayer in heavy load.
2010-11-25 04:45:30 +00:00
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
cegger 7f56ec2e89 build fix: vm_physmem_index is only used with DEBUG.
Fix build when DIAGNOSTIC is enabled but not DEBUG
2010-11-18 11:49:41 +00:00
uebayasi 5cdd3cec1f Optimize DIAGNOSTIC check code. 2010-11-18 08:41:11 +00:00
uebayasi 56df070b0c Fix DIAGNOSTIC physseg find check. 2010-11-18 08:18:31 +00:00
enami 2c376812ef Nowadays, comparing priority against PZERO doesn't make any sense.
Instead, see if a process waits uninterruptibly like ps does,
so that the second column (`b') of default vmstat output prints
some useful value (-t is still broken though).
2010-11-16 03:49:53 +00:00
uebayasi 2bc2c4def2 ... and another. 2010-11-14 15:18:07 +00:00
uebayasi 12d4db54c0 Fix build caused by a last minute change. 2010-11-14 15:16:53 +00:00
uebayasi 26dd1e598f Be a little more friendly to dynamic physical segment registration.
Maintain an array of pointer to struct vm_physseg, instead of struct
array.  So that VM subsystem can take its pointer safely.  Pointer
to this struct will replace raw paddr_t usage in the future.

Dynamic removal is not supported yet.

Only MD data structure changes, no kernel bump needed.

Tested on i386, amd64, powerpc/ibm40x, arm11.
2010-11-14 15:06:34 +00:00
uebayasi 1674b65491 Oops. Fix thinko. 2010-11-14 04:31:02 +00:00
uebayasi c9ff0b160b Platforms that dynamically set PAGE_{SIZE,MASK,SHIFT}, those values are
saved in struct uvmexp.  Expose only the relevant part for symbol users,
so that they don't need to include the whole uvm(9) API.
2010-11-14 04:25:16 +00:00
uebayasi e048abfd86 UVM constants should not rely on sys/lock.h. 2010-11-13 12:50:09 +00:00
uebayasi 6d3191d5b6 Hide uvm/uvm_page.h again to ensure its internal structures are MD.
GENERIC or at least one kernel compile tested for:
	acorn26, acorn32, algor, all, alpha, amd64, amiga, amigappc,
	arc, bebox, bighill, cats, cobalt, dreamcast, ews4800mips,
	hp300, hp700, hpcarm, hpcmips, hpcsh, i386, ibmnws,
	integrator, ixm1200, iyonix, landisk, luna68k, mac68k,
	macppc, mipsco, mmeye, mvme68k, mvmeppc, netwinder, news68k,
	newsmips, next68k, obs266a, ofppc, pmax, pmppc, prep,
	rs6000, sandpoint, sbmips, shark, sidebeach, sparc, sparc64,
	sun2, sun3, usermode, vax, x68k, zaurus
2010-11-13 05:52:55 +00:00
uebayasi 3ebf409bf5 Put back uvm_page.h for now. Sorry for mess. 2010-11-12 12:02:35 +00:00
uebayasi 4f1dd4067f Put VM_PAGE_TO_MD() definition in one place. No functional changes. 2010-11-12 07:59:24 +00:00
uebayasi 77d80f38cd Abstraction fix; move physical address -> per-page metadata (struct
vm_page *) "reverse" lookup code from uvm_page.h to uvm_page.c, to
help migration to not do that.

Likewise move per-page metadata (struct vm_page *) -> physical
address "forward" conversion code into *.c too.  This is called
only low-layer VM and MD code.
2010-11-12 05:23:41 +00:00
uebayasi aa803dbb9d Abstraction fix; move physical address -> physical segment "reverse"
lookup code from uvm_page.h to uvm_page.c.

This code is used by some pmaps to lookup per-page state (PV) from
per-segment metadata (struct vm_physseg).  This is not needed if
UVM looks up physical segment once in fault handler, then directly
passes it to pmap.  This change helps transition to that model.

The only users of vm_physseg_find() are pmap_motorola.c and
powerpc/ibm4xx/pmap.c.

Tested By:	Compiling and running powerpc/ibm4xx/pmap.c
		(evbppc/conf/OPENBLOCKS266)
2010-11-12 03:21:04 +00:00
uebayasi 186b58eb54 Abstraction fix; don't pull in physical segment/page definitions
in UVM external API, uvm_extern.h.  Because most users care only
virtual memory.

Device drivers use bus_dma(9) to manage physical memory.  Device
drivers pull in bus_dma(9) API, bus_dma.h.  bus_dma(9) implementations
pull in UVM internal API, uvm.h.

Tested By:	Compiling i386 ALL kernel
2010-11-12 02:36:02 +00:00
uebayasi 7e090d7604 C style; make a sentinel pointer have an exclusive value; no
functional changes.
2010-11-11 15:59:27 +00:00
uebayasi 4e73439bf8 Typo in a comment. 2010-11-11 15:51:05 +00:00
uebayasi 2d8b28a059 Minor clean up. 2010-11-11 15:47:43 +00:00
uebayasi e2e0c29553 Minor clean up. 2010-11-11 14:50:54 +00:00
uebayasi 04cf143fd6 Use more VM_PHYSMEM_*() accessors. No functional changes. 2010-11-10 09:27:21 +00:00
uebayasi e367a5a854 Prepare vm_physmem[] -> (*vm_physmem)[] migration, so that physical
segments can be changed at run-time.  Pointers are easier to update.
2010-11-10 01:24:46 +00:00
uebayasi 40a5185389 Provide a forward declaration of "struct vm_page", whose internal
is opaque to uvm_pglist.h users.  Users don't need to pull in
uvm_page.h.
2010-11-06 15:48:00 +00:00
uebayasi 41e5df6d3e Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)).  This functionality will be re-added later.
2010-11-06 15:42:43 +00:00
uebayasi b73ba829c6 Include uvm/uvm_pglist.h for struct pglist. 2010-11-06 12:19:14 +00:00
uebayasi 8e3c57e6cc Include uvm/uvm.h because this is part of UVM. 2010-11-06 12:18:17 +00:00
skrll 162991256a Spell immediately correctly. 2010-11-02 20:49:47 +00:00
tsutsui 8e16588b0b Make common kernel module binaries work on both sun3 and sun3x.
Tested on 3/160 (on TME) and (real) 3/80.

XXX: module files can be loaded only on single user?
2010-10-15 15:55:52 +00:00
matt 19e6c76b2d Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h). Also
helps find code that hasn't been updated to use the new rbtree API.
2010-09-25 01:42:38 +00:00
rmind 879d5dfb5e Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
   would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
   already existing one.
4. Amend the interface to manipulate the actual object, instead of the
   rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
2010-09-24 22:51:50 +00:00
pooka 04d191ff71 Make "no options VMSWAP" kernels compile again. 2010-09-07 04:45:22 +00:00
chs fca58884f4 replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings.  instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
2010-09-01 16:56:19 +00:00
yamt 86b3a16608 sys_mremap: unwrap a short line 2010-08-16 01:21:10 +00:00