Commit 8293dd6f authored by Ingo Molnar's avatar Ingo Molnar

Merge branch 'x86/core' into tracing/ftrace

Semantic merge:

  kernel/trace/trace_functions_graph.c
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parents 631595fb 467c88fe
...@@ -3,14 +3,4 @@ ...@@ -3,14 +3,4 @@
#include <asm-generic/percpu.h> #include <asm-generic/percpu.h>
#ifdef CONFIG_MODULES
#define PERCPU_MODULE_RESERVE 8192
#else
#define PERCPU_MODULE_RESERVE 0
#endif
#define PERCPU_ENOUGH_ROOM \
(ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
PERCPU_MODULE_RESERVE)
#endif /* __ARCH_BLACKFIN_PERCPU__ */ #endif /* __ARCH_BLACKFIN_PERCPU__ */
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
#undef notrace #undef notrace
#define notrace __attribute__((no_instrument_function)) #define notrace __attribute__((no_instrument_function))
#ifdef CONFIG_X86_64
#define __ALIGN .p2align 4,,15
#define __ALIGN_STR ".p2align 4,,15"
#endif
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
/* /*
...@@ -50,16 +45,25 @@ ...@@ -50,16 +45,25 @@
__asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \ __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
"g" (arg4), "g" (arg5), "g" (arg6)) "g" (arg4), "g" (arg5), "g" (arg6))
#endif #endif /* CONFIG_X86_32 */
#ifdef __ASSEMBLY__
#define GLOBAL(name) \ #define GLOBAL(name) \
.globl name; \ .globl name; \
name: name:
#ifdef CONFIG_X86_64
#define __ALIGN .p2align 4,,15
#define __ALIGN_STR ".p2align 4,,15"
#endif
#ifdef CONFIG_X86_ALIGNMENT_16 #ifdef CONFIG_X86_ALIGNMENT_16
#define __ALIGN .align 16,0x90 #define __ALIGN .align 16,0x90
#define __ALIGN_STR ".align 16,0x90" #define __ALIGN_STR ".align 16,0x90"
#endif #endif
#endif /* __ASSEMBLY__ */
#endif /* _ASM_X86_LINKAGE_H */ #endif /* _ASM_X86_LINKAGE_H */
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/apic.h> #include <asm/apic.h>
#include <asm/cpu.h>
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
# include <asm/numa_64.h> # include <asm/numa_64.h>
...@@ -141,6 +142,55 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) ...@@ -141,6 +142,55 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
} }
} }
static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
{
#ifdef CONFIG_SMP
/* calling is from identify_secondary_cpu() ? */
if (c->cpu_index == boot_cpu_id)
return;
/*
* Certain Athlons might work (for various values of 'work') in SMP
* but they are not certified as MP capable.
*/
/* Athlon 660/661 is valid. */
if ((c->x86_model == 6) && ((c->x86_mask == 0) ||
(c->x86_mask == 1)))
goto valid_k7;
/* Duron 670 is valid */
if ((c->x86_model == 7) && (c->x86_mask == 0))
goto valid_k7;
/*
* Athlon 662, Duron 671, and Athlon >model 7 have capability
* bit. It's worth noting that the A5 stepping (662) of some
* Athlon XP's have the MP bit set.
* See http://www.heise.de/newsticker/data/jow-18.10.01-000 for
* more.
*/
if (((c->x86_model == 6) && (c->x86_mask >= 2)) ||
((c->x86_model == 7) && (c->x86_mask >= 1)) ||
(c->x86_model > 7))
if (cpu_has_mp)
goto valid_k7;
/* If we get here, not a certified SMP capable AMD system. */
/*
* Don't taint if we are running SMP kernel on a single non-MP
* approved Athlon
*/
WARN_ONCE(1, "WARNING: This combination of AMD"
"processors is not suitable for SMP.\n");
if (!test_taint(TAINT_UNSAFE_SMP))
add_taint(TAINT_UNSAFE_SMP);
valid_k7:
;
#endif
}
static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c)
{ {
u32 l, h; u32 l, h;
...@@ -175,6 +225,8 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) ...@@ -175,6 +225,8 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c)
} }
set_cpu_cap(c, X86_FEATURE_K7); set_cpu_cap(c, X86_FEATURE_K7);
amd_k7_smp_check(c);
} }
#endif #endif
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/ds.h> #include <asm/ds.h>
#include <asm/bugs.h> #include <asm/bugs.h>
#include <asm/cpu.h>
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
#include <asm/topology.h> #include <asm/topology.h>
...@@ -116,6 +117,28 @@ static void __cpuinit trap_init_f00f_bug(void) ...@@ -116,6 +117,28 @@ static void __cpuinit trap_init_f00f_bug(void)
} }
#endif #endif
static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c)
{
#ifdef CONFIG_SMP
/* calling is from identify_secondary_cpu() ? */
if (c->cpu_index == boot_cpu_id)
return;
/*
* Mask B, Pentium, but not Pentium MMX
*/
if (c->x86 == 5 &&
c->x86_mask >= 1 && c->x86_mask <= 4 &&
c->x86_model <= 3) {
/*
* Remember we have B step Pentia with bugs
*/
WARN_ONCE(1, "WARNING: SMP operation may be unreliable"
"with B stepping processors.\n");
}
#endif
}
static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
{ {
unsigned long lo, hi; unsigned long lo, hi;
...@@ -192,6 +215,8 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) ...@@ -192,6 +215,8 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
#ifdef CONFIG_X86_NUMAQ #ifdef CONFIG_X86_NUMAQ
numaq_tsc_disable(); numaq_tsc_disable();
#endif #endif
intel_smp_check(c);
} }
#else #else
static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
......
...@@ -42,6 +42,19 @@ unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = { ...@@ -42,6 +42,19 @@ unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = {
}; };
EXPORT_SYMBOL(__per_cpu_offset); EXPORT_SYMBOL(__per_cpu_offset);
/*
* On x86_64 symbols referenced from code should be reachable using
* 32bit relocations. Reserve space for static percpu variables in
* modules so that they are always served from the first chunk which
* is located at the percpu segment base. On x86_32, anything can
* address anywhere. No need to reserve space in the first chunk.
*/
#ifdef CONFIG_X86_64
#define PERCPU_FIRST_CHUNK_RESERVE PERCPU_MODULE_RESERVE
#else
#define PERCPU_FIRST_CHUNK_RESERVE 0
#endif
/** /**
* pcpu_need_numa - determine percpu allocation needs to consider NUMA * pcpu_need_numa - determine percpu allocation needs to consider NUMA
* *
...@@ -141,7 +154,7 @@ static ssize_t __init setup_pcpu_remap(size_t static_size) ...@@ -141,7 +154,7 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
{ {
static struct vm_struct vm; static struct vm_struct vm;
pg_data_t *last; pg_data_t *last;
size_t ptrs_size; size_t ptrs_size, dyn_size;
unsigned int cpu; unsigned int cpu;
ssize_t ret; ssize_t ret;
...@@ -169,12 +182,14 @@ static ssize_t __init setup_pcpu_remap(size_t static_size) ...@@ -169,12 +182,14 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
* Currently supports only single page. Supporting multiple * Currently supports only single page. Supporting multiple
* pages won't be too difficult if it ever becomes necessary. * pages won't be too difficult if it ever becomes necessary.
*/ */
pcpur_size = PFN_ALIGN(static_size + PERCPU_DYNAMIC_RESERVE); pcpur_size = PFN_ALIGN(static_size + PERCPU_MODULE_RESERVE +
PERCPU_DYNAMIC_RESERVE);
if (pcpur_size > PMD_SIZE) { if (pcpur_size > PMD_SIZE) {
pr_warning("PERCPU: static data is larger than large page, " pr_warning("PERCPU: static data is larger than large page, "
"can't use large page\n"); "can't use large page\n");
return -EINVAL; return -EINVAL;
} }
dyn_size = pcpur_size - static_size - PERCPU_FIRST_CHUNK_RESERVE;
/* allocate pointer array and alloc large pages */ /* allocate pointer array and alloc large pages */
ptrs_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpur_ptrs[0])); ptrs_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpur_ptrs[0]));
...@@ -217,8 +232,9 @@ static ssize_t __init setup_pcpu_remap(size_t static_size) ...@@ -217,8 +232,9 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
pr_info("PERCPU: Remapped at %p with large pages, static data " pr_info("PERCPU: Remapped at %p with large pages, static data "
"%zu bytes\n", vm.addr, static_size); "%zu bytes\n", vm.addr, static_size);
ret = pcpu_setup_first_chunk(pcpur_get_page, static_size, PMD_SIZE, ret = pcpu_setup_first_chunk(pcpur_get_page, static_size,
pcpur_size - static_size, vm.addr, NULL); PERCPU_FIRST_CHUNK_RESERVE,
PMD_SIZE, dyn_size, vm.addr, NULL);
goto out_free_ar; goto out_free_ar;
enomem: enomem:
...@@ -241,24 +257,31 @@ static ssize_t __init setup_pcpu_remap(size_t static_size) ...@@ -241,24 +257,31 @@ static ssize_t __init setup_pcpu_remap(size_t static_size)
* Embedding allocator * Embedding allocator
* *
* The first chunk is sized to just contain the static area plus * The first chunk is sized to just contain the static area plus
* PERCPU_DYNAMIC_RESERVE and allocated as a contiguous area using * module and dynamic reserves, and allocated as a contiguous area
* bootmem allocator and used as-is without being mapped into vmalloc * using bootmem allocator and used as-is without being mapped into
* area. This enables the first chunk to piggy back on the linear * vmalloc area. This enables the first chunk to piggy back on the
* physical PMD mapping and doesn't add any additional pressure to * linear physical PMD mapping and doesn't add any additional pressure
* TLB. * to TLB. Note that if the needed size is smaller than the minimum
* unit size, the leftover is returned to the bootmem allocator.
*/ */
static void *pcpue_ptr __initdata; static void *pcpue_ptr __initdata;
static size_t pcpue_size __initdata;
static size_t pcpue_unit_size __initdata; static size_t pcpue_unit_size __initdata;
static struct page * __init pcpue_get_page(unsigned int cpu, int pageno) static struct page * __init pcpue_get_page(unsigned int cpu, int pageno)
{ {
return virt_to_page(pcpue_ptr + cpu * pcpue_unit_size size_t off = (size_t)pageno << PAGE_SHIFT;
+ ((size_t)pageno << PAGE_SHIFT));
if (off >= pcpue_size)
return NULL;
return virt_to_page(pcpue_ptr + cpu * pcpue_unit_size + off);
} }
static ssize_t __init setup_pcpu_embed(size_t static_size) static ssize_t __init setup_pcpu_embed(size_t static_size)
{ {
unsigned int cpu; unsigned int cpu;
size_t dyn_size;
/* /*
* If large page isn't supported, there's no benefit in doing * If large page isn't supported, there's no benefit in doing
...@@ -269,25 +292,32 @@ static ssize_t __init setup_pcpu_embed(size_t static_size) ...@@ -269,25 +292,32 @@ static ssize_t __init setup_pcpu_embed(size_t static_size)
return -EINVAL; return -EINVAL;
/* allocate and copy */ /* allocate and copy */
pcpue_unit_size = PFN_ALIGN(static_size + PERCPU_DYNAMIC_RESERVE); pcpue_size = PFN_ALIGN(static_size + PERCPU_MODULE_RESERVE +
pcpue_unit_size = max_t(size_t, pcpue_unit_size, PCPU_MIN_UNIT_SIZE); PERCPU_DYNAMIC_RESERVE);
pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE);
dyn_size = pcpue_size - static_size - PERCPU_FIRST_CHUNK_RESERVE;
pcpue_ptr = pcpu_alloc_bootmem(0, num_possible_cpus() * pcpue_unit_size, pcpue_ptr = pcpu_alloc_bootmem(0, num_possible_cpus() * pcpue_unit_size,
PAGE_SIZE); PAGE_SIZE);
if (!pcpue_ptr) if (!pcpue_ptr)
return -ENOMEM; return -ENOMEM;
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu) {
memcpy(pcpue_ptr + cpu * pcpue_unit_size, __per_cpu_load, void *ptr = pcpue_ptr + cpu * pcpue_unit_size;
static_size);
free_bootmem(__pa(ptr + pcpue_size),
pcpue_unit_size - pcpue_size);
memcpy(ptr, __per_cpu_load, static_size);
}
/* we're ready, commit */ /* we're ready, commit */
pr_info("PERCPU: Embedded %zu pages at %p, static data %zu bytes\n", pr_info("PERCPU: Embedded %zu pages at %p, static data %zu bytes\n",
pcpue_unit_size >> PAGE_SHIFT, pcpue_ptr, static_size); pcpue_size >> PAGE_SHIFT, pcpue_ptr, static_size);
return pcpu_setup_first_chunk(pcpue_get_page, static_size, return pcpu_setup_first_chunk(pcpue_get_page, static_size,
pcpue_unit_size, PERCPU_FIRST_CHUNK_RESERVE,
pcpue_unit_size - static_size, pcpue_ptr, pcpue_unit_size, dyn_size,
NULL); pcpue_ptr, NULL);
} }
/* /*
...@@ -344,7 +374,8 @@ static ssize_t __init setup_pcpu_4k(size_t static_size) ...@@ -344,7 +374,8 @@ static ssize_t __init setup_pcpu_4k(size_t static_size)
pr_info("PERCPU: Allocated %d 4k pages, static data %zu bytes\n", pr_info("PERCPU: Allocated %d 4k pages, static data %zu bytes\n",
pcpu4k_nr_static_pages, static_size); pcpu4k_nr_static_pages, static_size);
ret = pcpu_setup_first_chunk(pcpu4k_get_page, static_size, 0, 0, NULL, ret = pcpu_setup_first_chunk(pcpu4k_get_page, static_size,
PERCPU_FIRST_CHUNK_RESERVE, -1, -1, NULL,
pcpu4k_populate_pte); pcpu4k_populate_pte);
goto out_free_ar; goto out_free_ar;
......
...@@ -114,10 +114,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info); ...@@ -114,10 +114,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
atomic_t init_deasserted; atomic_t init_deasserted;
/* Set if we find a B stepping CPU */
static int __cpuinitdata smp_b_stepping;
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32)
/* which logical CPUs are on which nodes */ /* which logical CPUs are on which nodes */
...@@ -271,8 +267,6 @@ static void __cpuinit smp_callin(void) ...@@ -271,8 +267,6 @@ static void __cpuinit smp_callin(void)
cpumask_set_cpu(cpuid, cpu_callin_mask); cpumask_set_cpu(cpuid, cpu_callin_mask);
} }
static int __cpuinitdata unsafe_smp;
/* /*
* Activate a secondary processor. * Activate a secondary processor.
*/ */
...@@ -340,76 +334,6 @@ notrace static void __cpuinit start_secondary(void *unused) ...@@ -340,76 +334,6 @@ notrace static void __cpuinit start_secondary(void *unused)
cpu_idle(); cpu_idle();
} }
static void __cpuinit smp_apply_quirks(struct cpuinfo_x86 *c)
{
/*
* Mask B, Pentium, but not Pentium MMX
*/
if (c->x86_vendor == X86_VENDOR_INTEL &&
c->x86 == 5 &&
c->x86_mask >= 1 && c->x86_mask <= 4 &&
c->x86_model <= 3)
/*
* Remember we have B step Pentia with bugs
*/
smp_b_stepping = 1;
/*
* Certain Athlons might work (for various values of 'work') in SMP
* but they are not certified as MP capable.
*/
if ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 6)) {
if (num_possible_cpus() == 1)
goto valid_k7;
/* Athlon 660/661 is valid. */
if ((c->x86_model == 6) && ((c->x86_mask == 0) ||
(c->x86_mask == 1)))
goto valid_k7;
/* Duron 670 is valid */
if ((c->x86_model == 7) && (c->x86_mask == 0))
goto valid_k7;
/*
* Athlon 662, Duron 671, and Athlon >model 7 have capability
* bit. It's worth noting that the A5 stepping (662) of some
* Athlon XP's have the MP bit set.
* See http://www.heise.de/newsticker/data/jow-18.10.01-000 for
* more.
*/
if (((c->x86_model == 6) && (c->x86_mask >= 2)) ||
((c->x86_model == 7) && (c->x86_mask >= 1)) ||
(c->x86_model > 7))
if (cpu_has_mp)
goto valid_k7;
/* If we get here, not a certified SMP capable AMD system. */
unsafe_smp = 1;
}
valid_k7:
;
}
static void __cpuinit smp_checks(void)
{
if (smp_b_stepping)
printk(KERN_WARNING "WARNING: SMP operation may be unreliable"
"with B stepping processors.\n");
/*
* Don't taint if we are running SMP kernel on a single non-MP
* approved Athlon
*/
if (unsafe_smp && num_online_cpus() > 1) {
printk(KERN_INFO "WARNING: This combination of AMD"
"processors is not suitable for SMP.\n");
add_taint(TAINT_UNSAFE_SMP);
}
}
/* /*
* The bootstrap kernel entry code has set these up. Save them for * The bootstrap kernel entry code has set these up. Save them for
* a given CPU * a given CPU
...@@ -423,7 +347,6 @@ void __cpuinit smp_store_cpu_info(int id) ...@@ -423,7 +347,6 @@ void __cpuinit smp_store_cpu_info(int id)
c->cpu_index = id; c->cpu_index = id;
if (id != 0) if (id != 0)
identify_secondary_cpu(c); identify_secondary_cpu(c);
smp_apply_quirks(c);
} }
...@@ -1193,7 +1116,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus) ...@@ -1193,7 +1116,6 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
pr_debug("Boot done.\n"); pr_debug("Boot done.\n");
impress_friends(); impress_friends();
smp_checks();
#ifdef CONFIG_X86_IO_APIC #ifdef CONFIG_X86_IO_APIC
setup_ioapic_dest(); setup_ioapic_dest();
#endif #endif
......
...@@ -314,8 +314,6 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, ...@@ -314,8 +314,6 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
int locals = 0; int locals = 0;
struct bau_desc *bau_desc; struct bau_desc *bau_desc;
WARN_ON(!in_atomic());
cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu)); cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu));
uv_cpu = uv_blade_processor_id(); uv_cpu = uv_blade_processor_id();
......
...@@ -134,8 +134,8 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, ...@@ -134,8 +134,8 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
{ {
unsigned long page_size_mask = 0; unsigned long page_size_mask = 0;
unsigned long start_pfn, end_pfn; unsigned long start_pfn, end_pfn;
unsigned long ret = 0;
unsigned long pos; unsigned long pos;
unsigned long ret;
struct map_range mr[NR_RANGE_MR]; struct map_range mr[NR_RANGE_MR];
int nr_range, i; int nr_range, i;
......
...@@ -806,11 +806,6 @@ static unsigned long __init setup_node_bootmem(int nodeid, ...@@ -806,11 +806,6 @@ static unsigned long __init setup_node_bootmem(int nodeid,
{ {
unsigned long bootmap_size; unsigned long bootmap_size;
if (start_pfn > max_low_pfn)
return bootmap;
if (end_pfn > max_low_pfn)
end_pfn = max_low_pfn;
/* don't touch min_low_pfn */ /* don't touch min_low_pfn */
bootmap_size = init_bootmem_node(NODE_DATA(nodeid), bootmap_size = init_bootmem_node(NODE_DATA(nodeid),
bootmap >> PAGE_SHIFT, bootmap >> PAGE_SHIFT,
...@@ -843,13 +838,23 @@ void __init setup_bootmem_allocator(void) ...@@ -843,13 +838,23 @@ void __init setup_bootmem_allocator(void)
max_pfn_mapped<<PAGE_SHIFT); max_pfn_mapped<<PAGE_SHIFT);
printk(KERN_INFO " low ram: 0 - %08lx\n", max_low_pfn<<PAGE_SHIFT); printk(KERN_INFO " low ram: 0 - %08lx\n", max_low_pfn<<PAGE_SHIFT);
for_each_online_node(nodeid) {
unsigned long start_pfn, end_pfn;
#ifdef CONFIG_NEED_MULTIPLE_NODES #ifdef CONFIG_NEED_MULTIPLE_NODES
for_each_online_node(nodeid) start_pfn = node_start_pfn[nodeid];
bootmap = setup_node_bootmem(nodeid, node_start_pfn[nodeid], end_pfn = node_end_pfn[nodeid];
node_end_pfn[nodeid], bootmap); if (start_pfn > max_low_pfn)
continue;
if (end_pfn > max_low_pfn)
end_pfn = max_low_pfn;
#else #else
bootmap = setup_node_bootmem(0, 0, max_low_pfn, bootmap); start_pfn = 0;
end_pfn = max_low_pfn;
#endif #endif
bootmap = setup_node_bootmem(nodeid, start_pfn, end_pfn,
bootmap);
}
after_bootmem = 1; after_bootmem = 1;
} }
......
...@@ -85,7 +85,7 @@ early_param("gbpages", parse_direct_gbpages_on); ...@@ -85,7 +85,7 @@ early_param("gbpages", parse_direct_gbpages_on);
pteval_t __supported_pte_mask __read_mostly = ~_PAGE_IOMAP; pteval_t __supported_pte_mask __read_mostly = ~_PAGE_IOMAP;
EXPORT_SYMBOL_GPL(__supported_pte_mask); EXPORT_SYMBOL_GPL(__supported_pte_mask);
static int do_not_nx __cpuinitdata; static int disable_nx __cpuinitdata;
/* /*
* noexec=on|off * noexec=on|off
...@@ -100,9 +100,9 @@ static int __init nonx_setup(char *str) ...@@ -100,9 +100,9 @@ static int __init nonx_setup(char *str)
return -EINVAL; return -EINVAL;
if (!strncmp(str, "on", 2)) { if (!strncmp(str, "on", 2)) {
__supported_pte_mask |= _PAGE_NX; __supported_pte_mask |= _PAGE_NX;
do_not_nx = 0; disable_nx = 0;
} else if (!strncmp(str, "off", 3)) { } else if (!strncmp(str, "off", 3)) {
do_not_nx = 1; disable_nx = 1;
__supported_pte_mask &= ~_PAGE_NX; __supported_pte_mask &= ~_PAGE_NX;
} }
return 0; return 0;
...@@ -114,7 +114,7 @@ void __cpuinit check_efer(void) ...@@ -114,7 +114,7 @@ void __cpuinit check_efer(void)
unsigned long efer; unsigned long efer;
rdmsrl(MSR_EFER, efer); rdmsrl(MSR_EFER, efer);
if (!(efer & EFER_NX) || do_not_nx) if (!(efer & EFER_NX) || disable_nx)
__supported_pte_mask &= ~_PAGE_NX; __supported_pte_mask &= ~_PAGE_NX;
} }
......
...@@ -87,6 +87,8 @@ bool __virt_addr_valid(unsigned long x) ...@@ -87,6 +87,8 @@ bool __virt_addr_valid(unsigned long x)
return false; return false;
if (__vmalloc_start_set && is_vmalloc_addr((void *) x)) if (__vmalloc_start_set && is_vmalloc_addr((void *) x))
return false; return false;
if (x >= FIXADDR_START)
return false;
return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT); return pfn_valid((x - PAGE_OFFSET) >> PAGE_SHIFT);
} }
EXPORT_SYMBOL(__virt_addr_valid); EXPORT_SYMBOL(__virt_addr_valid);
...@@ -504,13 +506,19 @@ static inline pte_t * __init early_ioremap_pte(unsigned long addr) ...@@ -504,13 +506,19 @@ static inline pte_t * __init early_ioremap_pte(unsigned long addr)
return &bm_pte[pte_index(addr)]; return &bm_pte[pte_index(addr)];
} }
static unsigned long slot_virt[FIX_BTMAPS_SLOTS] __initdata;
void __init early_ioremap_init(void) void __init early_ioremap_init(void)
{ {
pmd_t *pmd; pmd_t *pmd;
int i;
if (early_ioremap_debug) if (early_ioremap_debug)
printk(KERN_INFO "early_ioremap_init()\n"); printk(KERN_INFO "early_ioremap_init()\n");
for (i = 0; i < FIX_BTMAPS_SLOTS; i++)
slot_virt[i] = fix_to_virt(FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*i);
pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN));
memset(bm_pte, 0, sizeof(bm_pte)); memset(bm_pte, 0, sizeof(bm_pte));
pmd_populate_kernel(&init_mm, pmd, bm_pte); pmd_populate_kernel(&init_mm, pmd, bm_pte);
...@@ -577,6 +585,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx) ...@@ -577,6 +585,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)
static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata; static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata;
static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata; static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata;
static int __init check_early_ioremap_leak(void) static int __init check_early_ioremap_leak(void)
{ {
int count = 0; int count = 0;
...@@ -598,7 +607,8 @@ static int __init check_early_ioremap_leak(void) ...@@ -598,7 +607,8 @@ static int __init check_early_ioremap_leak(void)
} }
late_initcall(check_early_ioremap_leak); late_initcall(check_early_ioremap_leak);
static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot) static void __init __iomem *
__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot)
{ {
unsigned long offset, last_addr; unsigned long offset, last_addr;
unsigned int nrpages; unsigned int nrpages;
...@@ -664,9 +674,9 @@ static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned lo ...@@ -664,9 +674,9 @@ static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned lo
--nrpages; --nrpages;
} }
if (early_ioremap_debug) if (early_ioremap_debug)
printk(KERN_CONT "%08lx + %08lx\n", offset, fix_to_virt(idx0)); printk(KERN_CONT "%08lx + %08lx\n", offset, slot_virt[slot]);
prev_map[slot] = (void __iomem *)(offset + fix_to_virt(idx0)); prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]);
return prev_map[slot]; return prev_map[slot];
} }
...@@ -734,8 +744,3 @@ void __init early_iounmap(void __iomem *addr, unsigned long size) ...@@ -734,8 +744,3 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)
} }
prev_map[slot] = NULL; prev_map[slot] = NULL;
} }
void __this_fixmap_does_not_exist(void)
{
WARN_ON(1);
}
...@@ -451,23 +451,24 @@ static void rcu_free_kmmio_fault_pages(struct rcu_head *head) ...@@ -451,23 +451,24 @@ static void rcu_free_kmmio_fault_pages(struct rcu_head *head)
static void remove_kmmio_fault_pages(struct rcu_head *head) static void remove_kmmio_fault_pages(struct rcu_head *head)
{ {
struct kmmio_delayed_release *dr = container_of( struct kmmio_delayed_release *dr =
head, container_of(head, struct kmmio_delayed_release, rcu);
struct kmmio_delayed_release,
rcu);
struct kmmio_fault_page *p = dr->release_list; struct kmmio_fault_page *p = dr->release_list;
struct kmmio_fault_page **prevp = &dr->release_list; struct kmmio_fault_page **prevp = &dr->release_list;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&kmmio_lock, flags); spin_lock_irqsave(&kmmio_lock, flags);
while (p) { while (p) {
if (!p->count) if (!p->count) {
list_del_rcu(&p->list); list_del_rcu(&p->list);
else prevp = &p->release_next;
} else {
*prevp = p->release_next; *prevp = p->release_next;
prevp = &p->release_next; }
p = p->release_next; p = p->release_next;
} }
spin_unlock_irqrestore(&kmmio_lock, flags); spin_unlock_irqrestore(&kmmio_lock, flags);
/* This is the real RCU destroy call. */ /* This is the real RCU destroy call. */
call_rcu(&dr->rcu, rcu_free_kmmio_fault_pages); call_rcu(&dr->rcu, rcu_free_kmmio_fault_pages);
} }
......
...@@ -100,6 +100,9 @@ static int __init parse_memtest(char *arg) ...@@ -100,6 +100,9 @@ static int __init parse_memtest(char *arg)
{ {
if (arg) if (arg)
memtest_pattern = simple_strtoul(arg, NULL, 0); memtest_pattern = simple_strtoul(arg, NULL, 0);
else
memtest_pattern = ARRAY_SIZE(patterns);
return 0; return 0;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/slab.h> /* For kmalloc() */ #include <linux/slab.h> /* For kmalloc() */
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/pfn.h>
#include <asm/percpu.h> #include <asm/percpu.h>
...@@ -52,17 +53,18 @@ ...@@ -52,17 +53,18 @@
#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ /* enough to cover all DEFINE_PER_CPUs in modules */
#ifndef PERCPU_ENOUGH_ROOM
#ifdef CONFIG_MODULES #ifdef CONFIG_MODULES
#define PERCPU_MODULE_RESERVE 8192 #define PERCPU_MODULE_RESERVE (8 << 10)
#else #else
#define PERCPU_MODULE_RESERVE 0 #define PERCPU_MODULE_RESERVE 0
#endif #endif
#ifndef PERCPU_ENOUGH_ROOM
#define PERCPU_ENOUGH_ROOM \ #define PERCPU_ENOUGH_ROOM \
(__per_cpu_end - __per_cpu_start + PERCPU_MODULE_RESERVE) (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
#endif /* PERCPU_ENOUGH_ROOM */ PERCPU_MODULE_RESERVE)
#endif
/* /*
* Must be an lvalue. Since @var must be a simple identifier, * Must be an lvalue. Since @var must be a simple identifier,
...@@ -79,35 +81,24 @@ ...@@ -79,35 +81,24 @@
#ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA
/* minimum unit size, also is the maximum supported allocation size */ /* minimum unit size, also is the maximum supported allocation size */
#define PCPU_MIN_UNIT_SIZE (16UL << PAGE_SHIFT) #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
/* /*
* PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
* back on the first chunk if arch is manually allocating and mapping * back on the first chunk for dynamic percpu allocation if arch is
* it for faster access (as a part of large page mapping for example). * manually allocating and mapping it for faster access (as a part of
* Note that dynamic percpu allocator covers both static and dynamic * large page mapping for example).
* areas, so these values are bigger than PERCPU_MODULE_RESERVE.
* *
* On typical configuration with modules, the following values leave * The following values give between one and two pages of free space
* about 8k of free space on the first chunk after boot on both x86_32 * after typical minimal boot (2-way SMP, single disk and NIC) with
* and 64 when module support is enabled. When module support is * both defconfig and a distro config on x86_64 and 32. More
* disabled, it's much tighter. * intelligent way to determine this would be nice.
*/ */
#ifndef PERCPU_DYNAMIC_RESERVE #if BITS_PER_LONG > 32
# if BITS_PER_LONG > 32 #define PERCPU_DYNAMIC_RESERVE (20 << 10)
# ifdef CONFIG_MODULES #else
# define PERCPU_DYNAMIC_RESERVE (6 << PAGE_SHIFT) #define PERCPU_DYNAMIC_RESERVE (12 << 10)
# else #endif
# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
# endif
# else
# ifdef CONFIG_MODULES
# define PERCPU_DYNAMIC_RESERVE (4 << PAGE_SHIFT)
# else
# define PERCPU_DYNAMIC_RESERVE (2 << PAGE_SHIFT)
# endif
# endif
#endif /* PERCPU_DYNAMIC_RESERVE */
extern void *pcpu_base_addr; extern void *pcpu_base_addr;
...@@ -115,9 +106,10 @@ typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno); ...@@ -115,9 +106,10 @@ typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno);
typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr); typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr);
extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
size_t static_size, size_t unit_size, size_t static_size, size_t reserved_size,
size_t free_size, void *base_addr, ssize_t unit_size, ssize_t dyn_size,
pcpu_populate_pte_fn_t populate_pte_fn); void *base_addr,
pcpu_populate_pte_fn_t populate_pte_fn);
/* /*
* Use this to get to a cpu's version of the per-cpu object * Use this to get to a cpu's version of the per-cpu object
...@@ -126,6 +118,8 @@ extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, ...@@ -126,6 +118,8 @@ extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
*/ */
#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
extern void *__alloc_reserved_percpu(size_t size, size_t align);
#else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ #else /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */
struct percpu_data { struct percpu_data {
......
...@@ -381,7 +381,7 @@ static void *percpu_modalloc(unsigned long size, unsigned long align, ...@@ -381,7 +381,7 @@ static void *percpu_modalloc(unsigned long size, unsigned long align,
align = PAGE_SIZE; align = PAGE_SIZE;
} }
ptr = __alloc_percpu(size, align); ptr = __alloc_reserved_percpu(size, align);
if (!ptr) if (!ptr)
printk(KERN_WARNING printk(KERN_WARNING
"Could not allocate %lu bytes percpu data\n", size); "Could not allocate %lu bytes percpu data\n", size);
......
...@@ -837,7 +837,7 @@ static void graph_trace_open(struct trace_iterator *iter) ...@@ -837,7 +837,7 @@ static void graph_trace_open(struct trace_iterator *iter)
static void graph_trace_close(struct trace_iterator *iter) static void graph_trace_close(struct trace_iterator *iter)
{ {
percpu_free(iter->private); free_percpu(iter->private);
} }
static struct tracer graph_trace __read_mostly = { static struct tracer graph_trace __read_mostly = {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment