x86/mm changes for v2.6.40
Subsystems (4)
Linus,
Please pull the latest x86-mm-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-mm-for-linus
In hindsight this commit should have gone through the ACPI tree:
out-of-topic modifications in x86-mm-for-linus:
-----------------------------------------------
drivers/acpi/processor_throttling.c# 9d42a53: acpi throttling: Use this_cpu_has
Thanks,
Ingo
------------------>
Christoph Lameter (3):
x86: A fast way to check capabilities of the current cpu
x86: Use this_cpu_has for thermal_interrupt current cpu acpi throttling: Use this_cpu_has and simplify code current cpu
David Rientjes (1):
x86, mm: Allow ZONE_DMA to be configurable
Florian Mickler (1):
x86-64, NUMA: Remove unused variable
Rakib Mullick (1):
x86, mpparse: Put check_slot() into .init section
Tejun Heo (41):
x86-64, NUMA: Remove custom phys_to_nid() implementation
x86: Clean up memory model related configs in arch/x86/Kconfig x86-32, numa: Fix failure condition check in alloc_remap() x86-32, numa: Align pgdat size while initializing alloc_remap x86-32, numa: Remove redundant top-down alloc code from remap initialization x86-32, numa: Reorganize calculate_numa_remap_page()
x86-32, numa: Rename @node_kva to @node_pa in init_alloc_remap() x86-32, numa: Make @size in init_aloc_remap() represent bytes x86-32, numa: Calculate remap size in common code
x86-32, numa: Make init_alloc_remap() less panicky
x86-32, numa: Move lowmem address space reservation to init_alloc_remap() x86-32, numa: Move remapping for remap allocator into init_alloc_remap() x86-32, numa: Make pgdat allocation use alloc_remap()
x86-32, numa: Remove now useless node_remap_offset[]
x86-32, numa: Remove redundant node_remap_size[]
x86-32, numa: Update remap allocator comments
x86-64, NUMA: Simplify hotadd memory handling
x86-64, NUMA: trivial cleanups for setup_node_bootmem()
x86-64, NUMA: simplify nodedata allocation
x86-32, NUMA: Automatically set apicid -> node in setup_local_APIC() x86, NUMA: Unify 32/64bit numa_cpu_node() implementation x86-32, NUMA: Make apic->x86_32_numa_cpu_node() optional x86-32, NUMA: use sparse_memory_present_with_active_regions() x86, NUMA: trivial cleanups
x86, NUMA: rename srat_64.c to srat.c
x86, NUMA: make srat.c 32bit safe
x86-32, NUMA: Move get_memcfg_numa() into numa_32.c
x86, NUMA: Move numa_nodes_parsed to numa.[hc]
x86-32, NUMA: implement temporary NUMA init shims
x86-32, NUMA: Replace srat_32.c with srat.c
x86-32, NUMA: Update numaq to use new NUMA init protocol
x86, NUMA: Move NUMA init logic from numa_64.c to numa.c
x86, NUMA: Enable build of generic NUMA init code on 32bit
x86, NUMA: Remove long 64bit assumption from numa.c
x86-32, NUMA: Add @start and @end to init_alloc_remap()
x86, NUMA: Initialize and use remap allocator from setup_node_bootmem() x86, NUMA: Make 32bit use common NUMA init path
x86, NUMA: Make numa_init_array() static
x86, NUMA: Rename amdtopology_64.c to amdtopology.c
x86, NUMA: Enable CONFIG_AMD_NUMA on 32bit too
x86, NUMA: Enable emulation on 32bit too
Tim Gardner (1):
ioremap: Delay sanity check until after a successful mapping
Yinghai Lu (2):
x86, NUMA: Rename setup_node_bootmem() to setup_node_data() x86, NUMA: Trim numa meminfo with max_pfn in a separate loop
arch/x86/Kconfig | 43 +-
arch/x86/include/asm/acpi.h | 2 -
arch/x86/include/asm/amd_nb.h | 1 -
arch/x86/include/asm/apic.h | 9 +-
arch/x86/include/asm/cpufeature.h | 13 +-
arch/x86/include/asm/dma.h | 12 +-
arch/x86/include/asm/mmzone_32.h | 20 -
arch/x86/include/asm/mmzone_64.h | 23 -
arch/x86/include/asm/numa.h | 32 +-
arch/x86/include/asm/numa_32.h | 10 -
arch/x86/include/asm/numa_64.h | 36 --
arch/x86/include/asm/numaq.h | 7 +-
arch/x86/include/asm/percpu.h | 27 +
arch/x86/include/asm/srat.h | 39 --
arch/x86/include/asm/topology.h | 8 -
arch/x86/kernel/apic/apic.c | 28 +-
arch/x86/kernel/apic/apic_noop.c | 9 -
arch/x86/kernel/apic/bigsmp_32.c | 1 -
arch/x86/kernel/apic/es7000_32.c | 7 -
arch/x86/kernel/apic/numaq_32.c | 34 +-
arch/x86/kernel/apic/probe_32.c | 1 -
arch/x86/kernel/apic/summit_32.c | 1 -
arch/x86/kernel/cpu/mcheck/therm_throt.c | 7 +-
arch/x86/kernel/mpparse.c | 2 +-
arch/x86/kernel/process.c | 4 +-
arch/x86/kernel/smpboot.c | 4 +-
arch/x86/mm/Makefile | 4 +-
arch/x86/mm/{amdtopology_64.c => amdtopology.c} | 21 +-
arch/x86/mm/init_32.c | 3 +
arch/x86/mm/init_64.c | 10 +-
arch/x86/mm/ioremap.c | 14 +-
arch/x86/mm/numa.c | 550 +++++++++++++++++++-
arch/x86/mm/numa_32.c | 398 ++++-----------
arch/x86/mm/numa_64.c | 644 +----------------------
arch/x86/mm/numa_emulation.c | 16 +-
arch/x86/mm/numa_internal.h | 8 +
arch/x86/mm/{srat_64.c => srat.c} | 82 +---
arch/x86/mm/srat_32.c | 288 ----------
drivers/acpi/processor_throttling.c | 32 +-
39 files changed, 836 insertions(+), 1614 deletions(-)
delete mode 100644 arch/x86/include/asm/srat.h
rename arch/x86/mm/{amdtopology_64.c => amdtopology.c} (90%)
rename arch/x86/mm/{srat_64.c => srat.c} (67%)
delete mode 100644 arch/x86/mm/srat_32.carch/x86/Kconfig +23 -20
@@ -112,7 +112,14 @@ config MMU def_bool y config ZONE_DMA - def_bool y + bool "DMA memory allocation support" if EXPERT + default y + help + DMA memory allocation support allows devices with less than 32-bit + addressing to allocate within the first 16MB of address space. + Disable if no such devices will be used. + + If unsure, say Y. config SBUS bool
@@ -1174,7 +1181,7 @@ comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" config AMD_NUMA def_bool y prompt "Old style AMD Opteron NUMA detection" - depends on X86_64 && NUMA && PCI + depends on NUMA && PCI ---help--- Enable AMD NUMA node topology detection. You should say Y here if you have a multi processor AMD system. This uses an old method to
@@ -1201,7 +1208,7 @@ config NODES_SPAN_OTHER_NODES config NUMA_EMU bool "NUMA emulation" - depends on X86_64 && NUMA + depends on NUMA ---help--- Enable NUMA emulation. A flat machine will be split into virtual nodes when booted with "numa=fake=N", where N is the
@@ -1223,6 +1230,10 @@ config HAVE_ARCH_BOOTMEM def_bool y depends on X86_32 && NUMA +config HAVE_ARCH_ALLOC_REMAP + def_bool y + depends on X86_32 && NUMA + config ARCH_HAVE_MEMORY_PRESENT def_bool y depends on X86_32 && DISCONTIGMEM
@@ -1231,13 +1242,9 @@ config NEED_NODE_MEMMAP_SIZE def_bool y depends on X86_32 && (DISCONTIGMEM || SPARSEMEM) -config HAVE_ARCH_ALLOC_REMAP - def_bool y - depends on X86_32 && NUMA - config ARCH_FLATMEM_ENABLE def_bool y - depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && !NUMA + depends on X86_32 && !NUMA config ARCH_DISCONTIGMEM_ENABLE def_bool y
@@ -1247,20 +1254,16 @@ config ARCH_DISCONTIGMEM_DEFAULT def_bool y depends on NUMA && X86_32 -config ARCH_PROC_KCORE_TEXT - def_bool y - depends on X86_64 && PROC_KCORE - -config ARCH_SPARSEMEM_DEFAULT - def_bool y - depends on X86_64 - config ARCH_SPARSEMEM_ENABLE def_bool y depends on X86_64 || NUMA || (EXPERIMENTAL && X86_32) || X86_32_NON_STANDARD select SPARSEMEM_STATIC if X86_32 select SPARSEMEM_VMEMMAP_ENABLE if X86_64 +config ARCH_SPARSEMEM_DEFAULT + def_bool y + depends on X86_64 + config ARCH_SELECT_MEMORY_MODEL def_bool y depends on ARCH_SPARSEMEM_ENABLE
@@ -1269,6 +1272,10 @@ config ARCH_MEMORY_PROBE def_bool X86_64 depends on MEMORY_HOTPLUG +config ARCH_PROC_KCORE_TEXT + def_bool y + depends on X86_64 && PROC_KCORE + config ILLEGAL_POINTER_VALUE hex default 0 if X86_32
@@ -1703,10 +1710,6 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE def_bool y depends on MEMORY_HOTPLUG -config HAVE_ARCH_EARLY_PFN_TO_NID - def_bool X86_64 - depends on NUMA - config USE_PERCPU_NUMA_NODE_ID def_bool y depends on NUMA
arch/x86/include/asm/acpi.h +0 -2
@@ -183,8 +183,6 @@ static inline void disable_acpi(void) { }#define ARCH_HAS_POWER_INIT 1 -struct bootnode ; -#ifdef CONFIG_ACPI_NUMA extern int acpi_numa;extern int x86_acpi_numa_init (void );
arch/x86/include/asm/amd_nb.h +0 -1
@@ -11,7 +11,6 @@ struct amd_nb_bus_dev_range {extern const struct pci_device_id amd_nb_misc_ids[];extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[]; -struct bootnode ;extern bool early_is_amd_nb (u32 value);extern int amd_cache_northbridges (void );
arch/x86/include/asm/apic.h +6 -3
@@ -363,7 +363,12 @@ struct apic {*/ int (*x86_32_early_logical_apicid)(int cpu); -/* determine CPU -> NUMA node mapping */ +/* +* Optional method called from setup_local_APIC() after logical +* apicid is guaranteed to be known to initialize apicid -> node +* mapping if NUMA initialization hasn't done so already. Don't +* add new users. +*/ int (*x86_32_numa_cpu_node)(int cpu);#endif };
@@ -537,8 +542,6 @@ static inline int default_phys_pkg_id(int cpuid_apic, int index_msb)return cpuid_apic >> index_msb; } -extern int default_x86_32_numa_cpu_node (int cpu); -#endif static inline unsigned int
arch/x86/include/asm/cpufeature.h +9 -4
@@ -207,8 +207,7 @@ extern const char * const x86_power_flags[32];#define test_cpu_cap (c, bit) \ test_bit(bit, (unsigned long *)((c)->x86_capability)) -#define cpu_has (c, bit) \ - (__builtin_constant_p(bit) && \ +#define REQUIRED_MASK_BIT_SET (bit) \ ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \ (((bit)>>5)==1 && (1UL<<((bit)&31) & REQUIRED_MASK1)) || \ (((bit)>>5)==2 && (1UL<<((bit)&31) & REQUIRED_MASK2)) || \
@@ -218,10 +217,16 @@ extern const char * const x86_power_flags[32]; (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \ (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) || \ (((bit)>>5)==8 && (1UL<<((bit)&31) & REQUIRED_MASK8)) || \ - (((bit)>>5)==9 && (1UL<<((bit)&31) & REQUIRED_MASK9)) ) \ - ? 1 : \ + (((bit)>>5)==9 && (1UL<<((bit)&31) & REQUIRED_MASK9)) ) + +#define cpu_has (c, bit) \ + (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ test_cpu_cap(c, bit)) +#define this_cpu_has (bit) \ + (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ + x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability)) +#define boot_cpu_has (bit) cpu_has(&boot_cpu_data, bit)#define set_cpu_cap (c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability))
arch/x86/include/asm/dma.h +4 -8
@@ -69,22 +69,18 @@#define MAX_DMA_CHANNELS 8 -#ifdef CONFIG_X86_32 - -/* The maximum address that we can perform a DMA transfer to on this platform */ -#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x1000000) - -#else -/* 16MB ISA DMA zone */ #define MAX_DMA_PFN ((16 * 1024 * 1024) >> PAGE_SHIFT)/* 4GB broken PCI/AGP hardware bus master zone */ #define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT) +#ifdef CONFIG_X86_32 +/* The maximum address that we can perform a DMA transfer to on this platform */ +#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x1000000) +#else /* Compat define for old dma zone */ #define MAX_DMA_ADDRESS ((unsigned long)__va(MAX_DMA_PFN << PAGE_SHIFT)) -#endif /* 8237 DMA controllers */
arch/x86/include/asm/mmzone_32.h +0 -20
@@ -13,31 +13,11 @@ extern struct pglist_data *node_data[];#define NODE_DATA (nid) (node_data[nid])#include <asm/numaq.h> -/* summit or generic arch */ -#include <asm/srat.h> - -extern int get_memcfg_numa_flat (void ); -/* -* This allows any one NUMA architecture to be compiled -* for, and still fall back to the flat function if it -* fails. -*/ -static inline void get_memcfg_numa (void ) -{ - -if (get_memcfg_numaq ()) -return ; -if (get_memcfg_from_srat ()) -return ; -get_memcfg_numa_flat (); -}extern void resume_map_numa_kva (pgd_t *pgd);#else /* !CONFIG_NUMA */ -#define get_memcfg_numa get_memcfg_numa_flat -static inline void resume_map_numa_kva (pgd_t *pgd) {}#endif /* CONFIG_NUMA */
arch/x86/include/asm/mmzone_64.h +0 -23
@@ -4,36 +4,13 @@#ifndef _ASM_X86_MMZONE_64_H#define _ASM_X86_MMZONE_64_H -#ifdef CONFIG_NUMA #include <linux/mmdebug.h> -#include <asm/smp.h> -/* Simple perfect hash to map physical addresses to node numbers */ -struct memnode { -int shift; -unsigned int mapsize; -s16 *map; -s16 embedded_map[64 -8 ]; -}____cacheline_aligned ;/* total size = 128 bytes */ -extern struct memnode memnode; -#define memnode_shift memnode.shift -#define memnodemap memnode.map -#define memnodemapsize memnode.mapsize -extern struct pglist_data *node_data[]; -static inline __attribute__((pure))int phys_to_nid (unsigned long addr) -{ -unsigned nid; -VIRTUAL_BUG_ON (!memnodemap); - nid = memnodemap[addr >> memnode_shift]; -VIRTUAL_BUG_ON (nid >=MAX_NUMNODES || !node_data[nid]); -return nid; -} -#define NODE_DATA (nid) (node_data[nid])#define node_start_pfn (nid) (NODE_DATA(nid)->node_start_pfn)
arch/x86/include/asm/numa.h +30 -2
@@ -1,12 +1,24 @@#ifndef _ASM_X86_NUMA_H#define _ASM_X86_NUMA_H +#include <linux/nodemask.h> +#include <asm/topology.h> #include <asm/apicdef.h> #ifdef CONFIG_NUMA #define NR_NODE_MEMBLKS (MAX_NUMNODES*2) +#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) + +/* +* Too small node sizes may confuse the VM badly. Usually they +* result from BIOS bugs. So dont recognize nodes as standalone +* NUMA entities that have less than this amount of RAM listed: +*/ +#define NODE_MIN_SIZE (4*1024*1024) + +extern int numa_off;/* * __apicid_to_node[] stores the raw mapping between physical apicid and
@@ -17,15 +29,27 @@* numa_cpu_node(). */ extern s16 __apicid_to_node[MAX_LOCAL_APIC ]; +extern nodemask_t numa_nodes_parsed__initdata ; + +extern int __init numa_add_memblk (int nodeid,u64 start,u64 end); +extern void __init numa_set_distance (int from,int to,int distance);static inline void set_apicid_to_node (int apicid,s16 node) { __apicid_to_node[apicid] = node; } + +extern int __cpuinit numa_cpu_node (int cpu); +#else /* CONFIG_NUMA */ static inline void set_apicid_to_node (int apicid,s16 node) { } + +static inline int numa_cpu_node (int cpu) +{ +return NUMA_NO_NODE ; +}#endif /* CONFIG_NUMA */ #ifdef CONFIG_X86_32
@@ -37,14 +61,12 @@ static inline void set_apicid_to_node(int apicid, s16 node)#ifdef CONFIG_NUMA extern void __cpuinit numa_set_node (int cpu,int node);extern void __cpuinit numa_clear_node (int cpu); -extern void __init numa_init_array (void );extern void __init init_cpu_to_node (void );extern void __cpuinit numa_add_cpu (int cpu);extern void __cpuinit numa_remove_cpu (int cpu);#else /* CONFIG_NUMA */ static inline void numa_set_node (int cpu,int node) { }static inline void numa_clear_node (int cpu) { } -static inline void numa_init_array (void ) { }static inline void init_cpu_to_node (void ) { }static inline void numa_add_cpu (int cpu) { }static inline void numa_remove_cpu (int cpu) { }
@@ -54,4 +76,10 @@ static inline void numa_remove_cpu(int cpu) { }void debug_cpumask_set_cpu (int cpu,int node,bool enable);#endif +#ifdef CONFIG_NUMA_EMU +#define FAKE_NODE_MIN_SIZE ((u64)32 << 20) +#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) +void numa_emu_cmdline (char *); +#endif /* CONFIG_NUMA_EMU */ +#endif /* _ASM_X86_NUMA_H */
arch/x86/include/asm/numa_32.h +0 -10
@@ -1,16 +1,6 @@#ifndef _ASM_X86_NUMA_32_H#define _ASM_X86_NUMA_32_H -extern int numa_off; - -extern int pxm_to_nid (int pxm); - -#ifdef CONFIG_NUMA -extern int __cpuinit numa_cpu_node (int cpu); -#else /* CONFIG_NUMA */ -static inline int numa_cpu_node (int cpu) {return NUMA_NO_NODE ; } -#endif /* CONFIG_NUMA */ -#ifdef CONFIG_HIGHMEM extern void set_highmem_pages_init (void );#else
arch/x86/include/asm/numa_64.h +0 -36
@@ -1,42 +1,6 @@#ifndef _ASM_X86_NUMA_64_H#define _ASM_X86_NUMA_64_H -#include <linux/nodemask.h> - -struct bootnode { -u64 start; -u64 end; -}; - -#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT)) - -extern int numa_off; -extern unsigned long numa_free_all_bootmem (void ); -extern void setup_node_bootmem (int nodeid,unsigned long start, -unsigned long end); - -#ifdef CONFIG_NUMA -/* -* Too small node sizes may confuse the VM badly. Usually they -* result from BIOS bugs. So dont recognize nodes as standalone -* NUMA entities that have less than this amount of RAM listed: -*/ -#define NODE_MIN_SIZE (4*1024*1024) - -extern nodemask_t numa_nodes_parsed__initdata ; - -extern int __cpuinit numa_cpu_node (int cpu); -extern int __init numa_add_memblk (int nodeid,u64 start,u64 end); -extern void __init numa_set_distance (int from,int to,int distance); - -#ifdef CONFIG_NUMA_EMU -#define FAKE_NODE_MIN_SIZE ((u64)32 << 20) -#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) -void numa_emu_cmdline (char *); -#endif /* CONFIG_NUMA_EMU */ -#else -static inline int numa_cpu_node (int cpu) {return NUMA_NO_NODE ; } -#endif #endif /* _ASM_X86_NUMA_64_H */
arch/x86/include/asm/numaq.h +1 -6
@@ -29,7 +29,7 @@#ifdef CONFIG_X86_NUMAQ extern int found_numaq; -extern int get_memcfg_numaq (void ); +extern int numaq_numa_init (void );extern int pci_numaq_init (void );extern void *xquad_portio;
@@ -166,11 +166,6 @@ struct sys_cfg_data {void numaq_tsc_disable (void ); -#else -static inline int get_memcfg_numaq (void ) -{ -return 0 ; -}#endif /* CONFIG_X86_NUMAQ */ #endif /* _ASM_X86_NUMAQ_H */
arch/x86/include/asm/percpu.h +27 -0
@@ -542,6 +542,33 @@ do { \ old__; \ }) +static __always_inline int x86_this_cpu_constant_test_bit(unsigned int nr, +const unsigned long __percpu *addr) +{ +unsigned long __percpu *a = (unsigned long *)addr + nr /BITS_PER_LONG ; + +return ((1UL << (nr %BITS_PER_LONG )) &percpu_read (*a)) !=0 ; +} + +static inline int x86_this_cpu_variable_test_bit (int nr, +const unsigned long __percpu *addr) +{ +int oldbit; + + asm volatile("bt "__percpu_arg(2)",%1\n\t" + "sbb %0,%0" + : "=r" (oldbit) + : "m" (*(unsigned long *)addr), "Ir" (nr)); + +return oldbit; +} + +#define x86_this_cpu_test_bit (nr, addr) \ + (__builtin_constant_p((nr)) \ + ? x86_this_cpu_constant_test_bit((nr), (addr)) \ + : x86_this_cpu_variable_test_bit((nr), (addr))) + +#include <asm-generic/percpu.h> /* We can use this directly for local CPU (faster). */
arch/x86/include/asm/srat.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* -* Some of the code in this file has been gleaned from the 64 bit -* discontigmem support code base. -* -* Copyright (C) 2002, IBM Corp. -* -* All rights reserved. -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or -* NON INFRINGEMENT. See the GNU General Public License for more -* details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* -* Send feedback to Pat Gaughen <[email protected]> -*/ - -#ifndef _ASM_X86_SRAT_H -#define _ASM_X86_SRAT_H - -#ifdef CONFIG_ACPI_NUMA -extern int get_memcfg_from_srat (void ); -#else -static inline int get_memcfg_from_srat (void ) -{ -return 0 ; -} -#endif - -#endif /* _ASM_X86_SRAT_H */
arch/x86/include/asm/topology.h +0 -8
@@ -93,19 +93,11 @@ extern void setup_node_to_cpumask_map(void);#define pcibus_to_node (bus) __pcibus_to_node(bus)#ifdef CONFIG_X86_32 -extern unsigned long node_start_pfn[]; -extern unsigned long node_end_pfn[]; -extern unsigned long node_remap_size[]; -#define node_has_online_mem (nid) (node_start_pfn[nid] != node_end_pfn[nid]) -# define SD_CACHE_NICE_TRIES 1# define SD_IDLE_IDX 1 -#else -# define SD_CACHE_NICE_TRIES 2# define SD_IDLE_IDX 2 -#endif /* sched_domains SD_NODE_INIT for NUMA machines */
arch/x86/kernel/apic/apic.c +12 -16
@@ -505,7 +505,7 @@ static void __cpuinit setup_APIC_timer(void) {struct clock_event_device *levt = &__get_cpu_var (lapic_events); -if (cpu_has (__this_cpu_ptr (&cpu_info),X86_FEATURE_ARAT )) { +if (this_cpu_has (X86_FEATURE_ARAT )) { lapic_clockevent.features &= ~CLOCK_EVT_FEAT_C3STOP ;/* Make LAPIC timer preferrable over percpu HPET */ lapic_clockevent.rating =150 ;
@@ -1237,6 +1237,17 @@ void __cpuinit setup_local_APIC(void)/* always use the value from LDR */ early_per_cpu (x86_cpu_to_logical_apicid, cpu) =logical_smp_processor_id (); + +/* +* Some NUMA implementations (NUMAQ) don't initialize apicid to +* node mapping during NUMA init. Now that logical apicid is +* guaranteed to be known, give it another chance. This is already +* a bit too late - percpu allocation has already happened without +* proper NUMA affinity. +*/ +if (apic->x86_32_numa_cpu_node) +set_apicid_to_node (early_per_cpu (x86_cpu_to_apicid, cpu), + apic->x86_32_numa_cpu_node (cpu));#endif /*
@@ -2003,21 +2014,6 @@ void default_init_apic_ldr(void)apic_write (APIC_LDR , val); } -#ifdef CONFIG_X86_32 -int default_x86_32_numa_cpu_node (int cpu) -{ -#ifdef CONFIG_NUMA -int apicid =early_per_cpu (x86_cpu_to_apicid, cpu); - -if (apicid !=BAD_APICID ) -return __apicid_to_node[apicid]; -return NUMA_NO_NODE ; -#else -return 0 ; -#endif -} -#endif -/* * Power management */
arch/x86/kernel/apic/apic_noop.c +0 -9
@@ -119,14 +119,6 @@ static void noop_apic_write(u32 reg, u32 v)WARN_ON_ONCE (cpu_has_apic && !disable_apic); } -#ifdef CONFIG_X86_32 -static int noop_x86_32_numa_cpu_node (int cpu) -{ -/* we're always on node 0 */ -return 0 ; -} -#endif -struct apic apic_noop = { .name ="noop" , .probe = noop_probe,
@@ -195,6 +187,5 @@ struct apic apic_noop = {#ifdef CONFIG_X86_32 .x86_32_early_logical_apicid = noop_x86_32_early_logical_apicid, - .x86_32_numa_cpu_node = noop_x86_32_numa_cpu_node,#endif };
arch/x86/kernel/apic/bigsmp_32.c +0 -1
@@ -253,5 +253,4 @@ struct apic apic_bigsmp = { .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, .x86_32_early_logical_apicid = bigsmp_early_logical_apicid, - .x86_32_numa_cpu_node = default_x86_32_numa_cpu_node, };
arch/x86/kernel/apic/es7000_32.c +0 -7
@@ -510,11 +510,6 @@ static void es7000_setup_apic_routing(void) nr_ioapics, cpumask_bits(es7000_target_cpus())[0]); } -static int es7000_numa_cpu_node (int cpu) -{ -return 0 ; -} -static int es7000_cpu_present_to_apicid (int mps_cpu) {if (!mps_cpu)
@@ -688,7 +683,6 @@ struct apic __refdata apic_es7000_cluster = { .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, .x86_32_early_logical_apicid = es7000_early_logical_apicid, - .x86_32_numa_cpu_node = es7000_numa_cpu_node, };struct apic __refdata apic_es7000 = {
@@ -752,5 +746,4 @@ struct apic __refdata apic_es7000 = { .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, .x86_32_early_logical_apicid = es7000_early_logical_apicid, - .x86_32_numa_cpu_node = es7000_numa_cpu_node, };
arch/x86/kernel/apic/numaq_32.c +10 -24
@@ -48,8 +48,6 @@#include <asm/e820.h> #include <asm/ipi.h> -#define MB_TO_PAGES (addr) ((addr) << (20 - PAGE_SHIFT)) -int found_numaq;/*
@@ -79,31 +77,20 @@ int quad_local_to_mp_bus_id[NR_CPUS/4][4];static inline void numaq_register_node (int node,struct sys_cfg_data *scd) {struct eachquadmem *eq = scd->eq + node; +u64 start = (u64)(eq->hi_shrd_mem_start - eq->priv_mem_size) <<20 ; +u64 end = (u64)(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size) <<20 ; +int ret; -node_set_online (node); - -/* Convert to pages */ - node_start_pfn[node] = -MB_TO_PAGES (eq->hi_shrd_mem_start - eq->priv_mem_size); - - node_end_pfn[node] = -MB_TO_PAGES (eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); - -memblock_x86_register_active_regions (node, node_start_pfn[node], - node_end_pfn[node]); - -memory_present (node, node_start_pfn[node], node_end_pfn[node]); - - node_remap_size[node] =node_memmap_size_bytes (node, - node_start_pfn[node], - node_end_pfn[node]); +node_set (node, numa_nodes_parsed); + ret =numa_add_memblk (node, start, end); +BUG_ON (ret <0 ); }/* * Function: smp_dump_qct() * * Description: gets memory layout from the quad config table. This -* function also updates node_online_map with the nodes (quads) present. +* function also updates numa_nodes_parsed with the nodes (quads) present. */ static void __init smp_dump_qct (void ) {
@@ -112,7 +99,6 @@ static void __init smp_dump_qct(void) scd = (void *)__va (SYS_CFG_DATA_PRIV_ADDR ); -nodes_clear (node_online_map);for_each_node (node) {if (scd->quads_present31_0 & (1 << node))numaq_register_node (node, scd);
@@ -282,14 +268,14 @@ static __init void early_check_numaq(void) } } -int __init get_memcfg_numaq (void ) +int __init numaq_numa_init (void ) {early_check_numaq ();if (!found_numaq) -return 0 ; +return -ENOENT ;smp_dump_qct (); -return 1 ; +return 0 ; }#define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER)
arch/x86/kernel/apic/probe_32.c +0 -1
@@ -172,7 +172,6 @@ struct apic apic_default = { .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, .x86_32_early_logical_apicid = default_x86_32_early_logical_apicid, - .x86_32_numa_cpu_node = default_x86_32_numa_cpu_node, };extern struct apic apic_numaq;
arch/x86/kernel/apic/summit_32.c +0 -1
@@ -551,5 +551,4 @@ struct apic apic_summit = { .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, .x86_32_early_logical_apicid = summit_early_logical_apicid, - .x86_32_numa_cpu_node = default_x86_32_numa_cpu_node, };
arch/x86/kernel/cpu/mcheck/therm_throt.c +3 -4
@@ -355,7 +355,6 @@ static void notify_thresholds(__u64 msr_val)static void intel_thermal_interrupt (void ) {__u64 msr_val; -struct cpuinfo_x86 *c = &cpu_data (smp_processor_id ());rdmsrl (MSR_IA32_THERM_STATUS , msr_val);
@@ -367,19 +366,19 @@ static void intel_thermal_interrupt(void) CORE_LEVEL) != 0)mce_log_therm_throt_event (CORE_THROTTLED | msr_val); -if (cpu_has (c,X86_FEATURE_PLN )) +if (this_cpu_has (X86_FEATURE_PLN ))if (therm_throt_process (msr_val &THERM_STATUS_POWER_LIMIT ,POWER_LIMIT_EVENT ,CORE_LEVEL ) !=0 )mce_log_therm_throt_event (CORE_POWER_LIMIT | msr_val); -if (cpu_has (c,X86_FEATURE_PTS )) { +if (this_cpu_has (X86_FEATURE_PTS )) {rdmsrl (MSR_IA32_PACKAGE_THERM_STATUS , msr_val);if (therm_throt_process (msr_val &PACKAGE_THERM_STATUS_PROCHOT ,THERMAL_THROTTLING_EVENT ,PACKAGE_LEVEL ) !=0 )mce_log_therm_throt_event (PACKAGE_THROTTLED | msr_val); -if (cpu_has (c,X86_FEATURE_PLN )) +if (this_cpu_has (X86_FEATURE_PLN )) if (therm_throt_process(msr_val & PACKAGE_THERM_STATUS_POWER_LIMIT, POWER_LIMIT_EVENT,
arch/x86/kernel/mpparse.c +1 -1
@@ -715,7 +715,7 @@ static void __init check_irq_src(struct mpc_intsrc *m, int *nr_m_spare) } } -static int +static int __init check_slot (unsigned long mpc_new_phys,unsigned long mpc_new_length,int count) {int ret =0 ;
arch/x86/kernel/process.c +2 -2
@@ -449,7 +449,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);void mwait_idle_with_hints (unsigned long ax,unsigned long cx) {if (!need_resched ()) { -if (cpu_has (__this_cpu_ptr (&cpu_info),X86_FEATURE_CLFLUSH_MONITOR )) +if (this_cpu_has (X86_FEATURE_CLFLUSH_MONITOR ))clflush ((void *)¤t_thread_info ()->flags);__monitor ((void *)¤t_thread_info ()->flags,0 ,0 );
@@ -465,7 +465,7 @@ static void mwait_idle(void)if (!need_resched ()) {trace_power_start (POWER_CSTATE ,1 ,smp_processor_id ());trace_cpu_idle (1 ,smp_processor_id ()); -if (cpu_has (__this_cpu_ptr (&cpu_info),X86_FEATURE_CLFLUSH_MONITOR )) +if (this_cpu_has (X86_FEATURE_CLFLUSH_MONITOR ))clflush ((void *)¤t_thread_info ()->flags);__monitor ((void *)¤t_thread_info ()->flags,0 ,0 );
arch/x86/kernel/smpboot.c +2 -2
@@ -1332,9 +1332,9 @@ static inline void mwait_play_dead(void)void *mwait_ptr;struct cpuinfo_x86 *c =__this_cpu_ptr (&cpu_info); -if (!(cpu_has (c,X86_FEATURE_MWAIT ) &&mwait_usable (c))) +if (!this_cpu_has (X86_FEATURE_MWAIT ) &&mwait_usable (c))return ; -if (!cpu_has (__this_cpu_ptr (&cpu_info),X86_FEATURE_CLFLSH )) +if (!this_cpu_has (X86_FEATURE_CLFLSH ))return ;if (__this_cpu_read (cpu_info.cpuid_level) <CPUID_MWAIT_LEAF )return ;
arch/x86/mm/Makefile +2 -2
@@ -23,8 +23,8 @@ mmiotrace-y := kmmio.o pf_in.o mmio-mod.o obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o obj-$(CONFIG_NUMA) += numa.o numa_$(BITS).o -obj-$(CONFIG_AMD_NUMA) += amdtopology_64.o -obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o +obj-$(CONFIG_AMD_NUMA) += amdtopology.o +obj-$(CONFIG_ACPI_NUMA) += srat.o obj-$(CONFIG_NUMA_EMU) += numa_emulation.o obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
arch/x86/mm/amdtopology.c renamed from arch/x86/mm/amdtopology_64.c +11 -10
@@ -12,6 +12,7 @@#include <linux/module.h> #include <linux/nodemask.h> #include <linux/memblock.h> +#include <linux/bootmem.h> #include <asm/io.h> #include <linux/pci_ids.h>
@@ -69,10 +70,10 @@ static __init void early_get_boot_cpu_id(void)int __init amd_numa_init (void ) { -unsigned long start =PFN_PHYS (0 ); -unsigned long end =PFN_PHYS (max_pfn); +u64 start =PFN_PHYS (0 ); +u64 end =PFN_PHYS (max_pfn);unsigned numnodes; -unsigned long prevbase; +u64 prevbase;int i, j, nb;u32 nodeid, reg;unsigned int bits, cores, apicid_base;
@@ -95,7 +96,7 @@ int __init amd_numa_init(void) prevbase =0 ;for (i =0 ; i <8 ; i++) { -unsigned long base, limit; +u64 base, limit; base =read_pci_config (0 , nb,1 ,0x40 + i*8 ); limit =read_pci_config (0 , nb,1 ,0x44 + i*8 );
@@ -107,18 +108,18 @@ int __init amd_numa_init(void)continue ; }if (nodeid >= numnodes) { -pr_info ("Ignoring excess node %d (%lx:%lx)\n" , nodeid, +pr_info ("Ignoring excess node %d (%Lx:%Lx)\n" , nodeid, base, limit);continue ; }if (!limit) { -pr_info ("Skipping node entry %d (base %lx)\n" , +pr_info ("Skipping node entry %d (base %Lx)\n" , i, base);continue ; }if ((base >>8 ) &3 || (limit >>8 ) &3 ) { -pr_err ("Node %d using interleaving mode %lx/%lx\n" , +pr_err ("Node %d using interleaving mode %Lx/%Lx\n" , nodeid, (base >>8 ) &3 , (limit >>8 ) &3 );return -EINVAL ; }
@@ -150,19 +151,19 @@ int __init amd_numa_init(void)continue ; }if (limit < base) { -pr_err ("Node %d bogus settings %lx-%lx.\n" , +pr_err ("Node %d bogus settings %Lx-%Lx.\n" , nodeid, base, limit);continue ; }/* Could sort here, but pun for now. Should not happen anyroads. */ if (prevbase > base) { -pr_err ("Node map not sorted %lx,%lx\n" , +pr_err ("Node map not sorted %Lx,%Lx\n" , prevbase, base);return -EINVAL ; } -pr_info ("Node %d MemBase %016lx Limit %016lx\n" , +pr_info ("Node %d MemBase %016Lx Limit %016Lx\n" , nodeid, base, limit); prevbase = base;
arch/x86/mm/init_32.c +3 -0
@@ -678,8 +678,10 @@ static void __init zone_sizes_init(void) {unsigned long max_zone_pfns[MAX_NR_ZONES ];memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); +#ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA ] =virt_to_phys ((char *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; +#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;#ifdef CONFIG_HIGHMEM max_zone_pfns[ZONE_HIGHMEM ] = highend_pfn;
@@ -716,6 +718,7 @@ void __init paging_init(void)* NOTE: at this point the bootmem allocator is fully available. */ olpc_dt_build_devicetree (); +sparse_memory_present_with_active_regions (MAX_NUMNODES );sparse_init ();zone_sizes_init (); }
arch/x86/mm/init_64.c +2 -8
@@ -616,7 +616,9 @@ void __init paging_init(void)unsigned long max_zone_pfns[MAX_NR_ZONES ];memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); +#ifdef CONFIG_ZONE_DMA max_zone_pfns[ZONE_DMA ] =MAX_DMA_PFN ; +#endif max_zone_pfns[ZONE_DMA32 ] =MAX_DMA32_PFN ; max_zone_pfns[ZONE_NORMAL ] = max_pfn;
@@ -679,14 +681,6 @@ int arch_add_memory(int nid, u64 start, u64 size) }EXPORT_SYMBOL_GPL (arch_add_memory); -#if !defined(CONFIG_ACPI_NUMA ) && defined(CONFIG_NUMA ) -int memory_add_physaddr_to_nid (u64 start) -{ -return 0 ; -} -EXPORT_SYMBOL_GPL (memory_add_physaddr_to_nid); -#endif -#endif /* CONFIG_MEMORY_HOTPLUG */ static struct kcore_list kcore_vsyscall;
arch/x86/mm/ioremap.c +7 -7
@@ -91,13 +91,6 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,return (__force void __iomem *)phys_to_virt (phys_addr);/* -* Check if the request spans more than any BAR in the iomem resource -* tree. -*/ -WARN_ONCE (iomem_map_sanity_check (phys_addr, size), -KERN_INFO "Info: mapping multiple BARs. Your kernel is fine." ); - -/* * Don't allow anybody to remap normal RAM that we're using.. */ last_pfn = last_addr >>PAGE_SHIFT ;
@@ -170,6 +163,13 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, ret_addr = (void __iomem *) (vaddr + offset);mmiotrace_ioremap (unaligned_phys_addr, unaligned_size, ret_addr); +/* +* Check if the request spans more than any BAR in the iomem resource +* tree. +*/ +WARN_ONCE (iomem_map_sanity_check (unaligned_phys_addr, unaligned_size), +KERN_INFO "Info: mapping multiple BARs. Your kernel is fine." ); +return ret_addr; err_free_area:free_vm_area (area);
arch/x86/mm/numa.c +546 -4
585 lines not on this page · raw message
arch/x86/mm/numa_32.c +102 -296
473 lines not on this page · raw message
arch/x86/mm/numa_64.c +1 -643
659 lines not on this page · raw message
arch/x86/mm/numa_emulation.c +11 -5
@@ -5,6 +5,7 @@#include <linux/errno.h> #include <linux/topology.h> #include <linux/memblock.h> +#include <linux/bootmem.h> #include <asm/dma.h> #include "numa_internal.h"
@@ -84,7 +85,13 @@ static int __init split_nodes_interleave(struct numa_meminfo *ei, nr_nodes =MAX_NUMNODES ; } - size = (max_addr - addr -memblock_x86_hole_size (addr, max_addr)) / nr_nodes; +/* +* Calculate target node size. x86_32 freaks on __udivdi3() so do +* the division in ulong number of pages and convert back. +*/ + size = max_addr - addr -memblock_x86_hole_size (addr, max_addr); + size =PFN_PHYS ((unsigned long )(size >>PAGE_SHIFT ) / nr_nodes); +/* * Calculate the number of big nodes that can be allocated as a result * of consolidating the remainder.
@@ -226,7 +233,7 @@ static int __init split_nodes_size_interleave(struct numa_meminfo *ei,*/ while (nodes_weight (physnode_mask)) {for_each_node_mask (i, physnode_mask) { -u64 dma32_end =MAX_DMA32_PFN <<PAGE_SHIFT ; +u64 dma32_end =PFN_PHYS (MAX_DMA32_PFN );u64 start, limit, end;int phys_blk;
@@ -298,7 +305,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) {static struct numa_meminfo ei__initdata ;static struct numa_meminfo pi__initdata ; -const u64 max_addr = max_pfn <<PAGE_SHIFT ; +const u64 max_addr =PFN_PHYS (max_pfn);u8 *phys_dist =NULL ;size_t phys_size = numa_dist_cnt * numa_dist_cnt *sizeof (phys_dist[0 ]);int max_emu_nid, dfl_phys_nid;
@@ -342,8 +349,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)if (numa_dist_cnt) {u64 phys; - phys =memblock_find_in_range (0 , - (u64 )max_pfn_mapped <<PAGE_SHIFT , + phys =memblock_find_in_range (0 ,PFN_PHYS (max_pfn_mapped), phys_size,PAGE_SIZE );if (phys ==MEMBLOCK_ERROR ) {pr_warning ("NUMA: Warning: can't allocate copy of distance table, disabling emulation\n" );
arch/x86/mm/numa_internal.h +8 -0
@@ -19,6 +19,14 @@ void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi);int __init numa_cleanup_meminfo (struct numa_meminfo *mi);void __init numa_reset_distance (void ); +void __init x86_numa_init (void ); + +#ifdef CONFIG_X86_64 +static inline void init_alloc_remap (int nid,u64 start,u64 end) { } +#else +void __init init_alloc_remap (int nid,u64 start,u64 end); +#endif +#ifdef CONFIG_NUMA_EMU void __init numa_emulation (struct numa_meminfo *numa_meminfo,int numa_dist_cnt);
arch/x86/mm/srat.c renamed from arch/x86/mm/srat_64.c +3 -79
119 lines not on this page · raw message
arch/x86/mm/srat_32.c deleted +0 -288
219 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.