diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:38:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-28 13:38:45 -0500 |
commit | 46bbffad54bd48bb809f2691c1970a79a588976b (patch) | |
tree | 21779a574f118b1cba5d6832bc0a0fa3bee97075 /arch | |
parent | 85fe20bfd415af0a2e93bd1166533d4a6eb591ea (diff) | |
parent | c1fd1b43831fa20c91cdd461342af8edf2e87c2f (diff) |
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, mm: Unify kernel_physical_mapping_init() API
x86, mm: Allow highmem user page tables to be disabled at boot time
x86: Do not reserve brk for DMI if it's not going to be used
x86: Convert tlbstate_lock to raw_spinlock
x86: Use the generic page_is_ram()
x86: Remove BIOS data range from e820
Move page_is_ram() declaration to mm.h
Generic page_is_ram: use __weak
resources: introduce generic page_is_ram()
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/mm/init.c | 2 | ||||
-rw-r--r-- | arch/score/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/page_types.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/pgalloc.h | 5 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 21 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 7 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 8 | ||||
-rw-r--r-- | arch/x86/mm/ioremap.c | 37 | ||||
-rw-r--r-- | arch/x86/mm/pgtable.c | 31 | ||||
-rw-r--r-- | arch/x86/mm/tlb.c | 8 |
11 files changed, 70 insertions, 60 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index f34c26439a32..12539af38a99 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long start, unsigned long end, | |||
298 | } | 298 | } |
299 | 299 | ||
300 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 300 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
301 | static int __init page_is_ram(unsigned long pagenr) | 301 | int page_is_ram(unsigned long pagenr) |
302 | { | 302 | { |
303 | int i; | 303 | int i; |
304 | 304 | ||
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c index dfaf458d6702..7f001bbedb00 100644 --- a/arch/score/mm/init.c +++ b/arch/score/mm/init.c | |||
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(void) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 61 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
62 | static int __init page_is_ram(unsigned long pagenr) | 62 | int page_is_ram(unsigned long pagenr) |
63 | { | 63 | { |
64 | if (pagenr >= min_low_pfn && pagenr < max_low_pfn) | 64 | if (pagenr >= min_low_pfn && pagenr < max_low_pfn) |
65 | return 1; | 65 | return 1; |
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 642fe34b36a2..a667f24c7254 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #ifndef __ASSEMBLY__ | 41 | #ifndef __ASSEMBLY__ |
42 | 42 | ||
43 | extern int page_is_ram(unsigned long pagenr); | ||
44 | extern int devmem_is_allowed(unsigned long pagenr); | 43 | extern int devmem_is_allowed(unsigned long pagenr); |
45 | 44 | ||
46 | extern unsigned long max_low_pfn_mapped; | 45 | extern unsigned long max_low_pfn_mapped; |
diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h index 0e8c2a0fd922..271de94c3810 100644 --- a/arch/x86/include/asm/pgalloc.h +++ b/arch/x86/include/asm/pgalloc.h | |||
@@ -23,6 +23,11 @@ static inline void paravirt_release_pud(unsigned long pfn) {} | |||
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Flags to use when allocating a user page table page. | ||
27 | */ | ||
28 | extern gfp_t __userpte_alloc_gfp; | ||
29 | |||
30 | /* | ||
26 | * Allocate and free page tables. | 31 | * Allocate and free page tables. |
27 | */ | 32 | */ |
28 | extern pgd_t *pgd_alloc(struct mm_struct *); | 33 | extern pgd_t *pgd_alloc(struct mm_struct *); |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index a1a7876cadcb..a966b753e496 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -517,11 +517,19 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, | |||
517 | int checktype) | 517 | int checktype) |
518 | { | 518 | { |
519 | int i; | 519 | int i; |
520 | u64 end; | ||
520 | u64 real_removed_size = 0; | 521 | u64 real_removed_size = 0; |
521 | 522 | ||
522 | if (size > (ULLONG_MAX - start)) | 523 | if (size > (ULLONG_MAX - start)) |
523 | size = ULLONG_MAX - start; | 524 | size = ULLONG_MAX - start; |
524 | 525 | ||
526 | end = start + size; | ||
527 | printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ", | ||
528 | (unsigned long long) start, | ||
529 | (unsigned long long) end); | ||
530 | e820_print_type(old_type); | ||
531 | printk(KERN_CONT "\n"); | ||
532 | |||
525 | for (i = 0; i < e820.nr_map; i++) { | 533 | for (i = 0; i < e820.nr_map; i++) { |
526 | struct e820entry *ei = &e820.map[i]; | 534 | struct e820entry *ei = &e820.map[i]; |
527 | u64 final_start, final_end; | 535 | u64 final_start, final_end; |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 5d9e40c58628..cb42109a55b4 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -121,7 +121,9 @@ | |||
121 | unsigned long max_low_pfn_mapped; | 121 | unsigned long max_low_pfn_mapped; |
122 | unsigned long max_pfn_mapped; | 122 | unsigned long max_pfn_mapped; |
123 | 123 | ||
124 | #ifdef CONFIG_DMI | ||
124 | RESERVE_BRK(dmi_alloc, 65536); | 125 | RESERVE_BRK(dmi_alloc, 65536); |
126 | #endif | ||
125 | 127 | ||
126 | unsigned int boot_cpu_id __read_mostly; | 128 | unsigned int boot_cpu_id __read_mostly; |
127 | 129 | ||
@@ -667,6 +669,23 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = { | |||
667 | {} | 669 | {} |
668 | }; | 670 | }; |
669 | 671 | ||
672 | static void __init trim_bios_range(void) | ||
673 | { | ||
674 | /* | ||
675 | * A special case is the first 4Kb of memory; | ||
676 | * This is a BIOS owned area, not kernel ram, but generally | ||
677 | * not listed as such in the E820 table. | ||
678 | */ | ||
679 | e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED); | ||
680 | /* | ||
681 | * special case: Some BIOSen report the PC BIOS | ||
682 | * area (640->1Mb) as ram even though it is not. | ||
683 | * take them out. | ||
684 | */ | ||
685 | e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); | ||
686 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
687 | } | ||
688 | |||
670 | /* | 689 | /* |
671 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 690 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
672 | * passed the efi memmap, systab, etc., so we should use these data structures | 691 | * passed the efi memmap, systab, etc., so we should use these data structures |
@@ -830,7 +849,7 @@ void __init setup_arch(char **cmdline_p) | |||
830 | insert_resource(&iomem_resource, &data_resource); | 849 | insert_resource(&iomem_resource, &data_resource); |
831 | insert_resource(&iomem_resource, &bss_resource); | 850 | insert_resource(&iomem_resource, &bss_resource); |
832 | 851 | ||
833 | 852 | trim_bios_range(); | |
834 | #ifdef CONFIG_X86_32 | 853 | #ifdef CONFIG_X86_32 |
835 | if (ppro_with_ram_bug()) { | 854 | if (ppro_with_ram_bug()) { |
836 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, | 855 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index d406c5239019..e71c5cbc8f35 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -266,16 +266,9 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
266 | if (!after_bootmem) | 266 | if (!after_bootmem) |
267 | find_early_table_space(end, use_pse, use_gbpages); | 267 | find_early_table_space(end, use_pse, use_gbpages); |
268 | 268 | ||
269 | #ifdef CONFIG_X86_32 | ||
270 | for (i = 0; i < nr_range; i++) | ||
271 | kernel_physical_mapping_init(mr[i].start, mr[i].end, | ||
272 | mr[i].page_size_mask); | ||
273 | ret = end; | ||
274 | #else /* CONFIG_X86_64 */ | ||
275 | for (i = 0; i < nr_range; i++) | 269 | for (i = 0; i < nr_range; i++) |
276 | ret = kernel_physical_mapping_init(mr[i].start, mr[i].end, | 270 | ret = kernel_physical_mapping_init(mr[i].start, mr[i].end, |
277 | mr[i].page_size_mask); | 271 | mr[i].page_size_mask); |
278 | #endif | ||
279 | 272 | ||
280 | #ifdef CONFIG_X86_32 | 273 | #ifdef CONFIG_X86_32 |
281 | early_ioremap_page_table_range_init(); | 274 | early_ioremap_page_table_range_init(); |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 9a0c258a86be..2226f2c70ea3 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -241,6 +241,7 @@ kernel_physical_mapping_init(unsigned long start, | |||
241 | unsigned long page_size_mask) | 241 | unsigned long page_size_mask) |
242 | { | 242 | { |
243 | int use_pse = page_size_mask == (1<<PG_LEVEL_2M); | 243 | int use_pse = page_size_mask == (1<<PG_LEVEL_2M); |
244 | unsigned long last_map_addr = end; | ||
244 | unsigned long start_pfn, end_pfn; | 245 | unsigned long start_pfn, end_pfn; |
245 | pgd_t *pgd_base = swapper_pg_dir; | 246 | pgd_t *pgd_base = swapper_pg_dir; |
246 | int pgd_idx, pmd_idx, pte_ofs; | 247 | int pgd_idx, pmd_idx, pte_ofs; |
@@ -341,9 +342,10 @@ repeat: | |||
341 | prot = PAGE_KERNEL_EXEC; | 342 | prot = PAGE_KERNEL_EXEC; |
342 | 343 | ||
343 | pages_4k++; | 344 | pages_4k++; |
344 | if (mapping_iter == 1) | 345 | if (mapping_iter == 1) { |
345 | set_pte(pte, pfn_pte(pfn, init_prot)); | 346 | set_pte(pte, pfn_pte(pfn, init_prot)); |
346 | else | 347 | last_map_addr = (pfn << PAGE_SHIFT) + PAGE_SIZE; |
348 | } else | ||
347 | set_pte(pte, pfn_pte(pfn, prot)); | 349 | set_pte(pte, pfn_pte(pfn, prot)); |
348 | } | 350 | } |
349 | } | 351 | } |
@@ -368,7 +370,7 @@ repeat: | |||
368 | mapping_iter = 2; | 370 | mapping_iter = 2; |
369 | goto repeat; | 371 | goto repeat; |
370 | } | 372 | } |
371 | return 0; | 373 | return last_map_addr; |
372 | } | 374 | } |
373 | 375 | ||
374 | pte_t *kmap_pte; | 376 | pte_t *kmap_pte; |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 03c75ffd5c2a..5eb1ba74a3a9 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -24,43 +24,6 @@ | |||
24 | 24 | ||
25 | #include "physaddr.h" | 25 | #include "physaddr.h" |
26 | 26 | ||
27 | int page_is_ram(unsigned long pagenr) | ||
28 | { | ||
29 | resource_size_t addr, end; | ||
30 | int i; | ||
31 | |||
32 | /* | ||
33 | * A special case is the first 4Kb of memory; | ||
34 | * This is a BIOS owned area, not kernel ram, but generally | ||
35 | * not listed as such in the E820 table. | ||
36 | */ | ||
37 | if (pagenr == 0) | ||
38 | return 0; | ||
39 | |||
40 | /* | ||
41 | * Second special case: Some BIOSen report the PC BIOS | ||
42 | * area (640->1Mb) as ram even though it is not. | ||
43 | */ | ||
44 | if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) && | ||
45 | pagenr < (BIOS_END >> PAGE_SHIFT)) | ||
46 | return 0; | ||
47 | |||
48 | for (i = 0; i < e820.nr_map; i++) { | ||
49 | /* | ||
50 | * Not usable memory: | ||
51 | */ | ||
52 | if (e820.map[i].type != E820_RAM) | ||
53 | continue; | ||
54 | addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT; | ||
55 | end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; | ||
56 | |||
57 | |||
58 | if ((pagenr >= addr) && (pagenr < end)) | ||
59 | return 1; | ||
60 | } | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | /* | 27 | /* |
65 | * Fix up the linear direct mapping of the kernel to avoid cache attribute | 28 | * Fix up the linear direct mapping of the kernel to avoid cache attribute |
66 | * conflicts. | 29 | * conflicts. |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index ed34f5e35999..c9ba9deafe83 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -6,6 +6,14 @@ | |||
6 | 6 | ||
7 | #define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO | 7 | #define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO |
8 | 8 | ||
9 | #ifdef CONFIG_HIGHPTE | ||
10 | #define PGALLOC_USER_GFP __GFP_HIGHMEM | ||
11 | #else | ||
12 | #define PGALLOC_USER_GFP 0 | ||
13 | #endif | ||
14 | |||
15 | gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP; | ||
16 | |||
9 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | 17 | pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) |
10 | { | 18 | { |
11 | return (pte_t *)__get_free_page(PGALLOC_GFP); | 19 | return (pte_t *)__get_free_page(PGALLOC_GFP); |
@@ -15,16 +23,29 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) | |||
15 | { | 23 | { |
16 | struct page *pte; | 24 | struct page *pte; |
17 | 25 | ||
18 | #ifdef CONFIG_HIGHPTE | 26 | pte = alloc_pages(__userpte_alloc_gfp, 0); |
19 | pte = alloc_pages(PGALLOC_GFP | __GFP_HIGHMEM, 0); | ||
20 | #else | ||
21 | pte = alloc_pages(PGALLOC_GFP, 0); | ||
22 | #endif | ||
23 | if (pte) | 27 | if (pte) |
24 | pgtable_page_ctor(pte); | 28 | pgtable_page_ctor(pte); |
25 | return pte; | 29 | return pte; |
26 | } | 30 | } |
27 | 31 | ||
32 | static int __init setup_userpte(char *arg) | ||
33 | { | ||
34 | if (!arg) | ||
35 | return -EINVAL; | ||
36 | |||
37 | /* | ||
38 | * "userpte=nohigh" disables allocation of user pagetables in | ||
39 | * high memory. | ||
40 | */ | ||
41 | if (strcmp(arg, "nohigh") == 0) | ||
42 | __userpte_alloc_gfp &= ~__GFP_HIGHMEM; | ||
43 | else | ||
44 | return -EINVAL; | ||
45 | return 0; | ||
46 | } | ||
47 | early_param("userpte", setup_userpte); | ||
48 | |||
28 | void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) | 49 | void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) |
29 | { | 50 | { |
30 | pgtable_page_dtor(pte); | 51 | pgtable_page_dtor(pte); |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 65b58e4b0b8b..426f3a1a64d3 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -41,7 +41,7 @@ union smp_flush_state { | |||
41 | struct { | 41 | struct { |
42 | struct mm_struct *flush_mm; | 42 | struct mm_struct *flush_mm; |
43 | unsigned long flush_va; | 43 | unsigned long flush_va; |
44 | spinlock_t tlbstate_lock; | 44 | raw_spinlock_t tlbstate_lock; |
45 | DECLARE_BITMAP(flush_cpumask, NR_CPUS); | 45 | DECLARE_BITMAP(flush_cpumask, NR_CPUS); |
46 | }; | 46 | }; |
47 | char pad[INTERNODE_CACHE_BYTES]; | 47 | char pad[INTERNODE_CACHE_BYTES]; |
@@ -181,7 +181,7 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask, | |||
181 | * num_online_cpus() <= NUM_INVALIDATE_TLB_VECTORS, but it is | 181 | * num_online_cpus() <= NUM_INVALIDATE_TLB_VECTORS, but it is |
182 | * probably not worth checking this for a cache-hot lock. | 182 | * probably not worth checking this for a cache-hot lock. |
183 | */ | 183 | */ |
184 | spin_lock(&f->tlbstate_lock); | 184 | raw_spin_lock(&f->tlbstate_lock); |
185 | 185 | ||
186 | f->flush_mm = mm; | 186 | f->flush_mm = mm; |
187 | f->flush_va = va; | 187 | f->flush_va = va; |
@@ -199,7 +199,7 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask, | |||
199 | 199 | ||
200 | f->flush_mm = NULL; | 200 | f->flush_mm = NULL; |
201 | f->flush_va = 0; | 201 | f->flush_va = 0; |
202 | spin_unlock(&f->tlbstate_lock); | 202 | raw_spin_unlock(&f->tlbstate_lock); |
203 | } | 203 | } |
204 | 204 | ||
205 | void native_flush_tlb_others(const struct cpumask *cpumask, | 205 | void native_flush_tlb_others(const struct cpumask *cpumask, |
@@ -223,7 +223,7 @@ static int __cpuinit init_smp_flush(void) | |||
223 | int i; | 223 | int i; |
224 | 224 | ||
225 | for (i = 0; i < ARRAY_SIZE(flush_state); i++) | 225 | for (i = 0; i < ARRAY_SIZE(flush_state); i++) |
226 | spin_lock_init(&flush_state[i].tlbstate_lock); | 226 | raw_spin_lock_init(&flush_state[i].tlbstate_lock); |
227 | 227 | ||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |