diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 4 | ||||
-rw-r--r-- | init/calibrate.c | 94 | ||||
-rw-r--r-- | init/do_mounts.c | 3 | ||||
-rw-r--r-- | init/do_mounts.h | 1 | ||||
-rw-r--r-- | init/do_mounts_initrd.c | 9 | ||||
-rw-r--r-- | init/main.c | 10 |
6 files changed, 111 insertions, 10 deletions
diff --git a/init/Kconfig b/init/Kconfig index b1091d7542..05a75c4f5c 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -174,7 +174,7 @@ config AUDIT | |||
174 | 174 | ||
175 | config AUDITSYSCALL | 175 | config AUDITSYSCALL |
176 | bool "Enable system-call auditing support" | 176 | bool "Enable system-call auditing support" |
177 | depends on AUDIT && (X86 || PPC || PPC64 || ARCH_S390 || IA64 || UML) | 177 | depends on AUDIT && (X86 || PPC || PPC64 || ARCH_S390 || IA64 || UML || SPARC64) |
178 | default y if SECURITY_SELINUX | 178 | default y if SECURITY_SELINUX |
179 | help | 179 | help |
180 | Enable low-overhead system-call auditing infrastructure that | 180 | Enable low-overhead system-call auditing infrastructure that |
@@ -231,7 +231,7 @@ config CPUSETS | |||
231 | bool "Cpuset support" | 231 | bool "Cpuset support" |
232 | depends on SMP | 232 | depends on SMP |
233 | help | 233 | help |
234 | This options will let you create and manage CPUSET's which | 234 | This option will let you create and manage CPUSETs which |
235 | allow dynamically partitioning a system into sets of CPUs and | 235 | allow dynamically partitioning a system into sets of CPUs and |
236 | Memory Nodes and assigning tasks to run only within those sets. | 236 | Memory Nodes and assigning tasks to run only within those sets. |
237 | This is primarily useful on large SMP or NUMA systems. | 237 | This is primarily useful on large SMP or NUMA systems. |
diff --git a/init/calibrate.c b/init/calibrate.c index c698e04a3d..d206c7548f 100644 --- a/init/calibrate.c +++ b/init/calibrate.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | 10 | ||
11 | #include <asm/timex.h> | ||
12 | |||
11 | static unsigned long preset_lpj; | 13 | static unsigned long preset_lpj; |
12 | static int __init lpj_setup(char *str) | 14 | static int __init lpj_setup(char *str) |
13 | { | 15 | { |
@@ -17,6 +19,92 @@ static int __init lpj_setup(char *str) | |||
17 | 19 | ||
18 | __setup("lpj=", lpj_setup); | 20 | __setup("lpj=", lpj_setup); |
19 | 21 | ||
22 | #ifdef ARCH_HAS_READ_CURRENT_TIMER | ||
23 | |||
24 | /* This routine uses the read_current_timer() routine and gets the | ||
25 | * loops per jiffy directly, instead of guessing it using delay(). | ||
26 | * Also, this code tries to handle non-maskable asynchronous events | ||
27 | * (like SMIs) | ||
28 | */ | ||
29 | #define DELAY_CALIBRATION_TICKS ((HZ < 100) ? 1 : (HZ/100)) | ||
30 | #define MAX_DIRECT_CALIBRATION_RETRIES 5 | ||
31 | |||
32 | static unsigned long __devinit calibrate_delay_direct(void) | ||
33 | { | ||
34 | unsigned long pre_start, start, post_start; | ||
35 | unsigned long pre_end, end, post_end; | ||
36 | unsigned long start_jiffies; | ||
37 | unsigned long tsc_rate_min, tsc_rate_max; | ||
38 | unsigned long good_tsc_sum = 0; | ||
39 | unsigned long good_tsc_count = 0; | ||
40 | int i; | ||
41 | |||
42 | if (read_current_timer(&pre_start) < 0 ) | ||
43 | return 0; | ||
44 | |||
45 | /* | ||
46 | * A simple loop like | ||
47 | * while ( jiffies < start_jiffies+1) | ||
48 | * start = read_current_timer(); | ||
49 | * will not do. As we don't really know whether jiffy switch | ||
50 | * happened first or timer_value was read first. And some asynchronous | ||
51 | * event can happen between these two events introducing errors in lpj. | ||
52 | * | ||
53 | * So, we do | ||
54 | * 1. pre_start <- When we are sure that jiffy switch hasn't happened | ||
55 | * 2. check jiffy switch | ||
56 | * 3. start <- timer value before or after jiffy switch | ||
57 | * 4. post_start <- When we are sure that jiffy switch has happened | ||
58 | * | ||
59 | * Note, we don't know anything about order of 2 and 3. | ||
60 | * Now, by looking at post_start and pre_start difference, we can | ||
61 | * check whether any asynchronous event happened or not | ||
62 | */ | ||
63 | |||
64 | for (i = 0; i < MAX_DIRECT_CALIBRATION_RETRIES; i++) { | ||
65 | pre_start = 0; | ||
66 | read_current_timer(&start); | ||
67 | start_jiffies = jiffies; | ||
68 | while (jiffies <= (start_jiffies + 1)) { | ||
69 | pre_start = start; | ||
70 | read_current_timer(&start); | ||
71 | } | ||
72 | read_current_timer(&post_start); | ||
73 | |||
74 | pre_end = 0; | ||
75 | end = post_start; | ||
76 | while (jiffies <= | ||
77 | (start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) { | ||
78 | pre_end = end; | ||
79 | read_current_timer(&end); | ||
80 | } | ||
81 | read_current_timer(&post_end); | ||
82 | |||
83 | tsc_rate_max = (post_end - pre_start) / DELAY_CALIBRATION_TICKS; | ||
84 | tsc_rate_min = (pre_end - post_start) / DELAY_CALIBRATION_TICKS; | ||
85 | |||
86 | /* | ||
87 | * If the upper limit and lower limit of the tsc_rate is | ||
88 | * >= 12.5% apart, redo calibration. | ||
89 | */ | ||
90 | if (pre_start != 0 && pre_end != 0 && | ||
91 | (tsc_rate_max - tsc_rate_min) < (tsc_rate_max >> 3)) { | ||
92 | good_tsc_count++; | ||
93 | good_tsc_sum += tsc_rate_max; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | if (good_tsc_count) | ||
98 | return (good_tsc_sum/good_tsc_count); | ||
99 | |||
100 | printk(KERN_WARNING "calibrate_delay_direct() failed to get a good " | ||
101 | "estimate for loops_per_jiffy.\nProbably due to long platform interrupts. Consider using \"lpj=\" boot option.\n"); | ||
102 | return 0; | ||
103 | } | ||
104 | #else | ||
105 | static unsigned long __devinit calibrate_delay_direct(void) {return 0;} | ||
106 | #endif | ||
107 | |||
20 | /* | 108 | /* |
21 | * This is the number of bits of precision for the loops_per_jiffy. Each | 109 | * This is the number of bits of precision for the loops_per_jiffy. Each |
22 | * bit takes on average 1.5/HZ seconds. This (like the original) is a little | 110 | * bit takes on average 1.5/HZ seconds. This (like the original) is a little |
@@ -35,6 +123,12 @@ void __devinit calibrate_delay(void) | |||
35 | "%lu.%02lu BogoMIPS preset\n", | 123 | "%lu.%02lu BogoMIPS preset\n", |
36 | loops_per_jiffy/(500000/HZ), | 124 | loops_per_jiffy/(500000/HZ), |
37 | (loops_per_jiffy/(5000/HZ)) % 100); | 125 | (loops_per_jiffy/(5000/HZ)) % 100); |
126 | } else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) { | ||
127 | printk("Calibrating delay using timer specific routine.. "); | ||
128 | printk("%lu.%02lu BogoMIPS (lpj=%lu)\n", | ||
129 | loops_per_jiffy/(500000/HZ), | ||
130 | (loops_per_jiffy/(5000/HZ)) % 100, | ||
131 | loops_per_jiffy); | ||
38 | } else { | 132 | } else { |
39 | loops_per_jiffy = (1<<12); | 133 | loops_per_jiffy = (1<<12); |
40 | 134 | ||
diff --git a/init/do_mounts.c b/init/do_mounts.c index b7570c074d..4e11a9aaf1 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/root_dev.h> | 7 | #include <linux/root_dev.h> |
8 | #include <linux/security.h> | 8 | #include <linux/security.h> |
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | #include <linux/mount.h> | ||
10 | 11 | ||
11 | #include <linux/nfs_fs.h> | 12 | #include <linux/nfs_fs.h> |
12 | #include <linux/nfs_fs_sb.h> | 13 | #include <linux/nfs_fs_sb.h> |
@@ -25,8 +26,6 @@ static char __initdata saved_root_name[64]; | |||
25 | /* this is initialized in init/main.c */ | 26 | /* this is initialized in init/main.c */ |
26 | dev_t ROOT_DEV; | 27 | dev_t ROOT_DEV; |
27 | 28 | ||
28 | EXPORT_SYMBOL(ROOT_DEV); | ||
29 | |||
30 | static int __init load_ramdisk(char *str) | 29 | static int __init load_ramdisk(char *str) |
31 | { | 30 | { |
32 | rd_doload = simple_strtol(str,NULL,0) & 3; | 31 | rd_doload = simple_strtol(str,NULL,0) & 3; |
diff --git a/init/do_mounts.h b/init/do_mounts.h index de92bee4f3..e0a7ac9649 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/major.h> | 9 | #include <linux/major.h> |
10 | #include <linux/root_dev.h> | 10 | #include <linux/root_dev.h> |
11 | 11 | ||
12 | dev_t name_to_dev_t(char *name); | ||
13 | void change_floppy(char *fmt, ...); | 12 | void change_floppy(char *fmt, ...); |
14 | void mount_block_root(char *name, int flags); | 13 | void mount_block_root(char *name, int flags); |
15 | void mount_root(void); | 14 | void mount_root(void); |
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 07e7d31f2d..a05cabd0fd 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c | |||
@@ -41,7 +41,7 @@ static int __init do_linuxrc(void * shell) | |||
41 | static void __init handle_initrd(void) | 41 | static void __init handle_initrd(void) |
42 | { | 42 | { |
43 | int error; | 43 | int error; |
44 | int i, pid; | 44 | int pid; |
45 | 45 | ||
46 | real_root_dev = new_encode_dev(ROOT_DEV); | 46 | real_root_dev = new_encode_dev(ROOT_DEV); |
47 | create_dev("/dev/root.old", Root_RAM0, NULL); | 47 | create_dev("/dev/root.old", Root_RAM0, NULL); |
@@ -58,7 +58,7 @@ static void __init handle_initrd(void) | |||
58 | 58 | ||
59 | pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); | 59 | pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); |
60 | if (pid > 0) { | 60 | if (pid > 0) { |
61 | while (pid != sys_wait4(-1, &i, 0, NULL)) | 61 | while (pid != sys_wait4(-1, NULL, 0, NULL)) |
62 | yield(); | 62 | yield(); |
63 | } | 63 | } |
64 | 64 | ||
@@ -86,7 +86,10 @@ static void __init handle_initrd(void) | |||
86 | printk("okay\n"); | 86 | printk("okay\n"); |
87 | else { | 87 | else { |
88 | int fd = sys_open("/dev/root.old", O_RDWR, 0); | 88 | int fd = sys_open("/dev/root.old", O_RDWR, 0); |
89 | printk("failed\n"); | 89 | if (error == -ENOENT) |
90 | printk("/initrd does not exist. Ignored.\n"); | ||
91 | else | ||
92 | printk("failed\n"); | ||
90 | printk(KERN_NOTICE "Unmounting old root\n"); | 93 | printk(KERN_NOTICE "Unmounting old root\n"); |
91 | sys_umount("/old", MNT_DETACH); | 94 | sys_umount("/old", MNT_DETACH); |
92 | printk(KERN_NOTICE "Trying to free ramdisk memory ... "); | 95 | printk(KERN_NOTICE "Trying to free ramdisk memory ... "); |
diff --git a/init/main.c b/init/main.c index d324801729..c9c311cf17 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <asm/io.h> | 51 | #include <asm/io.h> |
52 | #include <asm/bugs.h> | 52 | #include <asm/bugs.h> |
53 | #include <asm/setup.h> | 53 | #include <asm/setup.h> |
54 | #include <asm/sections.h> | ||
54 | 55 | ||
55 | /* | 56 | /* |
56 | * This is one of the first .c files built. Error out early | 57 | * This is one of the first .c files built. Error out early |
@@ -323,8 +324,6 @@ static void __init setup_per_cpu_areas(void) | |||
323 | { | 324 | { |
324 | unsigned long size, i; | 325 | unsigned long size, i; |
325 | char *ptr; | 326 | char *ptr; |
326 | /* Created by linker magic */ | ||
327 | extern char __per_cpu_start[], __per_cpu_end[]; | ||
328 | 327 | ||
329 | /* Copy section for each CPU (we discard the original) */ | 328 | /* Copy section for each CPU (we discard the original) */ |
330 | size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); | 329 | size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); |
@@ -383,6 +382,13 @@ static void noinline rest_init(void) | |||
383 | numa_default_policy(); | 382 | numa_default_policy(); |
384 | unlock_kernel(); | 383 | unlock_kernel(); |
385 | preempt_enable_no_resched(); | 384 | preempt_enable_no_resched(); |
385 | |||
386 | /* | ||
387 | * The boot idle thread must execute schedule() | ||
388 | * at least one to get things moving: | ||
389 | */ | ||
390 | schedule(); | ||
391 | |||
386 | cpu_idle(); | 392 | cpu_idle(); |
387 | } | 393 | } |
388 | 394 | ||