freebsd-dev/sys/i386
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
..
acpica Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. Use 2009-06-10 20:59:32 +00:00
bios Some minor style changes: 2009-05-20 16:29:22 +00:00
compile
conf Enable PRINTF_BUFR_SIZE on i386 and amd64 by default. 2009-06-14 18:01:35 +00:00
cpufreq Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
i386 Long, long ago in r27464 special case code for mapping device-backed 2009-06-14 19:51:43 +00:00
ibcs2 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
include Clobber "cc" instead of using volatile. 2009-06-13 14:30:08 +00:00
isa When using i8254 as the only kernel timer source: 2009-06-09 07:26:52 +00:00
linux Implement accept4 syscall. 2009-06-01 20:48:39 +00:00
pci strict kobj signatures: fix legacy i386 pcib_write_config impl 2009-06-11 17:06:31 +00:00
svr4 Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions 2009-01-31 11:37:21 +00:00
xbox In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
xen Revert my change; reintroduce __gnu89_inline. 2009-06-08 18:23:43 +00:00
Makefile Update entries for building tags. 2007-05-13 18:21:54 +00:00