Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jun 2009 19:51:43 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/amd64/amd64 pmap.c src/sys/i386/i386 pmap.c src/sys/vm vm_object.c vm_object.h
Message-ID:  <200906141952.n5EJqeLC070501@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
alc         2009-06-14 19:51:43 UTC

  FreeBSD src repository

  Modified files:
    sys/amd64/amd64      pmap.c 
    sys/i386/i386        pmap.c 
    sys/vm               vm_object.c vm_object.h 
  Log:
  SVN rev 194209 on 2009-06-14 19:51:43Z by alc
  
  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@
  
  Revision  Changes    Path
  1.661     +45 -49    src/sys/amd64/amd64/pmap.c
  1.638     +36 -41    src/sys/i386/i386/pmap.c
  1.404     +49 -0     src/sys/vm/vm_object.c
  1.118     +1 -0      src/sys/vm/vm_object.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906141952.n5EJqeLC070501>