aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-11-28 12:46:22 -0500
committerTejun Heo <tj@kernel.org>2011-11-28 12:46:22 -0500
commitd4bbf7e7759afc172e2bfbc5c416324590049cdd (patch)
tree7eab5ee5481cd3dcf1162329fec827177640018a /arch/x86/mm
parenta150439c4a97db379f0ed6faa46fbbb6e7bf3cb2 (diff)
parent401d0069cb344f401bc9d264c31db55876ff78c0 (diff)
Merge branch 'master' into x86/memblock
Conflicts & resolutions: * arch/x86/xen/setup.c dc91c728fd "xen: allow extra memory to be in multiple regions" 24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..." conflicted on xen_add_extra_mem() updates. The resolution is trivial as the latter just want to replace memblock_x86_reserve_range() with memblock_reserve(). * drivers/pci/intel-iommu.c 166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/" 5dfe8660a3d "bootmem: Replace work_with_active_regions() with..." conflicted as the former moved the file under drivers/iommu/. Resolved by applying the chnages from the latter on the moved file. * mm/Kconfig 6661672053a "memblock: add NO_BOOTMEM config symbol" c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option" conflicted trivially. Both added config options. Just letting both add their own options resolves the conflict. * mm/memblock.c d1f0ece6cdc "mm/memblock.c: small function definition fixes" ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()" confliected. The former updates function removed by the latter. Resolution is trivial. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/fault.c29
-rw-r--r--arch/x86/mm/gup.c10
-rw-r--r--arch/x86/mm/init.c3
-rw-r--r--arch/x86/mm/init_64.c3
-rw-r--r--arch/x86/mm/kmemcheck/error.c2
-rw-r--r--arch/x86/mm/mmap.c20
-rw-r--r--arch/x86/mm/mmio-mod.c3
-rw-r--r--arch/x86/mm/pageattr-test.c3
8 files changed, 33 insertions, 40 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 2dbf6bf4c7e5..5db0490deb07 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -17,6 +17,7 @@
17#include <asm/traps.h> /* dotraplinkage, ... */ 17#include <asm/traps.h> /* dotraplinkage, ... */
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 18#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/fixmap.h> /* VSYSCALL_START */
20 21
21/* 22/*
22 * Page fault error code bits: 23 * Page fault error code bits:
@@ -105,7 +106,7 @@ check_prefetch_opcode(struct pt_regs *regs, unsigned char *instr,
105 * but for now it's good enough to assume that long 106 * but for now it's good enough to assume that long
106 * mode only uses well known segments or kernel. 107 * mode only uses well known segments or kernel.
107 */ 108 */
108 return (!user_mode(regs)) || (regs->cs == __USER_CS); 109 return (!user_mode(regs) || user_64bit_mode(regs));
109#endif 110#endif
110 case 0x60: 111 case 0x60:
111 /* 0x64 thru 0x67 are valid prefixes in all modes. */ 112 /* 0x64 thru 0x67 are valid prefixes in all modes. */
@@ -419,12 +420,14 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
419 return 0; 420 return 0;
420} 421}
421 422
423#ifdef CONFIG_CPU_SUP_AMD
422static const char errata93_warning[] = 424static const char errata93_warning[] =
423KERN_ERR 425KERN_ERR
424"******* Your BIOS seems to not contain a fix for K8 errata #93\n" 426"******* Your BIOS seems to not contain a fix for K8 errata #93\n"
425"******* Working around it, but it may cause SEGVs or burn power.\n" 427"******* Working around it, but it may cause SEGVs or burn power.\n"
426"******* Please consider a BIOS update.\n" 428"******* Please consider a BIOS update.\n"
427"******* Disabling USB legacy in the BIOS may also help.\n"; 429"******* Disabling USB legacy in the BIOS may also help.\n";
430#endif
428 431
429/* 432/*
430 * No vm86 mode in 64-bit mode: 433 * No vm86 mode in 64-bit mode:
@@ -504,7 +507,11 @@ bad:
504 */ 507 */
505static int is_errata93(struct pt_regs *regs, unsigned long address) 508static int is_errata93(struct pt_regs *regs, unsigned long address)
506{ 509{
507#ifdef CONFIG_X86_64 510#if defined(CONFIG_X86_64) && defined(CONFIG_CPU_SUP_AMD)
511 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD
512 || boot_cpu_data.x86 != 0xf)
513 return 0;
514
508 if (address != regs->ip) 515 if (address != regs->ip)
509 return 0; 516 return 0;
510 517
@@ -720,6 +727,18 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
720 if (is_errata100(regs, address)) 727 if (is_errata100(regs, address))
721 return; 728 return;
722 729
730#ifdef CONFIG_X86_64
731 /*
732 * Instruction fetch faults in the vsyscall page might need
733 * emulation.
734 */
735 if (unlikely((error_code & PF_INSTR) &&
736 ((address & ~0xfff) == VSYSCALL_START))) {
737 if (emulate_vsyscall(regs, address))
738 return;
739 }
740#endif
741
723 if (unlikely(show_unhandled_signals)) 742 if (unlikely(show_unhandled_signals))
724 show_signal_msg(regs, error_code, address, tsk); 743 show_signal_msg(regs, error_code, address, tsk);
725 744
@@ -1059,7 +1078,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
1059 if (unlikely(error_code & PF_RSVD)) 1078 if (unlikely(error_code & PF_RSVD))
1060 pgtable_bad(regs, error_code, address); 1079 pgtable_bad(regs, error_code, address);
1061 1080
1062 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 1081 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
1063 1082
1064 /* 1083 /*
1065 * If we're in an interrupt, have no user context or are running 1084 * If we're in an interrupt, have no user context or are running
@@ -1161,11 +1180,11 @@ good_area:
1161 if (flags & FAULT_FLAG_ALLOW_RETRY) { 1180 if (flags & FAULT_FLAG_ALLOW_RETRY) {
1162 if (fault & VM_FAULT_MAJOR) { 1181 if (fault & VM_FAULT_MAJOR) {
1163 tsk->maj_flt++; 1182 tsk->maj_flt++;
1164 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, 1183 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
1165 regs, address); 1184 regs, address);
1166 } else { 1185 } else {
1167 tsk->min_flt++; 1186 tsk->min_flt++;
1168 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, 1187 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
1169 regs, address); 1188 regs, address);
1170 } 1189 }
1171 if (fault & VM_FAULT_RETRY) { 1190 if (fault & VM_FAULT_RETRY) {
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index dbe34b931374..ea305856151c 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -108,16 +108,6 @@ static inline void get_head_page_multiple(struct page *page, int nr)
108 SetPageReferenced(page); 108 SetPageReferenced(page);
109} 109}
110 110
111static inline void get_huge_page_tail(struct page *page)
112{
113 /*
114 * __split_huge_page_refcount() cannot run
115 * from under us.
116 */
117 VM_BUG_ON(atomic_read(&page->_count) < 0);
118 atomic_inc(&page->_count);
119}
120
121static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr, 111static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,
122 unsigned long end, int write, struct page **pages, int *nr) 112 unsigned long end, int write, struct page **pages, int *nr)
123{ 113{
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 0b736b99d925..a298914058f9 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -63,9 +63,8 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
63#ifdef CONFIG_X86_32 63#ifdef CONFIG_X86_32
64 /* for fixmap */ 64 /* for fixmap */
65 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE); 65 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
66
67 good_end = max_pfn_mapped << PAGE_SHIFT;
68#endif 66#endif
67 good_end = max_pfn_mapped << PAGE_SHIFT;
69 68
70 base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE); 69 base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE);
71 if (!base) 70 if (!base)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 7fb064cbdcec..a8a56ce3a962 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -28,6 +28,7 @@
28#include <linux/poison.h> 28#include <linux/poison.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/memory.h>
31#include <linux/memory_hotplug.h> 32#include <linux/memory_hotplug.h>
32#include <linux/nmi.h> 33#include <linux/nmi.h>
33#include <linux/gfp.h> 34#include <linux/gfp.h>
@@ -895,8 +896,6 @@ const char *arch_vma_name(struct vm_area_struct *vma)
895} 896}
896 897
897#ifdef CONFIG_X86_UV 898#ifdef CONFIG_X86_UV
898#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
899
900unsigned long memory_block_size_bytes(void) 899unsigned long memory_block_size_bytes(void)
901{ 900{
902 if (is_uv_system()) { 901 if (is_uv_system()) {
diff --git a/arch/x86/mm/kmemcheck/error.c b/arch/x86/mm/kmemcheck/error.c
index 704a37cedddb..dab41876cdd5 100644
--- a/arch/x86/mm/kmemcheck/error.c
+++ b/arch/x86/mm/kmemcheck/error.c
@@ -185,7 +185,7 @@ void kmemcheck_error_save(enum kmemcheck_shadow state,
185 e->trace.entries = e->trace_entries; 185 e->trace.entries = e->trace_entries;
186 e->trace.max_entries = ARRAY_SIZE(e->trace_entries); 186 e->trace.max_entries = ARRAY_SIZE(e->trace_entries);
187 e->trace.skip = 0; 187 e->trace.skip = 0;
188 save_stack_trace_regs(&e->trace, regs); 188 save_stack_trace_regs(regs, &e->trace);
189 189
190 /* Round address down to nearest 16 bytes */ 190 /* Round address down to nearest 16 bytes */
191 shadow_copy = kmemcheck_shadow_lookup(address 191 shadow_copy = kmemcheck_shadow_lookup(address
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 1dab5194fd9d..4b5ba85eb5c9 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -31,6 +31,10 @@
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <asm/elf.h> 32#include <asm/elf.h>
33 33
34struct __read_mostly va_alignment va_align = {
35 .flags = -1,
36};
37
34static unsigned int stack_maxrandom_size(void) 38static unsigned int stack_maxrandom_size(void)
35{ 39{
36 unsigned int max = 0; 40 unsigned int max = 0;
@@ -42,7 +46,6 @@ static unsigned int stack_maxrandom_size(void)
42 return max; 46 return max;
43} 47}
44 48
45
46/* 49/*
47 * Top of mmap area (just below the process stack). 50 * Top of mmap area (just below the process stack).
48 * 51 *
@@ -51,21 +54,6 @@ static unsigned int stack_maxrandom_size(void)
51#define MIN_GAP (128*1024*1024UL + stack_maxrandom_size()) 54#define MIN_GAP (128*1024*1024UL + stack_maxrandom_size())
52#define MAX_GAP (TASK_SIZE/6*5) 55#define MAX_GAP (TASK_SIZE/6*5)
53 56
54/*
55 * True on X86_32 or when emulating IA32 on X86_64
56 */
57static int mmap_is_ia32(void)
58{
59#ifdef CONFIG_X86_32
60 return 1;
61#endif
62#ifdef CONFIG_IA32_EMULATION
63 if (test_thread_flag(TIF_IA32))
64 return 1;
65#endif
66 return 0;
67}
68
69static int mmap_is_legacy(void) 57static int mmap_is_legacy(void)
70{ 58{
71 if (current->personality & ADDR_COMPAT_LAYOUT) 59 if (current->personality & ADDR_COMPAT_LAYOUT)
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 3adff7dcc148..de54b9b278a7 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -29,12 +29,11 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/version.h>
33#include <linux/kallsyms.h> 32#include <linux/kallsyms.h>
34#include <asm/pgtable.h> 33#include <asm/pgtable.h>
35#include <linux/mmiotrace.h> 34#include <linux/mmiotrace.h>
36#include <asm/e820.h> /* for ISA_START_ADDRESS */ 35#include <asm/e820.h> /* for ISA_START_ADDRESS */
37#include <asm/atomic.h> 36#include <linux/atomic.h>
38#include <linux/percpu.h> 37#include <linux/percpu.h>
39#include <linux/cpu.h> 38#include <linux/cpu.h>
40 39
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index e1d106909218..b0086567271c 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -123,12 +123,11 @@ static int pageattr_test(void)
123 if (print) 123 if (print)
124 printk(KERN_INFO "CPA self-test:\n"); 124 printk(KERN_INFO "CPA self-test:\n");
125 125
126 bm = vmalloc((max_pfn_mapped + 7) / 8); 126 bm = vzalloc((max_pfn_mapped + 7) / 8);
127 if (!bm) { 127 if (!bm) {
128 printk(KERN_ERR "CPA Cannot vmalloc bitmap\n"); 128 printk(KERN_ERR "CPA Cannot vmalloc bitmap\n");
129 return -ENOMEM; 129 return -ENOMEM;
130 } 130 }
131 memset(bm, 0, (max_pfn_mapped + 7) / 8);
132 131
133 failed += print_split(&sa); 132 failed += print_split(&sa);
134 srandom32(100); 133 srandom32(100);