cvs commit: src/sys/amd64/amd64 pmap.c

Alan Cox alc at FreeBSD.org
Sat Nov 19 05:06:33 GMT 2005


alc         2005-11-19 05:06:32 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_6)
    sys/amd64/amd64      pmap.c 
  Log:
  MFC revision 1.517
    When support for 2MB/4MB pages was added in revision 1.148 an error was
    made in pmap_protect(): The pmap's resident count should not be reduced
    unless mappings are removed.
  
    The errant change to the pmap's resident count could result in a later
    pmap_remove() failing to remove any mappings if the errant change has set
    the pmap's resident count to zero.
  
  MFC revision 1.518
    Decouple the unrefing of a page table page from the removal of a pv entry.
    In other words, change pmap_remove_entry() such that it no longer unrefs
    the page table page.  Now, it only removes the pv entry.
  
  MFC revision 1.519
    Eliminate unneeded diagnostic code.
  
  MFC revision 1.520
    Eliminate unneeded diagnostic code.
  
    Eliminate an unused #include.  (Kernel stack allocation and deallocation
    long ago migrated to the machine-independent code.)
  
  MFC revision 1.521
    Simplify the page table page reference counting by pmap_enter()'s change of
    mapping case.
  
    Eliminate a stale comment from pmap_enter().
  
  MFC revision 1.522
    Correct a performance bug in revision 1.462.  The effect of the bug is to
    execute the outer loop in procedures such as pmap_protect() many more times
    than necessary.
  
  MFC revision 1.523
    Introduce pmap_pml4e_to_pdpe() and pmap_pdpe_to_pde() and use them to avoid
    recomputation of the pml4e and pdpe in pmap_copy(), pmap_protect(), and
    pmap_remove().
  
  MFC revision 1.524
    Change pmap_extract() and pmap_extract_and_hold() to use PG_FRAME rather
    than ~PDRMASK to extract the physical address of a superpage from a PDE.
    The use of ~PDRMASK is problematic if the PDE has PG_NX set.  Specifically,
    the PG_NX bit will be included in the physical address if ~PDRMASK is used.
  
  MFC revision 1.525
    Pass the PDE from pmap_remove() to pmap_remove_page() so that the latter
    procedure doesn't have to recompute it.
  
  MFC revision 1.526
    Remedy the following three problems:
  
    1. The amd64 pmap, unlike the i386 pmap, maintains a reference count
       for each page directory (PD) page.  However, in the transformation
       of the i386 pmap into the amd64 pmap, operations, such as
       pmap_copy() and pmap_object_init_pt(), that create 2MB "superpage"
       mappings by setting the PG_PS bit in a PD entry were not modified
       to adjust the underlying PD page's reference count.  Consequently,
       superpage mappings could disappear prematurely.
  
    2. pmap_object_init_pt() could crash or corrupt memory if either the
       virtual address range being mapped crosses a 1GB boundary in the
       virtual address space or nothing is mapped in the 1GB area.
  
    3. When pmap_allocpte() destroys a 2MB "superpage" mapping it does not
       reduce the pmap's resident count accordingly.  It should.  (This
       bug is inherited from i386.)
  
  MFC revision 1.528
    Eliminate unnecessary TLB invalidations by pmap_enter().  Specifically,
    eliminate TLB invalidations when permissions are relaxed, such as when a
    read-only mapping is changed to a read/write mapping.  Additionally,
    eliminate TLB invalidations when bits that are ignored by the hardware,
    such as PG_W ("wired mapping"), are changed.
  
  Revision   Changes    Path
  1.516.2.3  +166 -117  src/sys/amd64/amd64/pmap.c


More information about the cvs-src mailing list