diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-10-15 09:27:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:53:15 -0400 |
commit | d6c88a507ef0b6afdb013cba4e7804ba7324d99a (patch) | |
tree | cdc4041acc212585e3920ad50bf2574cec04076d /init | |
parent | ee32c9732244bde4b9b59eeac2814c23e2b71f8d (diff) |
genirq: revert dynarray
Revert the dynarray changes. They need more thought and polishing.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'init')
-rw-r--r-- | init/Makefile | 2 | ||||
-rw-r--r-- | init/dyn_array.c | 120 | ||||
-rw-r--r-- | init/main.c | 11 |
3 files changed, 3 insertions, 130 deletions
diff --git a/init/Makefile b/init/Makefile index dc5eeca6eb6d..4a243df426f7 100644 --- a/init/Makefile +++ b/init/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := main.o dyn_array.o version.o mounts.o | 5 | obj-y := main.o version.o mounts.o |
6 | ifneq ($(CONFIG_BLK_DEV_INITRD),y) | 6 | ifneq ($(CONFIG_BLK_DEV_INITRD),y) |
7 | obj-y += noinitramfs.o | 7 | obj-y += noinitramfs.o |
8 | else | 8 | else |
diff --git a/init/dyn_array.c b/init/dyn_array.c deleted file mode 100644 index c8d5e2a18588..000000000000 --- a/init/dyn_array.c +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | #include <linux/types.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/kallsyms.h> | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/bootmem.h> | ||
6 | #include <linux/irq.h> | ||
7 | |||
8 | void __init pre_alloc_dyn_array(void) | ||
9 | { | ||
10 | #ifdef CONFIG_HAVE_DYN_ARRAY | ||
11 | unsigned long total_size = 0, size, phys; | ||
12 | unsigned long max_align = 1; | ||
13 | struct dyn_array **daa; | ||
14 | char *ptr; | ||
15 | |||
16 | /* get the total size at first */ | ||
17 | for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) { | ||
18 | struct dyn_array *da = *daa; | ||
19 | |||
20 | printk(KERN_DEBUG "dyn_array %pF size:%#lx nr:%d align:%#lx\n", | ||
21 | da->name, da->size, *da->nr, da->align); | ||
22 | size = da->size * (*da->nr); | ||
23 | total_size += roundup(size, da->align); | ||
24 | if (da->align > max_align) | ||
25 | max_align = da->align; | ||
26 | } | ||
27 | if (total_size) | ||
28 | printk(KERN_DEBUG "dyn_array total_size: %#lx\n", | ||
29 | total_size); | ||
30 | else | ||
31 | return; | ||
32 | |||
33 | /* allocate them all together */ | ||
34 | max_align = max_t(unsigned long, max_align, PAGE_SIZE); | ||
35 | ptr = __alloc_bootmem(total_size, max_align, 0); | ||
36 | phys = virt_to_phys(ptr); | ||
37 | |||
38 | for (daa = __dyn_array_start ; daa < __dyn_array_end; daa++) { | ||
39 | struct dyn_array *da = *daa; | ||
40 | |||
41 | size = da->size * (*da->nr); | ||
42 | phys = roundup(phys, da->align); | ||
43 | printk(KERN_DEBUG "dyn_array %pF ==> [%#lx - %#lx]\n", | ||
44 | da->name, phys, phys + size); | ||
45 | *da->name = phys_to_virt(phys); | ||
46 | |||
47 | phys += size; | ||
48 | |||
49 | if (da->init_work) | ||
50 | da->init_work(da); | ||
51 | } | ||
52 | #else | ||
53 | #ifdef CONFIG_GENERIC_HARDIRQS | ||
54 | unsigned int i; | ||
55 | |||
56 | for (i = 0; i < NR_IRQS; i++) | ||
57 | irq_desc[i].irq = i; | ||
58 | #endif | ||
59 | #endif | ||
60 | } | ||
61 | |||
62 | unsigned long __init per_cpu_dyn_array_size(unsigned long *align) | ||
63 | { | ||
64 | unsigned long total_size = 0; | ||
65 | #ifdef CONFIG_HAVE_DYN_ARRAY | ||
66 | unsigned long size; | ||
67 | struct dyn_array **daa; | ||
68 | unsigned max_align = 1; | ||
69 | |||
70 | for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) { | ||
71 | struct dyn_array *da = *daa; | ||
72 | |||
73 | printk(KERN_DEBUG "per_cpu_dyn_array %pF size:%#lx nr:%d align:%#lx\n", | ||
74 | da->name, da->size, *da->nr, da->align); | ||
75 | size = da->size * (*da->nr); | ||
76 | total_size += roundup(size, da->align); | ||
77 | if (da->align > max_align) | ||
78 | max_align = da->align; | ||
79 | } | ||
80 | if (total_size) { | ||
81 | printk(KERN_DEBUG "per_cpu_dyn_array total_size: %#lx\n", | ||
82 | total_size); | ||
83 | *align = max_align; | ||
84 | } | ||
85 | #endif | ||
86 | return total_size; | ||
87 | } | ||
88 | |||
89 | #ifdef CONFIG_SMP | ||
90 | void __init per_cpu_alloc_dyn_array(int cpu, char *ptr) | ||
91 | { | ||
92 | #ifdef CONFIG_HAVE_DYN_ARRAY | ||
93 | unsigned long size, phys; | ||
94 | struct dyn_array **daa; | ||
95 | unsigned long addr; | ||
96 | void **array; | ||
97 | |||
98 | phys = virt_to_phys(ptr); | ||
99 | for (daa = __per_cpu_dyn_array_start ; daa < __per_cpu_dyn_array_end; daa++) { | ||
100 | struct dyn_array *da = *daa; | ||
101 | |||
102 | size = da->size * (*da->nr); | ||
103 | phys = roundup(phys, da->align); | ||
104 | printk(KERN_DEBUG "per_cpu_dyn_array %pF ==> [%#lx - %#lx]\n", | ||
105 | da->name, phys, phys + size); | ||
106 | |||
107 | addr = (unsigned long)da->name; | ||
108 | addr += per_cpu_offset(cpu); | ||
109 | array = (void **)addr; | ||
110 | *array = phys_to_virt(phys); | ||
111 | *da->name = *array; /* so init_work could use it directly */ | ||
112 | |||
113 | phys += size; | ||
114 | |||
115 | if (da->init_work) | ||
116 | da->init_work(da); | ||
117 | } | ||
118 | #endif | ||
119 | } | ||
120 | #endif | ||
diff --git a/init/main.c b/init/main.c index e81cf427d9c7..27f6bf6108e9 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -391,23 +391,17 @@ EXPORT_SYMBOL(__per_cpu_offset); | |||
391 | 391 | ||
392 | static void __init setup_per_cpu_areas(void) | 392 | static void __init setup_per_cpu_areas(void) |
393 | { | 393 | { |
394 | unsigned long size, i, old_size; | 394 | unsigned long size, i; |
395 | char *ptr; | 395 | char *ptr; |
396 | unsigned long nr_possible_cpus = num_possible_cpus(); | 396 | unsigned long nr_possible_cpus = num_possible_cpus(); |
397 | unsigned long align = 1; | ||
398 | unsigned da_size; | ||
399 | 397 | ||
400 | /* Copy section for each CPU (we discard the original) */ | 398 | /* Copy section for each CPU (we discard the original) */ |
401 | old_size = PERCPU_ENOUGH_ROOM; | 399 | size = ALIGN(PERCPU_ENOUGH_ROOM, PAGE_SIZE); |
402 | da_size = per_cpu_dyn_array_size(&align); | ||
403 | align = max_t(unsigned long, PAGE_SIZE, align); | ||
404 | size = ALIGN(old_size + da_size, align); | ||
405 | ptr = alloc_bootmem_pages(size * nr_possible_cpus); | 400 | ptr = alloc_bootmem_pages(size * nr_possible_cpus); |
406 | 401 | ||
407 | for_each_possible_cpu(i) { | 402 | for_each_possible_cpu(i) { |
408 | __per_cpu_offset[i] = ptr - __per_cpu_start; | 403 | __per_cpu_offset[i] = ptr - __per_cpu_start; |
409 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 404 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); |
410 | per_cpu_alloc_dyn_array(i, ptr + old_size); | ||
411 | ptr += size; | 405 | ptr += size; |
412 | } | 406 | } |
413 | } | 407 | } |
@@ -573,7 +567,6 @@ asmlinkage void __init start_kernel(void) | |||
573 | printk(KERN_NOTICE); | 567 | printk(KERN_NOTICE); |
574 | printk(linux_banner); | 568 | printk(linux_banner); |
575 | setup_arch(&command_line); | 569 | setup_arch(&command_line); |
576 | pre_alloc_dyn_array(); | ||
577 | mm_init_owner(&init_mm, &init_task); | 570 | mm_init_owner(&init_mm, &init_task); |
578 | setup_command_line(command_line); | 571 | setup_command_line(command_line); |
579 | unwind_setup(); | 572 | unwind_setup(); |