freebsd-dev/sys/amd64
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 Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
amd64 Long, long ago in r27464 special case code for mapping device-backed 2009-06-14 19:51:43 +00:00
compile
conf Enable PRINTF_BUFR_SIZE on i386 and amd64 by default. 2009-06-14 18:01:35 +00:00
ia32 Save and restore segment registers on amd64 when entering and leaving 2009-04-01 13:09:26 +00:00
include Now that amd64's kernel map is 512GB (SVN rev 192216), there is no reason 2009-06-08 16:43:40 +00:00
isa Unbreak the build for amd64 after r193814 using correct variable names. 2009-06-09 09:47:02 +00:00
linux32 Implement accept4 syscall. 2009-06-01 20:48:39 +00:00
pci Add a read-only sysctl hw.pci.mcfg to mirror the tunable by the same name. 2009-05-18 21:47:32 +00:00
Makefile