File:  [NetBSD Developer Wiki] / wikisrc / features / uvm_hotplug.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Thu Dec 29 16:59:58 2016 UTC (5 years, 8 months ago) by cherry
Branches: MAIN
CVS tags: HEAD
Formatting.

    1: # [[!template id=man name=uvm_hotplug section=9]] port-masters' FAQ.
    2: 
    3:   1. Why does it matter?
    4: 
    5:      As a port maintainer any architecture that needs to use the virtual memory
    6:      sub-system of NetBSD aka uvm is affected by the
    7:      [[!template id=man name=uvm_hotplug section=9]] change.
    8: 
    9:      Early boot code of every port is affected. Global variables:
   10:      struct vm_physseg vm_physmem;
   11:      int vm_nphysmem;
   12:      are no longer visible. They need to be replaced by appropriate
   13:      accessor calls in [[!template id=man name=uvm_hotplug section=9]]
   14: 
   15:      These calls are documented as "Utility Functions" in the
   16:      [[!template id=man name=uvm_hotplug section=9]] manual.
   17: 
   18:      The "switchover" CVS commit log is here:
   19:      [http://mail-index.netbsd.org/source-changes/2016/12/23/msg080110.html](http://mail-index.netbsd.org/source-changes/2016/12/23/msg080110.html)
   20: 
   21:   2. What files may be affected?
   22: 
   23:      In most of the architectures the "sys/arch/<arch_name>/<arch_name>/machdep.c"
   24:      and "sys/arch/<arch_name>/<arch_name>/pmap.c" if they exist are usually
   25:      affected.
   26: 
   27:      But this may not be a exhaustive list. Any other files that deals with pmap and
   28:      stealing pages might also be affected.
   29: 
   30:   3. What does it do ?
   31: 
   32:      [[!template id=man name=uvm_hotplug section=9]] manages the previously exposed "vm_physmem" static array which
   33:      used to keep track of the memory segments.
   34: 
   35:      In the current implementation, the array has been replaced with a
   36:      [[!template id=man name=rbtree section=3]] backing which makes the
   37:      data structure dynamic.
   38: 
   39:      An array based implementation is also provided, for backwards
   40:      compatibility. This is the default implementation and does not provide
   41:      hot pluggability. It is also used without 'options UVM_HOTPLUG'
   42:      However the API itself is implementation agnostic.
   43: 
   44:   4. Why is it needed?
   45: 
   46:      With the [[!template id=man name=rbtree section=3]] backing
   47:      implementation, the list of physical pages 
   48:      in the system is no longer in a static array and can dynamically
   49:      expand or collapse, hence adding new pages to the freelist from newly
   50:      available RAM / physical memory (plug) or removing retired pages
   51:      (unplug) via taking them off the freelist and the old vm_physmem.
   52: 
   53:   5. What should I do?
   54: 
   55:      Review the changes to your port due to this new feature. The changes
   56:      may have been made without direct knowledge of your port architecture.
   57: 
   58:      See if your port has hotpluggable hardware. If it does, write a driver
   59:      to use the [[!template id=man name=uvm_hotplug section=9]] api.
   60: 
   61:      An example of [[!template id=man name=uvm_hotplug section=9]] api's
   62:      application can be found in
   63:      [[!template id=man name=balloon section=4]].

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb