Commit Graph

1364 Commits

Author SHA1 Message Date
uebayasi
af0ced746a Merge more indirect functions. Some comments. 2010-02-24 15:58:26 +00:00
uebayasi
f736e76fa5 uvm_fault_upper_lookup, uvm_fault_upper_neighbor: There is no point to call
pmap_update() without calling pmap_enter().

(Probably calling only once after loop (as done in uvm_fault_lower_lookup())
is enough.  If done so, other threads see entered neighbor pages as reflected
a little latter.)
2010-02-24 06:18:19 +00:00
uebayasi
efa838c11f Minor clean up. 2010-02-24 05:26:28 +00:00
uebayasi
a9659a6dfb Revert a thinko. 2010-02-24 05:00:55 +00:00
uebayasi
3bf5a87956 Slightly clean up uvm_fault() code path after pmap_enter(). Now tasks
needed for page cache are concentrated in own functions (uvm_fault_*_done()).
2010-02-24 04:32:58 +00:00
uebayasi
79440fb3fd Record if "promote" is done in UVMHIST. Do it for "upper" fault too. 2010-02-24 04:20:45 +00:00
uebayasi
b8168569e9 Merge some indirect "lower" fault handlers back. Prompted by rmind@. 2010-02-24 04:18:09 +00:00
jym
7bf36164a7 - Use ctob() instead of ptoa() to obtain physical addresses from frame
numbers. Using ptoa() will cast to vaddr_t, which might no be adequate
for architectures where sizeof(paddr_t) > sizeof(vaddr_t) (like i386 PAE).

