1. 16 Feb, 2011 36 commits
    • Tejun Heo's avatar
      x86-64, NUMA: Unify emulated distance mapping · e23bba60
      Tejun Heo authored
      NUMA emulation needs to update node distance information.  It did it
      by remapping apicid to PXM mapping, even when amdtopology is being
      used.  There is no reason to go through such convolution.  The generic
      code has all the information necessary to transform the distance table
      to the emulated nid space.
      
      Implement generic distance table transformation in numa_emulation()
      and drop private implementations in srat_64 and amdtopology_64.  This
      makes find_node_by_addr() and fake_physnodes() and related functions
      unnecessary, drop them.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      e23bba60
    • Tejun Heo's avatar
      x86-64, NUMA: Unify emulated apicid -> node mapping transformation · 6b78cb54
      Tejun Heo authored
      NUMA emulation changes node mappings and thus apicid -> node mapping
      needs to be updated accordingly.  srat_64 and amdtopology_64 did this
      separately; however, all the necessary information is the mapping from
      emulated nodes to physical nodes which is available in
      emu_nid_to_phys[].
      
      Implement common __apicid_to_node[] transformation in numa_emulation()
      and drop duplicate implementations.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      6b78cb54
    • Tejun Heo's avatar
      x86-64, NUMA: Emulate directly from numa_meminfo · 1cca5340
      Tejun Heo authored
      NUMA emulation built physnodes[] array which could only represent
      configurations from the physical meminfo and emulated nodes using the
      information.  There's no reason to take this extra level of
      indirection.  Update emulation functions so that they operate directly
      on numa_meminfo.  This simplifies the code and makes emulation layout
      behave better with interleaved physical nodes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      1cca5340
    • Tejun Heo's avatar
      x86-64, NUMA: Wrap node ID during emulation · 775ee85d
      Tejun Heo authored
      Both emulation layout functions - split_nodes[_size]_interleave() -
      didn't wrap emulated nid while laying out the fake nodes and tried to
      avoid interating over the specified number of nodes, which is fragile.
      
      Now that the emulation code generates numa_meminfo, the node memblks
      don't need to be consecutive and emulated node IDs can simply wrap.
      This makes the code more robust and is necessary for updates to better
      handle the cases where the physical nodes are interleaved.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      775ee85d
    • Tejun Heo's avatar
      x86-64, NUMA: Make emulation code build numa_meminfo and share the registration path · c88aea7a
      Tejun Heo authored
      NUMA emulation code built nodes[] array and had its own registration
      path to set up the emulated nodes.  Update it such that it generates
      emulated numa_meminfo and returns control to initmem_init() and shares
      the same registration path with non-emulated cases.
      
      Because {acpi|amd}_fake_nodes() expect nodes[] parameter,
      fake_physnodes() now generates nodes[] from numa_meminfo.  This will
      go away with further updates.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      c88aea7a
    • Tejun Heo's avatar
      x86-64, NUMA: Build and use direct emulated nid -> phys nid mapping · 9d073cae
      Tejun Heo authored
      NUMA emulation copied physical NUMA configuration into physnodes[] and
      used it to reverse-map emulated nodes to physical nodes, which is
      unnecessarily convoluted.  Build emu_nid_to_phys[] array to map
      emulated nids directly to the matching physical nids and use it in
      numa_add_cpu().
      
      physnodes[] will be removed with further patches.
      
      - v2: Build failure when CONFIG_DEBUG_PER_CPU_MAPS due to missing
        local variable definition fixed.  Reported by Ingo.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      9d073cae
    • Tejun Heo's avatar
      x86-64, NUMA: Trivial changes to prepare for emulation updates · d9c515ea
      Tejun Heo authored
      * Separate out numa_add_memblk_to() from numa_add_memblk() so that
        different numa_meminfo can be used.
      
      * Rename cmdline to emu_cmdline.
      
      * Drop @start/last_pfn from numa_emulation() and use max_pfn directly.
      
      This patch doesn't introduce any behavior change.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      d9c515ea
    • Tejun Heo's avatar
      x86-64, NUMA: Implement generic node distance handling · ac7136b6
      Tejun Heo authored
      Node distance either used direct node comparison, ACPI PXM comparison
      or ACPI SLIT table lookup.  This patch implements generic node
      distance handling.  NUMA init methods can call numa_set_distance() to
      set distance between nodes and the common __node_distance()
      implementation will report the set distance.
      
      Due to the way NUMA emulation is implemented, the generic node
      distance handling is used only when emulation is not used.  Later
      patches will update NUMA emulation to use the generic distance
      mechanism.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      ac7136b6
    • Tejun Heo's avatar
      x86-64, NUMA: Kill mem_nodes_parsed · 4697bdcc
      Tejun Heo authored
      With all memory configuration information now carried in numa_meminfo,
      there's no need to keep mem_nodes_parsed separate.  Drop it and use
      numa_nodes_parsed for CPU / memory-less nodes.
      
      A new helper numa_nodemask_from_meminfo() is added to calculate
      memnode mask on the fly which is currently used to set
      node_possible_map.
      
      This simplifies NUMA init methods a bit and removes a source of
      possible inconsistencies.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      4697bdcc
    • Tejun Heo's avatar
      x86-64, NUMA: Rename cpu_nodes_parsed to numa_nodes_parsed · 92d4a437
      Tejun Heo authored
      It's no longer necessary to keep both cpu_nodes_parsed and
      mem_nodes_parsed.  In preparation for merge, rename cpu_nodes_parsed
      to numa_nodes_parsed.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      92d4a437
    • Tejun Heo's avatar
      x86-64, NUMA: Kill numa_nodes[] · 91556237
      Tejun Heo authored
      numa_nodes[] doesn't carry any information which isn't present in
      numa_meminfo.  Each entry is simply min/max range of all the memblks
      for the node.  This is not only redundant but also inaccurate when
      memblks for different nodes interleave - for example,
      find_node_by_addr() can return the wrong nodeid.
      
      Kill numa_nodes[] and always use numa_meminfo instead.
      
      * nodes_cover_memory() is renamed to numa_meminfo_cover_memory() and
        now operations on numa_meminfo and returns bool.
      
      * setup_node_bootmem() needs min/max range.  Compute the range on the
        fly.  setup_node_bootmem() invocation is restructured to use outer
        loop instead of hardcoding the double invocations.
      
      * find_node_by_addr() now operates on numa_meminfo.
      
      * setup_physnodes() builds physnodes[] from memblks.  This will go
        away when emulation code is updated to use struct numa_meminfo.
      
      This patch also makes the following misc changes.
      
      * Clearing of nodes_add[] clearing is converted to memset().
      
      * numa_add_memblk() in amd_numa_init() is moved down a bit for
        consistency.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      91556237
    • Tejun Heo's avatar
      x86-64, NUMA: Add common find_node_by_addr() · a844ef46
      Tejun Heo authored
      srat_64.c and amdtopology_64.c had their own versions of
      find_node_by_addr() which were basically the same.  Add common one in
      numa_64.c and remove the duplicates.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      a844ef46
    • Tejun Heo's avatar
      x86-64, NUMA: consolidate and improve memblk sanity checks · 56e827fb
      Tejun Heo authored
      memblk sanity check was scattered around and incomplete.  Consolidate
      and improve.
      
      * Confliction detection and cutoff_node() logic are moved to
        numa_cleanup_meminfo().
      
      * numa_cleanup_meminfo() clears the unused memblks before returning.
      
      * Check and warn about invalid input parameters in numa_add_memblk().
      
      * Check the maximum number of memblk isn't exceeded in
        numa_add_memblk().
      
      * numa_cleanup_meminfo() is now called before numa_emulation() so that
        the emulation code also uses the cleaned up version.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      56e827fb
    • Tejun Heo's avatar
      x86-64, NUMA: make numa_cleanup_meminfo() prettier · 2e756be4
      Tejun Heo authored
      * Factor out numa_remove_memblk_from().
      
      * Hole detection doesn't need separate start/end.  Calculate start/end
        once.
      
      * Relocate comment.
      
      * Define iterators at the top and remove unnecessary prefix
        increments.
      
      This prepares for further improvements to the function.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      2e756be4
    • Tejun Heo's avatar
      x86-64, NUMA: Separate out numa_cleanup_meminfo() · f9c60251
      Tejun Heo authored
      Separate out numa_cleanup_meminfo() from numa_register_memblks().
      node_possible_map initialization is moved to the top of the split
      numa_register_memblks().
      
      This patch doesn't cause behavior change.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      f9c60251
    • Tejun Heo's avatar
      x86-64, NUMA: Introduce struct numa_meminfo · 97e7b78d
      Tejun Heo authored
      Arrays for memblks and nodeids and their length lived in separate
      variables making things unnecessarily cumbersome.  Introduce struct
      numa_meminfo which contains all memory configuration info.  This patch
      doesn't cause any behavior change.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      97e7b78d
    • Tejun Heo's avatar
      x86-64, NUMA: Remove %NULL @nodeids handling from compute_hash_shift() · 8968dab8
      Tejun Heo authored
      numa_emulation() called compute_hash_shift() with %NULL @nodeids which
      meant identity mapping between index and nodeid.  Make
      numa_emulation() build identity array and drop %NULL @nodeids handling
      from populate_memnodemap() and thus from compute_hash_shift().  This
      is to prepare for transition to using memblks instead.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      8968dab8
    • Tejun Heo's avatar
      x86-64, NUMA: Kill {acpi|amd|dummy}_scan_nodes() · 5d371b08
      Tejun Heo authored
      They are empty now.  Kill them.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      5d371b08
    • Tejun Heo's avatar
      x86-64, NUMA: Unify the rest of memblk registration · fd0435d8
      Tejun Heo authored
      Move the remaining memblk registration logic from acpi_scan_nodes() to
      numa_register_memblks() and initmem_init().
      
      This applies nodes_cover_memory() sanity check, memory node sorting
      and node_online() checking, which were only applied to acpi, to all
      init methods.
      
      As all memblk registration is moved to common code, active range
      clearing is moved to initmem_init() too and removed from bad_srat().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      fd0435d8
    • Tejun Heo's avatar
      x86-64, NUMA: Unify use of memblk in all init methods · 43a662f0
      Tejun Heo authored
      Make both amd and dummy use numa_add_memblk() to describe the detected
      memory blocks.  This allows initmem_init() to call
      numa_register_memblk() regardless of init method in use.  Drop custom
      memory registration codes from amd and dummy.
      
      After this change, memblk merge/cleanup in numa_register_memblks() is
      applied to all init methods.
      
      As this makes compute_hash_shift() and numa_register_memblks() used
      only inside numa_64.c, make them static.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      43a662f0
    • Tejun Heo's avatar
      x86-64, NUMA: Factor out memblk handling into numa_{add|register}_memblk() · ef396ec9
      Tejun Heo authored
      Factor out memblk handling from srat_64.c into two functions in
      numa_64.c.  This patch doesn't introduce any behavior change.  The
      next patch will make all init methods use these functions.
      
      - v2: Fixed build failure on 32bit due to misplaced NR_NODE_MEMBLKS.
            Reported by Ingo.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      ef396ec9
    • Tejun Heo's avatar
      x86-64, NUMA: Kill {acpi|amd}_get_nodes() · 19095548
      Tejun Heo authored
      With common numa_nodes[], common code in numa_64.c can access it
      directly.  Copy directly and kill {acpi|amd}_get_nodes().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      19095548
    • Tejun Heo's avatar
      x86-64, NUMA: Use common numa_nodes[] · 206e4208
      Tejun Heo authored
      ACPI and amd are using separate nodes[] array.  Add numa_nodes[] and
      use them in all NUMA init methods.  cutoff_node() cleanup is moved
      from srat_64.c to numa_64.c and applied in initmem_init() regardless
      of init methods.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      206e4208
    • Tejun Heo's avatar
      x86-64, NUMA: Move apicid to numa mapping initialization from amd_scan_nodes() to amd_numa_init() · 45fe6c78
      Tejun Heo authored
      This brings amd initialization behavior closer to that of acpi.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      45fe6c78
    • Tejun Heo's avatar
      x86-64, NUMA: Remove local variable found from amd_numa_init() · 99df738c
      Tejun Heo authored
      Use weight count on mem_nodes_parsed instead.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      99df738c
    • Tejun Heo's avatar
      x86-64, NUMA: Use common {cpu|mem}_nodes_parsed · ec8cf29b
      Tejun Heo authored
      ACPI and amd are using separate nodes_parsed masks.  Add
      {cpu|mem}_nodes_parsed and use them in all NUMA init methods.
      Initialization of the masks and building node_possible_map are now
      handled commonly by initmem_init().
      
      dummy_numa_init() is updated to set node 0 on both masks.  While at
      it, move the info messages from scan to init.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      ec8cf29b
    • Tejun Heo's avatar
      x86-64, NUMA: Restructure initmem_init() · ffe77a46
      Tejun Heo authored
      Reorganize initmem_init() such that,
      
      * Different NUMA init methods are iterated in a consistent way.
      
      * Each iteration re-initializes all the parameters and different
        method can be tried after a failure.
      
      * Dummy init is handled the same as other methods.
      
      Apart from how retry after failure, this patch doesn't change the
      behavior.  The call sequences are kept equivalent across the
      conversion.
      
      After the change, bad_srat() doesn't need to clear apic to node
      mapping or worry about numa_off.  Simplified accordingly.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      ffe77a46
    • Tejun Heo's avatar
      x86, NUMA: Move *_numa_init() invocations into initmem_init() · d8fc3afc
      Tejun Heo authored
      There's no reason for these to live in setup_arch().  Move them inside
      initmem_init().
      
      - v2: x86-32 initmem_init() weren't updated breaking 32bit builds.
        Fixed.  Found by Ankita.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Ankita Garg <ankita@in.ibm.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      d8fc3afc
    • Tejun Heo's avatar
      x86-64, NUMA: Wrap acpi_numa_init() so that failure can be indicated by return value · a9aec56a
      Tejun Heo authored
      Because of the way ACPI tables are parsed, the generic
      acpi_numa_init() couldn't return failure when error was detected by
      arch hooks.  Instead, the failure state was recorded and later arch
      dependent init hook - acpi_scan_nodes() - would fail.
      
      Wrap acpi_numa_init() with x86_acpi_numa_init() so that failure can be
      indicated as return value immediately.  This is in preparation for
      further NUMA init cleanups.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      a9aec56a
    • Tejun Heo's avatar
      x86-64, NUMA: Unify {acpi|amd}_{numa_init|scan_nodes}() arguments and return values · 940fed2e
      Tejun Heo authored
      The functions used during NUMA initialization - *_numa_init() and
      *_scan_nodes() - have different arguments and return values.  Unify
      them such that they all take no argument and return 0 on success and
      -errno on failure.  This is in preparation for further NUMA init
      cleanups.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      940fed2e
    • Tejun Heo's avatar
      x86, NUMA: Drop @start/last_pfn from initmem_init() · 86ef4dbf
      Tejun Heo authored
      initmem_init() extensively accesses and modifies global data
      structures and the parameters aren't even followed depending on which
      path is being used.  Drop @start/last_pfn and let it deal with
      @max_pfn directly.  This is in preparation for further NUMA init
      cleanups.
      
      - v2: x86-32 initmem_init() weren't updated breaking 32bit builds.
        Fixed.  Found by Yinghai.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      86ef4dbf
    • Tejun Heo's avatar
      x86-64, NUMA: Simplify hotplug node handling in acpi_numa_memory_affinity_init() · 13081df5
      Tejun Heo authored
      Hotplug node handling in acpi_numa_memory_affinity_init() was
      unnecessarily complicated with storing the original nodes[] entry and
      restoring it afterwards.  Simplify it by not modifying the nodes[]
      entry for hotplug nodes from the beginning.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      13081df5
    • Tejun Heo's avatar
      x86-64, NUMA: Make dummy node initialization path similar to non-dummy ones · 7d36b7bc
      Tejun Heo authored
      Dummy node initialization in initmem_init() didn't initialize apicid
      to node mapping and set cpu to node mapping directly by caling
      numa_set_node(), which is different from non-dummy init paths.
      
      Update it such that they behave similarly.  Initialize apicid to node
      mapping and call numa_init_array().  The actual cpu to node mapping is
      handled by init_cpu_to_node() later.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Cyrill Gorcunov <gorcunov@gmail.com>
      Cc: Shaohui Zheng <shaohui.zheng@intel.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@linux.intel.com>
      7d36b7bc
    • Ingo Molnar's avatar
      Merge branch 'x86/amd-nb' into x86/mm · 275a88d3
      Ingo Molnar authored
      Merge reason: consolidate it into the more generic x86/mm tree to prevent conflicts
                    with ongoing NUMA work.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      275a88d3
    • Ingo Molnar's avatar
      Merge branch 'x86/numa' into x86/mm · 52b8b8d7
      Ingo Molnar authored
      Merge reason: consolidate it into the more generic x86/mm tree to prevent conflicts.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      52b8b8d7
    • Ingo Molnar's avatar
      Merge branch 'x86/bootmem' into x86/mm · 02ac81a8
      Ingo Molnar authored
      Merge reason: the topic is ready - consolidate it into the more generic x86/mm tree
                    and prevent conflicts.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      02ac81a8
  2. 15 Feb, 2011 1 commit
    • Borislav Petkov's avatar
      x86, amd: Initialize variable properly · 9e81509e
      Borislav Petkov authored
      Commit d518573d ("x86, amd: Normalize compute unit IDs on
      multi-node processors") introduced compute unit normalization
      but causes a compiler warning:
      
       arch/x86/kernel/cpu/amd.c: In function 'amd_detect_cmp':
       arch/x86/kernel/cpu/amd.c:268: warning: 'cores_per_cu' may be used uninitialized in this function
       arch/x86/kernel/cpu/amd.c:268: note: 'cores_per_cu' was declared here
      
      The compiler is right - initialize it with a proper value.
      
      Also, fix up a comment while at it.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
      Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
      LKML-Reference: <20110214171451.GB10076@kryptos.osrc.amd.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9e81509e
  3. 14 Feb, 2011 3 commits