aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2009-09-22 19:45:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:41 -0400
commitc30bb2a25fcfde6157e6154a32c14686fb0bedbe (patch)
treeafa4811d46e5f9035a035b2c8c864bbb6c5af049
parent2ef43ec772551e975a6ea7cf22b59c84955aadf9 (diff)
kcore: add kclist types
Presently, kclist_add() only eats start address and size as its arguments. Considering to make kclist dynamically reconfigulable, it's necessary to know which kclists are for System RAM and which are not. This patch add kclist types as KCORE_RAM KCORE_VMALLOC KCORE_TEXT KCORE_OTHER This "type" is used in a patch following this for detecting KCORE_RAM. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/ia64/mm/init.c7
-rw-r--r--arch/mips/mm/init.c7
-rw-r--r--arch/powerpc/mm/init_32.c4
-rw-r--r--arch/powerpc/mm/init_64.c5
-rw-r--r--arch/sh/mm/init.c4
-rw-r--r--arch/x86/mm/init_32.c4
-rw-r--r--arch/x86/mm/init_64.c11
-rw-r--r--fs/proc/kcore.c3
-rw-r--r--include/linux/proc_fs.h13
9 files changed, 36 insertions, 22 deletions
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 1d286244a562..f6a3c21a2826 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -639,9 +639,10 @@ mem_init (void)
639 639
640 high_memory = __va(max_low_pfn * PAGE_SIZE); 640 high_memory = __va(max_low_pfn * PAGE_SIZE);
641 641
642 kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE); 642 kclist_add(&kcore_mem, __va(0), max_low_pfn * PAGE_SIZE, KCORE_RAM);
643 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START); 643 kclist_add(&kcore_vmem, (void *)VMALLOC_START,
644 kclist_add(&kcore_kernel, _stext, _end - _stext); 644 VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
645 kclist_add(&kcore_kernel, _stext, _end - _stext, KCORE_TEXT);
645 646
646 for_each_online_pgdat(pgdat) 647 for_each_online_pgdat(pgdat)
647 if (pgdat->bdata->node_bootmem_map) 648 if (pgdat->bdata->node_bootmem_map)
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 1f4ee4797a6e..f8661985bff6 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -409,11 +409,12 @@ void __init mem_init(void)
409 if ((unsigned long) &_text > (unsigned long) CKSEG0) 409 if ((unsigned long) &_text > (unsigned long) CKSEG0)
410 /* The -4 is a hack so that user tools don't have to handle 410 /* The -4 is a hack so that user tools don't have to handle
411 the overflow. */ 411 the overflow. */
412 kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4); 412 kclist_add(&kcore_kseg0, (void *) CKSEG0,
413 0x80000000 - 4, KCORE_TEXT);
413#endif 414#endif
414 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); 415 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
415 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, 416 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
416 VMALLOC_END-VMALLOC_START); 417 VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
417 418
418 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 419 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
419 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n", 420 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 3ef5084b90ca..e91add90ec54 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -268,11 +268,11 @@ static int __init setup_kcore(void)
268 size); 268 size);
269 } 269 }
270 270
271 kclist_add(kcore_mem, __va(base), size); 271 kclist_add(kcore_mem, __va(base), size, KCORE_RAM);
272 } 272 }
273 273
274 kclist_add(&kcore_vmem, (void *)VMALLOC_START, 274 kclist_add(&kcore_vmem, (void *)VMALLOC_START,
275 VMALLOC_END-VMALLOC_START); 275 VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
276 276
277 return 0; 277 return 0;
278} 278}
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 31582329cd67..9ee563101b56 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -128,10 +128,11 @@ static int __init setup_kcore(void)
128 if (!kcore_mem) 128 if (!kcore_mem)
129 panic("%s: kmalloc failed\n", __func__); 129 panic("%s: kmalloc failed\n", __func__);
130 130
131 kclist_add(kcore_mem, __va(base), size); 131 kclist_add(kcore_mem, __va(base), size, KCORE_RAM);
132 } 132 }
133 133
134 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START); 134 kclist_add(&kcore_vmem, (void *)VMALLOC_START,
135 VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
135 136
136 return 0; 137 return 0;
137} 138}
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index fabb7c6f48d2..ef56c9f9d7ba 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -226,9 +226,9 @@ void __init mem_init(void)
226 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 226 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
227 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 227 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
228 228
229 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); 229 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
230 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, 230 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
231 VMALLOC_END - VMALLOC_START); 231 VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
232 232
233 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " 233 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
234 "%dk data, %dk init)\n", 234 "%dk data, %dk init)\n",
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index b49b4f67453d..2cbc40112932 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -886,9 +886,9 @@ void __init mem_init(void)
886 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 886 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
887 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 887 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
888 888
889 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); 889 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
890 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, 890 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
891 VMALLOC_END-VMALLOC_START); 891 VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
892 892
893 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " 893 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
894 "%dk reserved, %dk data, %dk init, %ldk highmem)\n", 894 "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 810bd31e7f5f..c05810b614fe 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -677,13 +677,14 @@ void __init mem_init(void)
677 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 677 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
678 678
679 /* Register memory areas for /proc/kcore */ 679 /* Register memory areas for /proc/kcore */
680 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT); 680 kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
681 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START, 681 kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
682 VMALLOC_END-VMALLOC_START); 682 VMALLOC_END-VMALLOC_START, KCORE_VMALLOC);
683 kclist_add(&kcore_kernel, &_stext, _end - _stext); 683 kclist_add(&kcore_kernel, &_stext, _end - _stext, KCORE_TEXT);
684 kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN); 684 kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN,
685 KCORE_OTHER);
685 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 686 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
686 VSYSCALL_END - VSYSCALL_START); 687 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
687 688
688 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 689 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
689 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n", 690 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index f9327e51ce99..659c1635db81 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -62,10 +62,11 @@ static LIST_HEAD(kclist_head);
62static DEFINE_RWLOCK(kclist_lock); 62static DEFINE_RWLOCK(kclist_lock);
63 63
64void 64void
65kclist_add(struct kcore_list *new, void *addr, size_t size) 65kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
66{ 66{
67 new->addr = (unsigned long)addr; 67 new->addr = (unsigned long)addr;
68 new->size = size; 68 new->size = size;
69 new->type = type;
69 70
70 write_lock(&kclist_lock); 71 write_lock(&kclist_lock);
71 list_add_tail(&new->list, &kclist_head); 72 list_add_tail(&new->list, &kclist_head);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 0aff2a62eba9..bd7b840765a0 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -78,10 +78,18 @@ struct proc_dir_entry {
78 struct list_head pde_openers; /* who did ->open, but not ->release */ 78 struct list_head pde_openers; /* who did ->open, but not ->release */
79}; 79};
80 80
81enum kcore_type {
82 KCORE_TEXT,
83 KCORE_VMALLOC,
84 KCORE_RAM,
85 KCORE_OTHER,
86};
87
81struct kcore_list { 88struct kcore_list {
82 struct list_head list; 89 struct list_head list;
83 unsigned long addr; 90 unsigned long addr;
84 size_t size; 91 size_t size;
92 int type;
85}; 93};
86 94
87struct vmcore { 95struct vmcore {
@@ -233,11 +241,12 @@ static inline void dup_mm_exe_file(struct mm_struct *oldmm,
233#endif /* CONFIG_PROC_FS */ 241#endif /* CONFIG_PROC_FS */
234 242
235#if !defined(CONFIG_PROC_KCORE) 243#if !defined(CONFIG_PROC_KCORE)
236static inline void kclist_add(struct kcore_list *new, void *addr, size_t size) 244static inline void
245kclist_add(struct kcore_list *new, void *addr, size_t size, int type)
237{ 246{
238} 247}
239#else 248#else
240extern void kclist_add(struct kcore_list *, void *, size_t); 249extern void kclist_add(struct kcore_list *, void *, size_t, int type);
241#endif 250#endif
242 251
243union proc_op { 252union proc_op {