- small fix inside AGP heuristics to avoid masking high order bits for
systems with more than 4GB.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html
2010-02-24 00:01:11 +00:00
drochner
9783f258ba rename the va0_disabled option and cpp conditional to "disable" as well,
for consistency, and document option and sysctl flag
2010-02-21 13:17:50 +00:00
drochner
1a101ef360 rename the new sysctl to "vm.user_va0_disable", for consistency
with the majority of existing sysctl flags, suggested by yamt
2010-02-20 13:21:58 +00:00
drochner
dda500d0d8 Disable mapping of virtual address 0 by user programs per default.
This blocks an easy exploit of kernel bugs leading to dereference
of a NULL pointer on some architectures (eg i386).
The check can be disabled in various ways:
-by CPP definitions in machine/types.h (portmaster's choice)
-by a kernel config option USER_VA0_DISABLED_DEFAULT=0
-at runtime by sysctl vm.user_va0_disabled (cannot be cleared
 at securelevel>0)
2010-02-18 14:57:01 +00:00
joerg
d621e29eca Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
2010-02-08 19:02:25 +00:00
mlelstv
3e39181b49 pgo_get needs the page array to be initialized. 2010-02-08 00:02:50 +00:00
mlelstv
5158187dbc Move assertion to make check more clear. 2010-02-08 00:01:39 +00:00
mlelstv
676d68d9ae Make UVMHIST build again. 2010-02-07 23:25:07 +00:00
mlelstv
dfd86ea3a8 Use filesystem blocks to address filesystem objects. f_iosize just
happens to be the same for current filesystems.
2010-02-07 15:51:28 +00:00
uebayasi
2903e6d834 __inline -> inline 2010-02-06 12:10:59 +00:00
uebayasi
6f78b42add Make vm_physseg lookup routines take the target vm_physseg. This is for the
coming "managed" device segments.
2010-02-06 02:56:17 +00:00
uebayasi
f0cafea3a4 vnode.h is not used here. 2010-02-05 03:49:11 +00:00
uebayasi
31973b36e6 Cosmetic. Shorten some long names. 2010-02-05 02:27:15 +00:00
uebayasi
2b1c626381 Fix !DIAGNOSTIC build. Reported by Geoff Wing. 2010-02-05 00:55:31 +00:00
uebayasi
e1b26edd82 Reduce diff between upper/lower neighbor handlers. 2010-02-04 05:48:26 +00:00
uebayasi
58625d0ac1 Merge "obfuscating layers" for readability. Inline some functions.
Requested by rmind@.
2010-02-04 03:32:21 +00:00
uebayasi
c0d0f35c5f Move uvm_fault_* static func decls in one place. 2010-02-04 03:19:08 +00:00
uebayasi
d0c590668f A few assertions & comments. 2010-02-03 14:02:49 +00:00
uebayasi
cfde757678 uvm_fault_lower_generic_io: Reduce diff from uvm_loanuobj(). 2010-02-03 12:40:39 +00:00
uebayasi
cd14256881 uvm_fault_lower_generic_io: One missing mutex_exit(vmobjlock). Found while
comparing this function with uvm_loanuobj().  (Part of) these should be
merged.
2010-02-03 07:48:18 +00:00
uebayasi
5f0a89783a uobj->pgops->pgo_get doing PGO_SYNCIO returns a uobjpage whose uobj backpointer
refers to another "uobj" used to call pgo_get.  Revert the wrong assertion
I made.  My bad.

(This and pgo_get's possible ERESTART return value check is the only 2 behavioral
changes I made.)

Reported by drochner@, thanks.
2010-02-02 18:49:23 +00:00
uebayasi
0dceadd765 Don't pass an unnecessary reference to uvm_loanbreak_anon().
Requested by rmind@.
2010-02-02 17:40:43 +00:00
wiz
27b261aabe Missing 'if defined COMPAT13 or COMPAT50' in uvm_swap.c found by cppcheck
and reported by Henning Petersen in PR 42721.
2010-02-02 15:00:34 +00:00
uebayasi
5526267c10 Be consistent to decide if PMAP_WIRED or not. 2010-02-02 06:52:59 +00:00
uebayasi
19fbe1698d Move A->K loan break code to uvm_loan.c. 2010-02-02 06:06:02 +00:00
uebayasi
be06afbe24 Indent. 2010-02-02 05:58:16 +00:00
uebayasi
a79520c14e uvm_fault: Split "neighbor" fault and loan handling into functions. 2010-02-02 04:35:35 +00:00
uebayasi
49bcc1198b Sort struct uvm_faultctx members for better alignment. 2010-02-02 01:54:48 +00:00
uebayasi
689dab24ea Indent. 2010-02-01 16:12:36 +00:00
uebayasi
d99dd23d72 More split. 2010-02-01 16:08:27 +00:00
uebayasi
49c8580e07 Fix build without DIAGNOSTIC. 2010-02-01 11:58:39 +00:00
uebayasi
ef11535fc6 uvm_fault: Clarify when to wire what. 2010-02-01 10:22:40 +00:00
uebayasi
3e6fea088d uvm_fault_upper_lookup: This is totally my personal preference, but can't help
adding one goto to reduce one indent.
2010-02-01 09:18:41 +00:00
uebayasi
c3f0715aa9 uvm_fault:
- Lower fault routines don't care the vm_anon array found in upper lookup.
  Don't pass the pointer down.
- The flag "shadowed" is known when we lookup upper layer.  Don't need to
  keep in the fault context struct.
2010-02-01 09:06:43 +00:00
uebayasi
f7a6581cde Indent. 2010-02-01 08:23:13 +00:00
uebayasi
90da75f6f6 Rewrite uvm_fault() loop using while () than goto. 2010-02-01 08:19:17 +00:00
uebayasi
6ca4a2b7f1 Split uvm_fault() into 2 more functions, uvm_fault_check() and
uvm_fault_upper_lookup().  Omit unnecessary arguments passed around.
2010-02-01 08:16:32 +00:00
uebayasi
82f34a5f99 uvm_fault: Pack variables shared during fault / re-fault into a struct named
uvm_faultctx.  Unfortunately ~all of those values are overriden in various
ways.  Constification doesn't help much...
2010-02-01 06:56:22 +00:00
uebayasi
62e5fa15ec ERESTART is already negative. Give up negating error values to not override
the original values.  Pointed out by rmind@, thanks.

In the lower fault case, if (*pgo_get)() can return ERESTART and we should
re-fault for that remains a question.  The original code just returned the
error, so keep that behaviour for now.  In case (*pgo_get)() really returns
ERESTART, pass EIO to tell the uvm_fault caller that (*pgo_get)() failed.

(As far as I grep callers don't check if the return value is ERESTART or not.
So assuming (*pgo_get)() never returns ERESTART should be a safe bet.)
2010-02-01 05:48:19 +00:00
uebayasi
40b4d371a5 Ax uvm_fault_internal() & break it into functions. "Upper" fault and "lower"
fault routines are separated now.
2010-01-31 17:13:38 +00:00
uebayasi
2359fa84f6 uvm_fault_internal:
Move local variables around to isolate contexts.  Note that remaining variables
are global in that function, and some hold state across re-fault.

Slilently clean-up the "eoff" mess.

(Superfluous braces will go once things settle down.)
2010-01-31 09:20:31 +00:00
uebayasi
fd3f38bda1 Indent. 2010-01-31 07:47:29 +00:00
uebayasi
3f944b46d0 uvm_fault_internal: In lower fault handling case, put another goto to clarify
that we don't care lower neighboring pages for the zero-fill object.
2010-01-31 07:46:03 +00:00