freebsd-nq/sys/vm
Alan Cox 387aabc513 Long, long ago in r27464 special case code for mapping device-backed
memory with 4MB pages was added to pmap_object_init_pt().  This code
assumes that the pages of a OBJT_DEVICE object are always physically
contiguous.  Unfortunately, this is not always the case.  For example,
jhb@ informs me that the recently introduced /dev/ksyms driver creates
a OBJT_DEVICE object that violates this assumption.  Thus, this
revision modifies pmap_object_init_pt() to abort the mapping if the
OBJT_DEVICE object's pages are not physically contiguous.  This
revision also changes some inconsistent if not buggy behavior.  For
example, the i386 version aborts if the first 4MB virtual page that
would be mapped is already valid.  However, it incorrectly replaces
any subsequent 4MB virtual page mappings that it encounters,
potentially leaking a page table page.  The amd64 version has a bug of
my own creation.  It potentially busies the wrong page and always an
insufficent number of pages if it blocks allocating a page table page.

To my knowledge, there have been no reports of these bugs, hence,
their persistance.  I suspect that the existing restrictions that
pmap_object_init_pt() placed on the OBJT_DEVICE objects that it would
choose to map, for example, that the first page must be aligned on a 2
or 4MB physical boundary and that the size of the mapping must be a
multiple of the large page size, were enough to avoid triggering the
bug for drivers like ksyms.  However, one side effect of testing the
OBJT_DEVICE object's pages for physical contiguity is that a dubious
difference between pmap_object_init_pt() and the standard path for
mapping devices pages, i.e., vm_fault(), has been eliminated.
Previously, pmap_object_init_pt() would only instantiate the first
PG_FICTITOUS page being mapped because it never examined the rest.
Now, however, pmap_object_init_pt() uses the new function
vm_object_populate() to instantiate them all (in order to support
testing their physical contiguity).  These pages need to be
instantiated for the mechanism that I have prototyped for
automatically maintaining the consistency of the PAT settings across
multiple mappings, particularly, amd64's direct mapping, to work.
(Translation: This change is also being made to support jhb@'s work on
the Nvidia feature requests.)

Discussed with:	jhb@
2009-06-14 19:51:43 +00:00
..
default_pager.c
device_pager.c Save previous content of the td_fpop before storing the current 2008-09-26 14:50:49 +00:00
memguard.c Provide the new argument to kmem_suballoc(). 2008-05-10 23:39:27 +00:00
memguard.h
phys_pager.c Eliminate an unnecessary clearing of a page's dirty bits in 2009-06-13 20:58:12 +00:00
pmap.h Retire pmap_addr_hint(). It is no longer used. 2008-05-18 04:16:57 +00:00
redzone.c Fix REDZONE(9) on amd64 and perhaps other 64 bit targets -- ensure the space 2008-08-13 17:32:48 +00:00
redzone.h
swap_pager.c Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC 2009-06-05 14:55:22 +00:00
swap_pager.h - Move 'struct swdevt' back into swap_pager.h and expose it to userland. 2007-02-07 17:43:11 +00:00
uma_core.c - Make the keg abstraction more complete. Permit a zone to have multiple 2009-01-25 09:11:24 +00:00
uma_dbg.c - Make the keg abstraction more complete. Permit a zone to have multiple 2009-01-25 09:11:24 +00:00
uma_dbg.h
uma_int.h - Make the keg abstraction more complete. Permit a zone to have multiple 2009-01-25 09:11:24 +00:00
uma.h - Make the keg abstraction more complete. Permit a zone to have multiple 2009-01-25 09:11:24 +00:00
vm_contig.c Simplify contigfree(). 2009-06-05 16:55:10 +00:00
vm_extern.h Eliminate dead code. 2009-04-01 04:36:37 +00:00
vm_fault.c Eliminate unnecessary obfuscation when testing a page's valid bits. 2009-06-07 19:38:26 +00:00
vm_glue.c Eliminate unnecessary obfuscation when testing a page's valid bits. 2009-06-07 19:38:26 +00:00
vm_init.c Adjust some variables (mostly related to the buffer cache) that hold 2009-03-09 19:35:20 +00:00
vm_kern.c Revert the addition of the freelist argument for the vm_map_delete() 2009-02-24 20:57:43 +00:00
vm_kern.h Enable the creation of a kmem map larger than 4GB. 2008-07-05 19:34:33 +00:00
vm_map.c Eliminate an unnecessary restriction on the vm object type from 2009-06-09 17:04:39 +00:00
vm_map.h When vm_map_wire(9) is allowed to skip holes in the wired region, skip 2009-04-10 10:16:03 +00:00
vm_meter.c - Mark all standalone INT/LONG/QUAD sysctl's MPSAFE. This is done 2009-01-23 22:49:23 +00:00
vm_mmap.c Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERIC 2009-06-05 14:55:22 +00:00
vm_object.c Long, long ago in r27464 special case code for mapping device-backed 2009-06-14 19:51:43 +00:00
vm_object.h Long, long ago in r27464 special case code for mapping device-backed 2009-06-14 19:51:43 +00:00
vm_page.c Add assertions in two places where a page's valid or dirty bits are changed. 2009-05-30 22:06:58 +00:00
vm_page.h Eliminate a stale comment and the two remaining uses of the "register" 2009-05-30 22:15:55 +00:00
vm_pageout.c Revise vm_pageout_scan()'s handling of partially dirty pages. Specifically, 2009-05-28 06:52:14 +00:00
vm_pageout.h Move the code for doing out-of-memory grass from vm_pageout_scan() 2008-09-29 19:45:12 +00:00
vm_pager.c Change the functions to ANSI in those cases where it breaks promotion 2009-02-24 18:09:31 +00:00
vm_pager.h Eliminate an unneeded forward declaration. (This should have been removed 2009-06-06 21:23:29 +00:00
vm_param.h Fix CTL_VM_NAMES. 2007-10-16 11:32:57 +00:00
vm_phys.c Introduce vm_reserv_reclaim_contig(). This function is used by 2008-04-06 18:09:28 +00:00
vm_phys.h Modify vm_phys_unfree_page() so that it no longer requires the given 2007-12-20 22:45:54 +00:00
vm_reserv.c Previously, when vm_page_free_toq() was performed on a page belonging to 2009-04-11 09:09:00 +00:00
vm_reserv.h Introduce vm_reserv_reclaim_contig(). This function is used by 2008-04-06 18:09:28 +00:00
vm_unix.c Remove execute permission from the memory allocated by sbrk(). 2009-04-11 22:34:08 +00:00
vm_zeroidle.c Fill in a few sysctl descriptions. 2008-08-03 14:26:15 +00:00
vm.h Add the superpage reservation type. 2007-12-27 17:08:11 +00:00
vnode_pager.c Correct a boundary case error in the management of a page's dirty bits by 2009-06-02 08:02:27 +00:00
vnode_pager.h Do not sleep for vnode lock while holding map lock in vm_fault. Try to 2009-02-08 20:23:46 +00:00