aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-14 08:22:37 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-14 08:22:37 -0400
commit6967963d6d5cac40a091d075326f0e3ccb95c58a (patch)
treea9c29ac6450a7d1dc815f9d97f726ecd59271812 /init
parent9b1a88c7105f593cc61a7acd3c51fcf4bf7b8038 (diff)
parent34e51ce60a210094bd66cf0a75dd8512247618ca (diff)
Merge branch 'for-2.6.30' into for-2.6.31
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig386
-rw-r--r--init/do_mounts.c14
-rw-r--r--init/do_mounts.h1
-rw-r--r--init/do_mounts_md.c10
-rw-r--r--init/do_mounts_rd.c178
-rw-r--r--init/initramfs.c200
-rw-r--r--init/main.c33
7 files changed, 417 insertions, 405 deletions
diff --git a/init/Kconfig b/init/Kconfig
index a724a149bf3f..f2f9b5362b48 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -101,6 +101,66 @@ config LOCALVERSION_AUTO
101 101
102 which is done within the script "scripts/setlocalversion".) 102 which is done within the script "scripts/setlocalversion".)
103 103
104config HAVE_KERNEL_GZIP
105 bool
106
107config HAVE_KERNEL_BZIP2
108 bool
109
110config HAVE_KERNEL_LZMA
111 bool
112
113choice
114 prompt "Kernel compression mode"
115 default KERNEL_GZIP
116 depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA
117 help
118 The linux kernel is a kind of self-extracting executable.
119 Several compression algorithms are available, which differ
120 in efficiency, compression and decompression speed.
121 Compression speed is only relevant when building a kernel.
122 Decompression speed is relevant at each boot.
123
124 If you have any problems with bzip2 or lzma compressed
125 kernels, mail me (Alain Knaff) <alain@knaff.lu>. (An older
126 version of this functionality (bzip2 only), for 2.4, was
127 supplied by Christian Ludwig)
128
129 High compression options are mostly useful for users, who
130 are low on disk space (embedded systems), but for whom ram
131 size matters less.
132
133 If in doubt, select 'gzip'
134
135config KERNEL_GZIP
136 bool "Gzip"
137 depends on HAVE_KERNEL_GZIP
138 help
139 The old and tried gzip compression. Its compression ratio is
140 the poorest among the 3 choices; however its speed (both
141 compression and decompression) is the fastest.
142
143config KERNEL_BZIP2
144 bool "Bzip2"
145 depends on HAVE_KERNEL_BZIP2
146 help
147 Its compression ratio and speed is intermediate.
148 Decompression speed is slowest among the three. The kernel
149 size is about 10% smaller with bzip2, in comparison to gzip.
150 Bzip2 uses a large amount of memory. For modern kernels you
151 will need at least 8MB RAM or more for booting.
152
153config KERNEL_LZMA
154 bool "LZMA"
155 depends on HAVE_KERNEL_LZMA
156 help
157 The most recent compression algorithm.
158 Its ratio is best, decompression speed is between the other
159 two. Compression is slowest. The kernel size is about 33%
160 smaller with LZMA in comparison to gzip.
161
162endchoice
163
104config SWAP 164config SWAP
105 bool "Support for paging of anonymous memory (swap)" 165 bool "Support for paging of anonymous memory (swap)"
106 depends on MMU && BLOCK 166 depends on MMU && BLOCK
@@ -148,6 +208,12 @@ config POSIX_MQUEUE
148 208
149 If unsure, say Y. 209 If unsure, say Y.
150 210
211config POSIX_MQUEUE_SYSCTL
212 bool
213 depends on POSIX_MQUEUE
214 depends on SYSCTL
215 default y
216
151config BSD_PROCESS_ACCT 217config BSD_PROCESS_ACCT
152 bool "BSD Process Accounting" 218 bool "BSD Process Accounting"
153 help 219 help
@@ -238,6 +304,98 @@ config AUDIT_TREE
238 def_bool y 304 def_bool y
239 depends on AUDITSYSCALL && INOTIFY 305 depends on AUDITSYSCALL && INOTIFY
240 306
307menu "RCU Subsystem"
308
309choice
310 prompt "RCU Implementation"
311 default CLASSIC_RCU
312
313config CLASSIC_RCU
314 bool "Classic RCU"
315 help
316 This option selects the classic RCU implementation that is
317 designed for best read-side performance on non-realtime
318 systems.
319
320 Select this option if you are unsure.
321
322config TREE_RCU
323 bool "Tree-based hierarchical RCU"
324 help
325 This option selects the RCU implementation that is
326 designed for very large SMP system with hundreds or
327 thousands of CPUs.
328
329config PREEMPT_RCU
330 bool "Preemptible RCU"
331 depends on PREEMPT
332 help
333 This option reduces the latency of the kernel by making certain
334 RCU sections preemptible. Normally RCU code is non-preemptible, if
335 this option is selected then read-only RCU sections become
336 preemptible. This helps latency, but may expose bugs due to
337 now-naive assumptions about each RCU read-side critical section
338 remaining on a given CPU through its execution.
339
340endchoice
341
342config RCU_TRACE
343 bool "Enable tracing for RCU"
344 depends on TREE_RCU || PREEMPT_RCU
345 help
346 This option provides tracing in RCU which presents stats
347 in debugfs for debugging RCU implementation.
348
349 Say Y here if you want to enable RCU tracing
350 Say N if you are unsure.
351
352config RCU_FANOUT
353 int "Tree-based hierarchical RCU fanout value"
354 range 2 64 if 64BIT
355 range 2 32 if !64BIT
356 depends on TREE_RCU
357 default 64 if 64BIT
358 default 32 if !64BIT
359 help
360 This option controls the fanout of hierarchical implementations
361 of RCU, allowing RCU to work efficiently on machines with
362 large numbers of CPUs. This value must be at least the cube
363 root of NR_CPUS, which allows NR_CPUS up to 32,768 for 32-bit
364 systems and up to 262,144 for 64-bit systems.
365
366 Select a specific number if testing RCU itself.
367 Take the default if unsure.
368
369config RCU_FANOUT_EXACT
370 bool "Disable tree-based hierarchical RCU auto-balancing"
371 depends on TREE_RCU
372 default n
373 help
374 This option forces use of the exact RCU_FANOUT value specified,
375 regardless of imbalances in the hierarchy. This is useful for
376 testing RCU itself, and might one day be useful on systems with
377 strong NUMA behavior.
378
379 Without RCU_FANOUT_EXACT, the code will balance the hierarchy.
380
381 Say N if unsure.
382
383config TREE_RCU_TRACE
384 def_bool RCU_TRACE && TREE_RCU
385 select DEBUG_FS
386 help
387 This option provides tracing for the TREE_RCU implementation,
388 permitting Makefile to trivially select kernel/rcutree_trace.c.
389
390config PREEMPT_RCU_TRACE
391 def_bool RCU_TRACE && PREEMPT_RCU
392 select DEBUG_FS
393 help
394 This option provides tracing for the PREEMPT_RCU implementation,
395 permitting Makefile to trivially select kernel/rcupreempt_trace.c.
396
397endmenu # "RCU Subsystem"
398
241config IKCONFIG 399config IKCONFIG
242 tristate "Kernel .config support" 400 tristate "Kernel .config support"
243 ---help--- 401 ---help---
@@ -323,26 +481,26 @@ config CGROUP_SCHED
323 This option allows you to create arbitrary task groups 481 This option allows you to create arbitrary task groups
324 using the "cgroup" pseudo filesystem and control 482 using the "cgroup" pseudo filesystem and control
325 the cpu bandwidth allocated to each such task group. 483 the cpu bandwidth allocated to each such task group.
326 Refer to Documentation/cgroups.txt for more information 484 Refer to Documentation/cgroups/cgroups.txt for more
327 on "cgroup" pseudo filesystem. 485 information on "cgroup" pseudo filesystem.
328 486
329endchoice 487endchoice
330 488
331menu "Control Group support" 489menuconfig CGROUPS
332config CGROUPS 490 boolean "Control Group support"
333 bool "Control Group support"
334 help 491 help
335 This option add support for grouping sets of processes together, for 492 This option adds support for grouping sets of processes together, for
336 use with process control subsystems such as Cpusets, CFS, memory 493 use with process control subsystems such as Cpusets, CFS, memory
337 controls or device isolation. 494 controls or device isolation.
338 See 495 See
339 - Documentation/cpusets.txt (Cpusets)
340 - Documentation/scheduler/sched-design-CFS.txt (CFS) 496 - Documentation/scheduler/sched-design-CFS.txt (CFS)
341 - Documentation/cgroups/ (features for grouping, isolation) 497 - Documentation/cgroups/ (features for grouping, isolation
342 - Documentation/controllers/ (features for resource control) 498 and resource control)
343 499
344 Say N if unsure. 500 Say N if unsure.
345 501
502if CGROUPS
503
346config CGROUP_DEBUG 504config CGROUP_DEBUG
347 bool "Example debug cgroup subsystem" 505 bool "Example debug cgroup subsystem"
348 depends on CGROUPS 506 depends on CGROUPS
@@ -350,24 +508,24 @@ config CGROUP_DEBUG
350 help 508 help
351 This option enables a simple cgroup subsystem that 509 This option enables a simple cgroup subsystem that
352 exports useful debugging information about the cgroups 510 exports useful debugging information about the cgroups
353 framework 511 framework.
354 512
355 Say N if unsure 513 Say N if unsure.
356 514
357config CGROUP_NS 515config CGROUP_NS
358 bool "Namespace cgroup subsystem" 516 bool "Namespace cgroup subsystem"
359 depends on CGROUPS 517 depends on CGROUPS
360 help 518 help
361 Provides a simple namespace cgroup subsystem to 519 Provides a simple namespace cgroup subsystem to
362 provide hierarchical naming of sets of namespaces, 520 provide hierarchical naming of sets of namespaces,
363 for instance virtual servers and checkpoint/restart 521 for instance virtual servers and checkpoint/restart
364 jobs. 522 jobs.
365 523
366config CGROUP_FREEZER 524config CGROUP_FREEZER
367 bool "control group freezer subsystem" 525 bool "Freezer cgroup subsystem"
368 depends on CGROUPS 526 depends on CGROUPS
369 help 527 help
370 Provides a way to freeze and unfreeze all tasks in a 528 Provides a way to freeze and unfreeze all tasks in a
371 cgroup. 529 cgroup.
372 530
373config CGROUP_DEVICE 531config CGROUP_DEVICE
@@ -379,7 +537,7 @@ config CGROUP_DEVICE
379 537
380config CPUSETS 538config CPUSETS
381 bool "Cpuset support" 539 bool "Cpuset support"
382 depends on SMP && CGROUPS 540 depends on CGROUPS
383 help 541 help
384 This option will let you create and manage CPUSETs which 542 This option will let you create and manage CPUSETs which
385 allow dynamically partitioning a system into sets of CPUs and 543 allow dynamically partitioning a system into sets of CPUs and
@@ -388,18 +546,23 @@ config CPUSETS
388 546
389 Say N if unsure. 547 Say N if unsure.
390 548
549config PROC_PID_CPUSET
550 bool "Include legacy /proc/<pid>/cpuset file"
551 depends on CPUSETS
552 default y
553
391config CGROUP_CPUACCT 554config CGROUP_CPUACCT
392 bool "Simple CPU accounting cgroup subsystem" 555 bool "Simple CPU accounting cgroup subsystem"
393 depends on CGROUPS 556 depends on CGROUPS
394 help 557 help
395 Provides a simple Resource Controller for monitoring the 558 Provides a simple Resource Controller for monitoring the
396 total CPU consumed by the tasks in a cgroup 559 total CPU consumed by the tasks in a cgroup.
397 560
398config RESOURCE_COUNTERS 561config RESOURCE_COUNTERS
399 bool "Resource counters" 562 bool "Resource counters"
400 help 563 help
401 This option enables controller independent resource accounting 564 This option enables controller independent resource accounting
402 infrastructure that works with cgroups 565 infrastructure that works with cgroups.
403 depends on CGROUPS 566 depends on CGROUPS
404 567
405config CGROUP_MEM_RES_CTLR 568config CGROUP_MEM_RES_CTLR
@@ -408,7 +571,7 @@ config CGROUP_MEM_RES_CTLR
408 select MM_OWNER 571 select MM_OWNER
409 help 572 help
410 Provides a memory resource controller that manages both anonymous 573 Provides a memory resource controller that manages both anonymous
411 memory and page cache. (See Documentation/controllers/memory.txt) 574 memory and page cache. (See Documentation/cgroups/memory.txt)
412 575
413 Note that setting this option increases fixed memory overhead 576 Note that setting this option increases fixed memory overhead
414 associated with each page of memory in the system. By this, 577 associated with each page of memory in the system. By this,
@@ -425,9 +588,6 @@ config CGROUP_MEM_RES_CTLR
425 This config option also selects MM_OWNER config option, which 588 This config option also selects MM_OWNER config option, which
426 could in turn add some fork/exit overhead. 589 could in turn add some fork/exit overhead.
427 590
428config MM_OWNER
429 bool
430
431config CGROUP_MEM_RES_CTLR_SWAP 591config CGROUP_MEM_RES_CTLR_SWAP
432 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)" 592 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)"
433 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL 593 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL
@@ -443,9 +603,13 @@ config CGROUP_MEM_RES_CTLR_SWAP
443 is disabled by boot option, this will be automatically disabled and 603 is disabled by boot option, this will be automatically disabled and
444 there will be no overhead from this. Even when you set this config=y, 604 there will be no overhead from this. Even when you set this config=y,
445 if boot option "noswapaccount" is set, swap will not be accounted. 605 if boot option "noswapaccount" is set, swap will not be accounted.
606 Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page
607 size is 4096bytes, 512k per 1Gbytes of swap.
446 608
609endif # CGROUPS
447 610
448endmenu 611config MM_OWNER
612 bool
449 613
450config SYSFS_DEPRECATED 614config SYSFS_DEPRECATED
451 bool 615 bool
@@ -483,11 +647,6 @@ config SYSFS_DEPRECATED_V2
483 if the original kernel, that came with your distribution, has 647 if the original kernel, that came with your distribution, has
484 this option set to N. 648 this option set to N.
485 649
486config PROC_PID_CPUSET
487 bool "Include legacy /proc/<pid>/cpuset file"
488 depends on CPUSETS
489 default y
490
491config RELAY 650config RELAY
492 bool "Kernel->user space relay support (formerly relayfs)" 651 bool "Kernel->user space relay support (formerly relayfs)"
493 help 652 help
@@ -517,10 +676,10 @@ config UTS_NS
517 676
518config IPC_NS 677config IPC_NS
519 bool "IPC namespace" 678 bool "IPC namespace"
520 depends on NAMESPACES && SYSVIPC 679 depends on NAMESPACES && (SYSVIPC || POSIX_MQUEUE)
521 help 680 help
522 In this namespace tasks work with IPC ids which correspond to 681 In this namespace tasks work with IPC ids which correspond to
523 different IPC objects in different namespaces 682 different IPC objects in different namespaces.
524 683
525config USER_NS 684config USER_NS
526 bool "User namespace (EXPERIMENTAL)" 685 bool "User namespace (EXPERIMENTAL)"
@@ -536,12 +695,20 @@ config PID_NS
536 depends on NAMESPACES && EXPERIMENTAL 695 depends on NAMESPACES && EXPERIMENTAL
537 help 696 help
538 Support process id namespaces. This allows having multiple 697 Support process id namespaces. This allows having multiple
539 process with the same pid as long as they are in different 698 processes with the same pid as long as they are in different
540 pid namespaces. This is a building block of containers. 699 pid namespaces. This is a building block of containers.
541 700
542 Unless you want to work with an experimental feature 701 Unless you want to work with an experimental feature
543 say N here. 702 say N here.
544 703
704config NET_NS
705 bool "Network namespace"
706 default n
707 depends on NAMESPACES && EXPERIMENTAL && NET
708 help
709 Allow user space to create what appear to be multiple instances
710 of the network stack.
711
545config BLK_DEV_INITRD 712config BLK_DEV_INITRD
546 bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" 713 bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support"
547 depends on BROKEN || !FRV 714 depends on BROKEN || !FRV
@@ -576,6 +743,9 @@ config CC_OPTIMIZE_FOR_SIZE
576config SYSCTL 743config SYSCTL
577 bool 744 bool
578 745
746config ANON_INODES
747 bool
748
579menuconfig EMBEDDED 749menuconfig EMBEDDED
580 bool "Configure standard kernel features (for small systems)" 750 bool "Configure standard kernel features (for small systems)"
581 help 751 help
@@ -626,13 +796,6 @@ config KALLSYMS_ALL
626 796
627 Say N. 797 Say N.
628 798
629config KALLSYMS_STRIP_GENERATED
630 bool "Strip machine generated symbols from kallsyms"
631 depends on KALLSYMS_ALL
632 default y
633 help
634 Say N if you want kallsyms to retain even machine generated symbols.
635
636config KALLSYMS_EXTRA_PASS 799config KALLSYMS_EXTRA_PASS
637 bool "Do an extra kallsyms pass" 800 bool "Do an extra kallsyms pass"
638 depends on KALLSYMS 801 depends on KALLSYMS
@@ -688,18 +851,6 @@ config PCSPKR_PLATFORM
688 This option allows to disable the internal PC-Speaker 851 This option allows to disable the internal PC-Speaker
689 support, saving some memory. 852 support, saving some memory.
690 853
691config COMPAT_BRK
692 bool "Disable heap randomization"
693 default y
694 help
695 Randomizing heap placement makes heap exploits harder, but it
696 also breaks ancient binaries (including anything libc5 based).
697 This option changes the bootup default to heap randomization
698 disabled, and can be overriden runtime by setting
699 /proc/sys/kernel/randomize_va_space to 2.
700
701 On non-ancient distros (post-2000 ones) N is usually a safe choice.
702
703config BASE_FULL 854config BASE_FULL
704 default y 855 default y
705 bool "Enable full-sized data structures for core" if EMBEDDED 856 bool "Enable full-sized data structures for core" if EMBEDDED
@@ -717,9 +868,6 @@ config FUTEX
717 support for "fast userspace mutexes". The resulting kernel may not 868 support for "fast userspace mutexes". The resulting kernel may not
718 run glibc-based applications correctly. 869 run glibc-based applications correctly.
719 870
720config ANON_INODES
721 bool
722
723config EPOLL 871config EPOLL
724 bool "Enable eventpoll support" if EMBEDDED 872 bool "Enable eventpoll support" if EMBEDDED
725 default y 873 default y
@@ -805,6 +953,18 @@ config SLUB_DEBUG
805 SLUB sysfs support. /sys/slab will not exist and there will be 953 SLUB sysfs support. /sys/slab will not exist and there will be
806 no support for cache validation etc. 954 no support for cache validation etc.
807 955
956config COMPAT_BRK
957 bool "Disable heap randomization"
958 default y
959 help
960 Randomizing heap placement makes heap exploits harder, but it
961 also breaks ancient binaries (including anything libc5 based).
962 This option changes the bootup default to heap randomization
963 disabled, and can be overridden at runtime by setting
964 /proc/sys/kernel/randomize_va_space to 2.
965
966 On non-ancient distros (post-2000 ones) N is usually a safe choice.
967
808choice 968choice
809 prompt "Choose SLAB allocator" 969 prompt "Choose SLAB allocator"
810 default SLUB 970 default SLUB
@@ -853,13 +1013,27 @@ config TRACEPOINTS
853 1013
854config MARKERS 1014config MARKERS
855 bool "Activate markers" 1015 bool "Activate markers"
856 depends on TRACEPOINTS 1016 select TRACEPOINTS
857 help 1017 help
858 Place an empty function call at each marker site. Can be 1018 Place an empty function call at each marker site. Can be
859 dynamically changed for a probe function. 1019 dynamically changed for a probe function.
860 1020
861source "arch/Kconfig" 1021source "arch/Kconfig"
862 1022
1023config SLOW_WORK
1024 default n
1025 bool
1026 help
1027 The slow work thread pool provides a number of dynamically allocated
1028 threads that can be used by the kernel to perform operations that
1029 take a relatively long time.
1030
1031 An example of this would be CacheFiles doing a path lookup followed
1032 by a series of mkdirs and a create call, all of which have to touch
1033 disk.
1034
1035 See Documentation/slow-work.txt.
1036
863endmenu # General setup 1037endmenu # General setup
864 1038
865config HAVE_GENERIC_DMA_COHERENT 1039config HAVE_GENERIC_DMA_COHERENT
@@ -874,7 +1048,6 @@ config SLABINFO
874 1048
875config RT_MUTEXES 1049config RT_MUTEXES
876 boolean 1050 boolean
877 select PLIST
878 1051
879config BASE_SMALL 1052config BASE_SMALL
880 int 1053 int
@@ -959,7 +1132,7 @@ config INIT_ALL_POSSIBLE
959 cpu_possible_map, some of them chose to initialize cpu_possible_map 1132 cpu_possible_map, some of them chose to initialize cpu_possible_map
960 with all 1s, and others with all 0s. When they were centralised, 1133 with all 1s, and others with all 0s. When they were centralised,
961 it was better to provide this option than to break all the archs 1134 it was better to provide this option than to break all the archs
962 and have several arch maintainers persuing me down dark alleys. 1135 and have several arch maintainers pursuing me down dark alleys.
963 1136
964config STOP_MACHINE 1137config STOP_MACHINE
965 bool 1138 bool
@@ -973,90 +1146,3 @@ source "block/Kconfig"
973config PREEMPT_NOTIFIERS 1146config PREEMPT_NOTIFIERS
974 bool 1147 bool
975 1148
976choice
977 prompt "RCU Implementation"
978 default CLASSIC_RCU
979
980config CLASSIC_RCU
981 bool "Classic RCU"
982 help
983 This option selects the classic RCU implementation that is
984 designed for best read-side performance on non-realtime
985 systems.
986
987 Select this option if you are unsure.
988
989config TREE_RCU
990 bool "Tree-based hierarchical RCU"
991 help
992 This option selects the RCU implementation that is
993 designed for very large SMP system with hundreds or
994 thousands of CPUs.
995
996config PREEMPT_RCU
997 bool "Preemptible RCU"
998 depends on PREEMPT
999 help
1000 This option reduces the latency of the kernel by making certain
1001 RCU sections preemptible. Normally RCU code is non-preemptible, if
1002 this option is selected then read-only RCU sections become
1003 preemptible. This helps latency, but may expose bugs due to
1004 now-naive assumptions about each RCU read-side critical section
1005 remaining on a given CPU through its execution.
1006
1007endchoice
1008
1009config RCU_TRACE
1010 bool "Enable tracing for RCU"
1011 depends on TREE_RCU || PREEMPT_RCU
1012 help
1013 This option provides tracing in RCU which presents stats
1014 in debugfs for debugging RCU implementation.
1015
1016 Say Y here if you want to enable RCU tracing
1017 Say N if you are unsure.
1018
1019config RCU_FANOUT
1020 int "Tree-based hierarchical RCU fanout value"
1021 range 2 64 if 64BIT
1022 range 2 32 if !64BIT
1023 depends on TREE_RCU
1024 default 64 if 64BIT
1025 default 32 if !64BIT
1026 help
1027 This option controls the fanout of hierarchical implementations
1028 of RCU, allowing RCU to work efficiently on machines with
1029 large numbers of CPUs. This value must be at least the cube
1030 root of NR_CPUS, which allows NR_CPUS up to 32,768 for 32-bit
1031 systems and up to 262,144 for 64-bit systems.
1032
1033 Select a specific number if testing RCU itself.
1034 Take the default if unsure.
1035
1036config RCU_FANOUT_EXACT
1037 bool "Disable tree-based hierarchical RCU auto-balancing"
1038 depends on TREE_RCU
1039 default n
1040 help
1041 This option forces use of the exact RCU_FANOUT value specified,
1042 regardless of imbalances in the hierarchy. This is useful for
1043 testing RCU itself, and might one day be useful on systems with
1044 strong NUMA behavior.
1045
1046 Without RCU_FANOUT_EXACT, the code will balance the hierarchy.
1047
1048 Say N if unsure.
1049
1050config TREE_RCU_TRACE
1051 def_bool RCU_TRACE && TREE_RCU
1052 select DEBUG_FS
1053 help
1054 This option provides tracing for the TREE_RCU implementation,
1055 permitting Makefile to trivially select kernel/rcutree_trace.c.
1056
1057config PREEMPT_RCU_TRACE
1058 def_bool RCU_TRACE && PREEMPT_RCU
1059 select DEBUG_FS
1060 help
1061 This option provides tracing for the PREEMPT_RCU implementation,
1062 permitting Makefile to trivially select kernel/rcupreempt_trace.c.
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 708105e163df..dd7ee5f203f3 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -14,6 +14,7 @@
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/initrd.h> 15#include <linux/initrd.h>
16#include <linux/async.h> 16#include <linux/async.h>
17#include <linux/fs_struct.h>
17 18
18#include <linux/nfs_fs.h> 19#include <linux/nfs_fs.h>
19#include <linux/nfs_fs_sb.h> 20#include <linux/nfs_fs_sb.h>
@@ -370,10 +371,14 @@ void __init prepare_namespace(void)
370 ssleep(root_delay); 371 ssleep(root_delay);
371 } 372 }
372 373
373 /* wait for the known devices to complete their probing */ 374 /*
374 while (driver_probe_done() != 0) 375 * wait for the known devices to complete their probing
375 msleep(100); 376 *
376 async_synchronize_full(); 377 * Note: this is a potential source of long boot delays.
378 * For example, it is not atypical to wait 5 seconds here
379 * for the touchpad of a laptop to initialize.
380 */
381 wait_for_device_probe();
377 382
378 md_run_setup(); 383 md_run_setup();
379 384
@@ -399,6 +404,7 @@ void __init prepare_namespace(void)
399 while (driver_probe_done() != 0 || 404 while (driver_probe_done() != 0 ||
400 (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0) 405 (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
401 msleep(100); 406 msleep(100);
407 async_synchronize_full();
402 } 408 }
403 409
404 is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR; 410 is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
diff --git a/init/do_mounts.h b/init/do_mounts.h
index 9aa968d54329..f5b978a9bb92 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -1,4 +1,5 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/blkdev.h>
2#include <linux/init.h> 3#include <linux/init.h>
3#include <linux/syscalls.h> 4#include <linux/syscalls.h>
4#include <linux/unistd.h> 5#include <linux/unistd.h>
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index ff95e3192884..69aebbf8fd2d 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -1,5 +1,6 @@
1#include <linux/delay.h> 1#include <linux/delay.h>
2#include <linux/raid/md.h> 2#include <linux/raid/md_u.h>
3#include <linux/raid/md_p.h>
3 4
4#include "do_mounts.h" 5#include "do_mounts.h"
5 6
@@ -112,8 +113,6 @@ static int __init md_setup(char *str)
112 return 1; 113 return 1;
113} 114}
114 115
115#define MdpMinorShift 6
116
117static void __init md_setup_drive(void) 116static void __init md_setup_drive(void)
118{ 117{
119 int minor, i, ent, partitioned; 118 int minor, i, ent, partitioned;
@@ -281,8 +280,9 @@ static void __init autodetect_raid(void)
281 */ 280 */
282 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n"); 281 printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
283 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n"); 282 printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
284 while (driver_probe_done() < 0) 283
285 msleep(100); 284 wait_for_device_probe();
285
286 fd = sys_open("/dev/md0", 0, 0); 286 fd = sys_open("/dev/md0", 0, 0);
287 if (fd >= 0) { 287 if (fd >= 0) {
288 sys_ioctl(fd, RAID_AUTORUN, raid_autopart); 288 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 0f0f0cf3ba9a..027a402708de 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -11,6 +11,9 @@
11#include "do_mounts.h" 11#include "do_mounts.h"
12#include "../fs/squashfs/squashfs_fs.h" 12#include "../fs/squashfs/squashfs_fs.h"
13 13
14#include <linux/decompress/generic.h>
15
16
14int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */ 17int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */
15 18
16static int __init prompt_ramdisk(char *str) 19static int __init prompt_ramdisk(char *str)
@@ -29,7 +32,7 @@ static int __init ramdisk_start_setup(char *str)
29} 32}
30__setup("ramdisk_start=", ramdisk_start_setup); 33__setup("ramdisk_start=", ramdisk_start_setup);
31 34
32static int __init crd_load(int in_fd, int out_fd); 35static int __init crd_load(int in_fd, int out_fd, decompress_fn deco);
33 36
34/* 37/*
35 * This routine tries to find a RAM disk image to load, and returns the 38 * This routine tries to find a RAM disk image to load, and returns the
@@ -38,15 +41,15 @@ static int __init crd_load(int in_fd, int out_fd);
38 * numbers could not be found. 41 * numbers could not be found.
39 * 42 *
40 * We currently check for the following magic numbers: 43 * We currently check for the following magic numbers:
41 * minix 44 * minix
42 * ext2 45 * ext2
43 * romfs 46 * romfs
44 * cramfs 47 * cramfs
45 * squashfs 48 * squashfs
46 * gzip 49 * gzip
47 */ 50 */
48static int __init 51static int __init
49identify_ramdisk_image(int fd, int start_block) 52identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
50{ 53{
51 const int size = 512; 54 const int size = 512;
52 struct minix_super_block *minixsb; 55 struct minix_super_block *minixsb;
@@ -56,6 +59,7 @@ identify_ramdisk_image(int fd, int start_block)
56 struct squashfs_super_block *squashfsb; 59 struct squashfs_super_block *squashfsb;
57 int nblocks = -1; 60 int nblocks = -1;
58 unsigned char *buf; 61 unsigned char *buf;
62 const char *compress_name;
59 63
60 buf = kmalloc(size, GFP_KERNEL); 64 buf = kmalloc(size, GFP_KERNEL);
61 if (!buf) 65 if (!buf)
@@ -69,18 +73,19 @@ identify_ramdisk_image(int fd, int start_block)
69 memset(buf, 0xe5, size); 73 memset(buf, 0xe5, size);
70 74
71 /* 75 /*
72 * Read block 0 to test for gzipped kernel 76 * Read block 0 to test for compressed kernel
73 */ 77 */
74 sys_lseek(fd, start_block * BLOCK_SIZE, 0); 78 sys_lseek(fd, start_block * BLOCK_SIZE, 0);
75 sys_read(fd, buf, size); 79 sys_read(fd, buf, size);
76 80
77 /* 81 *decompressor = decompress_method(buf, size, &compress_name);
78 * If it matches the gzip magic numbers, return 0 82 if (compress_name) {
79 */ 83 printk(KERN_NOTICE "RAMDISK: %s image found at block %d\n",
80 if (buf[0] == 037 && ((buf[1] == 0213) || (buf[1] == 0236))) { 84 compress_name, start_block);
81 printk(KERN_NOTICE 85 if (!*decompressor)
82 "RAMDISK: Compressed image found at block %d\n", 86 printk(KERN_EMERG
83 start_block); 87 "RAMDISK: %s decompressor not configured!\n",
88 compress_name);
84 nblocks = 0; 89 nblocks = 0;
85 goto done; 90 goto done;
86 } 91 }
@@ -142,7 +147,7 @@ identify_ramdisk_image(int fd, int start_block)
142 printk(KERN_NOTICE 147 printk(KERN_NOTICE
143 "RAMDISK: Couldn't find valid RAM disk image starting at %d.\n", 148 "RAMDISK: Couldn't find valid RAM disk image starting at %d.\n",
144 start_block); 149 start_block);
145 150
146done: 151done:
147 sys_lseek(fd, start_block * BLOCK_SIZE, 0); 152 sys_lseek(fd, start_block * BLOCK_SIZE, 0);
148 kfree(buf); 153 kfree(buf);
@@ -157,6 +162,7 @@ int __init rd_load_image(char *from)
157 int nblocks, i, disk; 162 int nblocks, i, disk;
158 char *buf = NULL; 163 char *buf = NULL;
159 unsigned short rotate = 0; 164 unsigned short rotate = 0;
165 decompress_fn decompressor = NULL;
160#if !defined(CONFIG_S390) && !defined(CONFIG_PPC_ISERIES) 166#if !defined(CONFIG_S390) && !defined(CONFIG_PPC_ISERIES)
161 char rotator[4] = { '|' , '/' , '-' , '\\' }; 167 char rotator[4] = { '|' , '/' , '-' , '\\' };
162#endif 168#endif
@@ -169,12 +175,12 @@ int __init rd_load_image(char *from)
169 if (in_fd < 0) 175 if (in_fd < 0)
170 goto noclose_input; 176 goto noclose_input;
171 177
172 nblocks = identify_ramdisk_image(in_fd, rd_image_start); 178 nblocks = identify_ramdisk_image(in_fd, rd_image_start, &decompressor);
173 if (nblocks < 0) 179 if (nblocks < 0)
174 goto done; 180 goto done;
175 181
176 if (nblocks == 0) { 182 if (nblocks == 0) {
177 if (crd_load(in_fd, out_fd) == 0) 183 if (crd_load(in_fd, out_fd, decompressor) == 0)
178 goto successful_load; 184 goto successful_load;
179 goto done; 185 goto done;
180 } 186 }
@@ -200,7 +206,7 @@ int __init rd_load_image(char *from)
200 nblocks, rd_blocks); 206 nblocks, rd_blocks);
201 goto done; 207 goto done;
202 } 208 }
203 209
204 /* 210 /*
205 * OK, time to copy in the data 211 * OK, time to copy in the data
206 */ 212 */
@@ -273,138 +279,48 @@ int __init rd_load_disk(int n)
273 return rd_load_image("/dev/root"); 279 return rd_load_image("/dev/root");
274} 280}
275 281
276/*
277 * gzip declarations
278 */
279
280#define OF(args) args
281
282#ifndef memzero
283#define memzero(s, n) memset ((s), 0, (n))
284#endif
285
286typedef unsigned char uch;
287typedef unsigned short ush;
288typedef unsigned long ulg;
289
290#define INBUFSIZ 4096
291#define WSIZE 0x8000 /* window size--must be a power of two, and */
292 /* at least 32K for zip's deflate method */
293
294static uch *inbuf;
295static uch *window;
296
297static unsigned insize; /* valid bytes in inbuf */
298static unsigned inptr; /* index of next byte to be processed in inbuf */
299static unsigned outcnt; /* bytes in output buffer */
300static int exit_code; 282static int exit_code;
301static int unzip_error; 283static int decompress_error;
302static long bytes_out;
303static int crd_infd, crd_outfd; 284static int crd_infd, crd_outfd;
304 285
305#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf()) 286static int __init compr_fill(void *buf, unsigned int len)
306
307/* Diagnostic functions (stubbed out) */
308#define Assert(cond,msg)
309#define Trace(x)
310#define Tracev(x)
311#define Tracevv(x)
312#define Tracec(c,x)
313#define Tracecv(c,x)
314
315#define STATIC static
316#define INIT __init
317
318static int __init fill_inbuf(void);
319static void __init flush_window(void);
320static void __init error(char *m);
321
322#define NO_INFLATE_MALLOC
323
324#include "../lib/inflate.c"
325
326/* ===========================================================================
327 * Fill the input buffer. This is called only when the buffer is empty
328 * and at least one byte is really needed.
329 * Returning -1 does not guarantee that gunzip() will ever return.
330 */
331static int __init fill_inbuf(void)
332{ 287{
333 if (exit_code) return -1; 288 int r = sys_read(crd_infd, buf, len);
334 289 if (r < 0)
335 insize = sys_read(crd_infd, inbuf, INBUFSIZ); 290 printk(KERN_ERR "RAMDISK: error while reading compressed data");
336 if (insize == 0) { 291 else if (r == 0)
337 error("RAMDISK: ran out of compressed data"); 292 printk(KERN_ERR "RAMDISK: EOF while reading compressed data");
338 return -1; 293 return r;
339 }
340
341 inptr = 1;
342
343 return inbuf[0];
344} 294}
345 295
346/* =========================================================================== 296static int __init compr_flush(void *window, unsigned int outcnt)
347 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
348 * (Used for the decompressed data only.)
349 */
350static void __init flush_window(void)
351{ 297{
352 ulg c = crc; /* temporary variable */ 298 int written = sys_write(crd_outfd, window, outcnt);
353 unsigned n, written; 299 if (written != outcnt) {
354 uch *in, ch; 300 if (decompress_error == 0)
355 301 printk(KERN_ERR
356 written = sys_write(crd_outfd, window, outcnt); 302 "RAMDISK: incomplete write (%d != %d)\n",
357 if (written != outcnt && unzip_error == 0) { 303 written, outcnt);
358 printk(KERN_ERR "RAMDISK: incomplete write (%d != %d) %ld\n", 304 decompress_error = 1;
359 written, outcnt, bytes_out); 305 return -1;
360 unzip_error = 1; 306 }
361 } 307 return outcnt;
362 in = window;
363 for (n = 0; n < outcnt; n++) {
364 ch = *in++;
365 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
366 }
367 crc = c;
368 bytes_out += (ulg)outcnt;
369 outcnt = 0;
370} 308}
371 309
372static void __init error(char *x) 310static void __init error(char *x)
373{ 311{
374 printk(KERN_ERR "%s\n", x); 312 printk(KERN_ERR "%s\n", x);
375 exit_code = 1; 313 exit_code = 1;
376 unzip_error = 1; 314 decompress_error = 1;
377} 315}
378 316
379static int __init crd_load(int in_fd, int out_fd) 317static int __init crd_load(int in_fd, int out_fd, decompress_fn deco)
380{ 318{
381 int result; 319 int result;
382
383 insize = 0; /* valid bytes in inbuf */
384 inptr = 0; /* index of next byte to be processed in inbuf */
385 outcnt = 0; /* bytes in output buffer */
386 exit_code = 0;
387 bytes_out = 0;
388 crc = (ulg)0xffffffffL; /* shift register contents */
389
390 crd_infd = in_fd; 320 crd_infd = in_fd;
391 crd_outfd = out_fd; 321 crd_outfd = out_fd;
392 inbuf = kmalloc(INBUFSIZ, GFP_KERNEL); 322 result = deco(NULL, 0, compr_fill, compr_flush, NULL, NULL, error);
393 if (!inbuf) { 323 if (decompress_error)
394 printk(KERN_ERR "RAMDISK: Couldn't allocate gzip buffer\n");
395 return -1;
396 }
397 window = kmalloc(WSIZE, GFP_KERNEL);
398 if (!window) {
399 printk(KERN_ERR "RAMDISK: Couldn't allocate gzip window\n");
400 kfree(inbuf);
401 return -1;
402 }
403 makecrc();
404 result = gunzip();
405 if (unzip_error)
406 result = 1; 324 result = 1;
407 kfree(inbuf);
408 kfree(window);
409 return result; 325 return result;
410} 326}
diff --git a/init/initramfs.c b/init/initramfs.c
index d9c941c0c3ca..80cd713f6cc5 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -5,6 +5,7 @@
5#include <linux/fcntl.h> 5#include <linux/fcntl.h>
6#include <linux/delay.h> 6#include <linux/delay.h>
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/dirent.h>
8#include <linux/syscalls.h> 9#include <linux/syscalls.h>
9#include <linux/utime.h> 10#include <linux/utime.h>
10 11
@@ -166,8 +167,6 @@ static __initdata char *victim;
166static __initdata unsigned count; 167static __initdata unsigned count;
167static __initdata loff_t this_header, next_header; 168static __initdata loff_t this_header, next_header;
168 169
169static __initdata int dry_run;
170
171static inline void __init eat(unsigned n) 170static inline void __init eat(unsigned n)
172{ 171{
173 victim += n; 172 victim += n;
@@ -229,10 +228,6 @@ static int __init do_header(void)
229 parse_header(collected); 228 parse_header(collected);
230 next_header = this_header + N_ALIGN(name_len) + body_len; 229 next_header = this_header + N_ALIGN(name_len) + body_len;
231 next_header = (next_header + 3) & ~3; 230 next_header = (next_header + 3) & ~3;
232 if (dry_run) {
233 read_into(name_buf, N_ALIGN(name_len), GotName);
234 return 0;
235 }
236 state = SkipIt; 231 state = SkipIt;
237 if (name_len <= 0 || name_len > PATH_MAX) 232 if (name_len <= 0 || name_len > PATH_MAX)
238 return 0; 233 return 0;
@@ -303,8 +298,6 @@ static int __init do_name(void)
303 free_hash(); 298 free_hash();
304 return 0; 299 return 0;
305 } 300 }
306 if (dry_run)
307 return 0;
308 clean_path(collected, mode); 301 clean_path(collected, mode);
309 if (S_ISREG(mode)) { 302 if (S_ISREG(mode)) {
310 int ml = maybe_link(); 303 int ml = maybe_link();
@@ -390,11 +383,13 @@ static int __init write_buffer(char *buf, unsigned len)
390 return len - count; 383 return len - count;
391} 384}
392 385
393static void __init flush_buffer(char *buf, unsigned len) 386static int __init flush_buffer(void *bufv, unsigned len)
394{ 387{
388 char *buf = (char *) bufv;
395 int written; 389 int written;
390 int origLen = len;
396 if (message) 391 if (message)
397 return; 392 return -1;
398 while ((written = write_buffer(buf, len)) < len && !message) { 393 while ((written = write_buffer(buf, len)) < len && !message) {
399 char c = buf[written]; 394 char c = buf[written];
400 if (c == '0') { 395 if (c == '0') {
@@ -408,84 +403,27 @@ static void __init flush_buffer(char *buf, unsigned len)
408 } else 403 } else
409 error("junk in compressed archive"); 404 error("junk in compressed archive");
410 } 405 }
406 return origLen;
411} 407}
412 408
413/* 409static unsigned my_inptr; /* index of next byte to be processed in inbuf */
414 * gzip declarations
415 */
416
417#define OF(args) args
418
419#ifndef memzero
420#define memzero(s, n) memset ((s), 0, (n))
421#endif
422
423typedef unsigned char uch;
424typedef unsigned short ush;
425typedef unsigned long ulg;
426 410
427#define WSIZE 0x8000 /* window size--must be a power of two, and */ 411#include <linux/decompress/generic.h>
428 /* at least 32K for zip's deflate method */
429
430static uch *inbuf;
431static uch *window;
432
433static unsigned insize; /* valid bytes in inbuf */
434static unsigned inptr; /* index of next byte to be processed in inbuf */
435static unsigned outcnt; /* bytes in output buffer */
436static long bytes_out;
437
438#define get_byte() (inptr < insize ? inbuf[inptr++] : -1)
439
440/* Diagnostic functions (stubbed out) */
441#define Assert(cond,msg)
442#define Trace(x)
443#define Tracev(x)
444#define Tracevv(x)
445#define Tracec(c,x)
446#define Tracecv(c,x)
447
448#define STATIC static
449#define INIT __init
450
451static void __init flush_window(void);
452static void __init error(char *m);
453
454#define NO_INFLATE_MALLOC
455
456#include "../lib/inflate.c"
457
458/* ===========================================================================
459 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
460 * (Used for the decompressed data only.)
461 */
462static void __init flush_window(void)
463{
464 ulg c = crc; /* temporary variable */
465 unsigned n;
466 uch *in, ch;
467
468 flush_buffer(window, outcnt);
469 in = window;
470 for (n = 0; n < outcnt; n++) {
471 ch = *in++;
472 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
473 }
474 crc = c;
475 bytes_out += (ulg)outcnt;
476 outcnt = 0;
477}
478 412
479static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) 413static char * __init unpack_to_rootfs(char *buf, unsigned len)
480{ 414{
481 int written; 415 int written;
482 dry_run = check_only; 416 decompress_fn decompress;
417 const char *compress_name;
418 static __initdata char msg_buf[64];
419
483 header_buf = kmalloc(110, GFP_KERNEL); 420 header_buf = kmalloc(110, GFP_KERNEL);
484 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL); 421 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
485 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL); 422 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL);
486 window = kmalloc(WSIZE, GFP_KERNEL); 423
487 if (!window || !header_buf || !symlink_buf || !name_buf) 424 if (!header_buf || !symlink_buf || !name_buf)
488 panic("can't allocate buffers"); 425 panic("can't allocate buffers");
426
489 state = Start; 427 state = Start;
490 this_header = 0; 428 this_header = 0;
491 message = NULL; 429 message = NULL;
@@ -505,22 +443,25 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
505 continue; 443 continue;
506 } 444 }
507 this_header = 0; 445 this_header = 0;
508 insize = len; 446 decompress = decompress_method(buf, len, &compress_name);
509 inbuf = buf; 447 if (decompress)
510 inptr = 0; 448 decompress(buf, len, NULL, flush_buffer, NULL,
511 outcnt = 0; /* bytes in output buffer */ 449 &my_inptr, error);
512 bytes_out = 0; 450 else if (compress_name) {
513 crc = (ulg)0xffffffffL; /* shift register contents */ 451 if (!message) {
514 makecrc(); 452 snprintf(msg_buf, sizeof msg_buf,
515 gunzip(); 453 "compression method %s not configured",
454 compress_name);
455 message = msg_buf;
456 }
457 }
516 if (state != Reset) 458 if (state != Reset)
517 error("junk in gzipped archive"); 459 error("junk in compressed archive");
518 this_header = saved_offset + inptr; 460 this_header = saved_offset + my_inptr;
519 buf += inptr; 461 buf += my_inptr;
520 len -= inptr; 462 len -= my_inptr;
521 } 463 }
522 dir_utime(); 464 dir_utime();
523 kfree(window);
524 kfree(name_buf); 465 kfree(name_buf);
525 kfree(symlink_buf); 466 kfree(symlink_buf);
526 kfree(header_buf); 467 kfree(header_buf);
@@ -574,26 +515,76 @@ skip:
574 initrd_end = 0; 515 initrd_end = 0;
575} 516}
576 517
518#define BUF_SIZE 1024
519static void __init clean_rootfs(void)
520{
521 int fd;
522 void *buf;
523 struct linux_dirent64 *dirp;
524 int count;
525
526 fd = sys_open("/", O_RDONLY, 0);
527 WARN_ON(fd < 0);
528 if (fd < 0)
529 return;
530 buf = kzalloc(BUF_SIZE, GFP_KERNEL);
531 WARN_ON(!buf);
532 if (!buf) {
533 sys_close(fd);
534 return;
535 }
536
537 dirp = buf;
538 count = sys_getdents64(fd, dirp, BUF_SIZE);
539 while (count > 0) {
540 while (count > 0) {
541 struct stat st;
542 int ret;
543
544 ret = sys_newlstat(dirp->d_name, &st);
545 WARN_ON_ONCE(ret);
546 if (!ret) {
547 if (S_ISDIR(st.st_mode))
548 sys_rmdir(dirp->d_name);
549 else
550 sys_unlink(dirp->d_name);
551 }
552
553 count -= dirp->d_reclen;
554 dirp = (void *)dirp + dirp->d_reclen;
555 }
556 dirp = buf;
557 memset(buf, 0, BUF_SIZE);
558 count = sys_getdents64(fd, dirp, BUF_SIZE);
559 }
560
561 sys_close(fd);
562 kfree(buf);
563}
564
577static int __init populate_rootfs(void) 565static int __init populate_rootfs(void)
578{ 566{
579 char *err = unpack_to_rootfs(__initramfs_start, 567 char *err = unpack_to_rootfs(__initramfs_start,
580 __initramfs_end - __initramfs_start, 0); 568 __initramfs_end - __initramfs_start);
581 if (err) 569 if (err)
582 panic(err); 570 panic(err); /* Failed to decompress INTERNAL initramfs */
583 if (initrd_start) { 571 if (initrd_start) {
584#ifdef CONFIG_BLK_DEV_RAM 572#ifdef CONFIG_BLK_DEV_RAM
585 int fd; 573 int fd;
586 printk(KERN_INFO "checking if image is initramfs..."); 574 printk(KERN_INFO "checking if image is initramfs...\n");
587 err = unpack_to_rootfs((char *)initrd_start, 575 err = unpack_to_rootfs((char *)initrd_start,
588 initrd_end - initrd_start, 1); 576 initrd_end - initrd_start);
589 if (!err) { 577 if (!err) {
590 printk(" it is\n"); 578 printk(KERN_INFO "rootfs image is initramfs; unpacking...\n");
591 unpack_to_rootfs((char *)initrd_start,
592 initrd_end - initrd_start, 0);
593 free_initrd(); 579 free_initrd();
594 return 0; 580 return 0;
581 } else {
582 clean_rootfs();
583 unpack_to_rootfs(__initramfs_start,
584 __initramfs_end - __initramfs_start);
595 } 585 }
596 printk("it isn't (%s); looks like an initrd\n", err); 586 printk(KERN_INFO "rootfs image is not initramfs (%s)"
587 "; looks like an initrd\n", err);
597 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); 588 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700);
598 if (fd >= 0) { 589 if (fd >= 0) {
599 sys_write(fd, (char *)initrd_start, 590 sys_write(fd, (char *)initrd_start,
@@ -604,10 +595,13 @@ static int __init populate_rootfs(void)
604#else 595#else
605 printk(KERN_INFO "Unpacking initramfs..."); 596 printk(KERN_INFO "Unpacking initramfs...");
606 err = unpack_to_rootfs((char *)initrd_start, 597 err = unpack_to_rootfs((char *)initrd_start,
607 initrd_end - initrd_start, 0); 598 initrd_end - initrd_start);
608 if (err) 599 if (err) {
609 panic(err); 600 printk(" failed!\n");
610 printk(" done\n"); 601 printk(KERN_EMERG "%s\n", err);
602 } else {
603 printk(" done\n");
604 }
611 free_initrd(); 605 free_initrd();
612#endif 606#endif
613 } 607 }
diff --git a/init/main.c b/init/main.c
index 844209453c02..3585f073d636 100644
--- a/init/main.c
+++ b/init/main.c
@@ -14,6 +14,7 @@
14#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/syscalls.h> 16#include <linux/syscalls.h>
17#include <linux/stackprotector.h>
17#include <linux/string.h> 18#include <linux/string.h>
18#include <linux/ctype.h> 19#include <linux/ctype.h>
19#include <linux/delay.h> 20#include <linux/delay.h>
@@ -70,6 +71,7 @@
70#include <asm/setup.h> 71#include <asm/setup.h>
71#include <asm/sections.h> 72#include <asm/sections.h>
72#include <asm/cacheflush.h> 73#include <asm/cacheflush.h>
74#include <trace/kmemtrace.h>
73 75
74#ifdef CONFIG_X86_LOCAL_APIC 76#ifdef CONFIG_X86_LOCAL_APIC
75#include <asm/smp.h> 77#include <asm/smp.h>
@@ -97,7 +99,7 @@ static inline void mark_rodata_ro(void) { }
97extern void tc_init(void); 99extern void tc_init(void);
98#endif 100#endif
99 101
100enum system_states system_state; 102enum system_states system_state __read_mostly;
101EXPORT_SYMBOL(system_state); 103EXPORT_SYMBOL(system_state);
102 104
103/* 105/*
@@ -135,14 +137,14 @@ unsigned int __initdata setup_max_cpus = NR_CPUS;
135 * greater than 0, limits the maximum number of CPUs activated in 137 * greater than 0, limits the maximum number of CPUs activated in
136 * SMP mode to <NUM>. 138 * SMP mode to <NUM>.
137 */ 139 */
138#ifndef CONFIG_X86_IO_APIC 140
139static inline void disable_ioapic_setup(void) {}; 141void __weak arch_disable_smp_support(void) { }
140#endif
141 142
142static int __init nosmp(char *str) 143static int __init nosmp(char *str)
143{ 144{
144 setup_max_cpus = 0; 145 setup_max_cpus = 0;
145 disable_ioapic_setup(); 146 arch_disable_smp_support();
147
146 return 0; 148 return 0;
147} 149}
148 150
@@ -152,14 +154,14 @@ static int __init maxcpus(char *str)
152{ 154{
153 get_option(&str, &setup_max_cpus); 155 get_option(&str, &setup_max_cpus);
154 if (setup_max_cpus == 0) 156 if (setup_max_cpus == 0)
155 disable_ioapic_setup(); 157 arch_disable_smp_support();
156 158
157 return 0; 159 return 0;
158} 160}
159 161
160early_param("maxcpus", maxcpus); 162early_param("maxcpus", maxcpus);
161#else 163#else
162#define setup_max_cpus NR_CPUS 164const unsigned int setup_max_cpus = NR_CPUS;
163#endif 165#endif
164 166
165/* 167/*
@@ -406,8 +408,7 @@ static void __init smp_init(void)
406 * Set up the current CPU as possible to migrate to. 408 * Set up the current CPU as possible to migrate to.
407 * The other ones will be done by cpu_up/cpu_down() 409 * The other ones will be done by cpu_up/cpu_down()
408 */ 410 */
409 cpu = smp_processor_id(); 411 set_cpu_active(smp_processor_id(), true);
410 cpu_set(cpu, cpu_active_map);
411 412
412 /* FIXME: This should be done in userspace --RR */ 413 /* FIXME: This should be done in userspace --RR */
413 for_each_present_cpu(cpu) { 414 for_each_present_cpu(cpu) {
@@ -463,6 +464,7 @@ static noinline void __init_refok rest_init(void)
463 * at least once to get things moving: 464 * at least once to get things moving:
464 */ 465 */
465 init_idle_bootup_task(current); 466 init_idle_bootup_task(current);
467 rcu_scheduler_starting();
466 preempt_enable_no_resched(); 468 preempt_enable_no_resched();
467 schedule(); 469 schedule();
468 preempt_disable(); 470 preempt_disable();
@@ -539,6 +541,12 @@ asmlinkage void __init start_kernel(void)
539 */ 541 */
540 lockdep_init(); 542 lockdep_init();
541 debug_objects_early_init(); 543 debug_objects_early_init();
544
545 /*
546 * Set up the the initial canary ASAP:
547 */
548 boot_init_stack_canary();
549
542 cgroup_init_early(); 550 cgroup_init_early();
543 551
544 local_irq_disable(); 552 local_irq_disable();
@@ -641,6 +649,7 @@ asmlinkage void __init start_kernel(void)
641 enable_debug_pagealloc(); 649 enable_debug_pagealloc();
642 cpu_hotplug_init(); 650 cpu_hotplug_init();
643 kmem_cache_init(); 651 kmem_cache_init();
652 kmemtrace_init();
644 debug_objects_mem_init(); 653 debug_objects_mem_init();
645 idr_init_cache(); 654 idr_init_cache();
646 setup_per_cpu_pageset(); 655 setup_per_cpu_pageset();
@@ -762,6 +771,7 @@ static void __init do_basic_setup(void)
762{ 771{
763 rcu_init_sched(); /* needed by module_init stage. */ 772 rcu_init_sched(); /* needed by module_init stage. */
764 init_workqueues(); 773 init_workqueues();
774 cpuset_init_smp();
765 usermodehelper_init(); 775 usermodehelper_init();
766 driver_init(); 776 driver_init();
767 init_irq_proc(); 777 init_irq_proc();
@@ -786,6 +796,7 @@ static void run_init_process(char *init_filename)
786 * makes it inline to init() and it becomes part of init.text section 796 * makes it inline to init() and it becomes part of init.text section
787 */ 797 */
788static noinline int init_post(void) 798static noinline int init_post(void)
799 __releases(kernel_lock)
789{ 800{
790 /* need to finish all async __init code before freeing the memory */ 801 /* need to finish all async __init code before freeing the memory */
791 async_synchronize_full(); 802 async_synchronize_full();
@@ -834,7 +845,7 @@ static int __init kernel_init(void * unused)
834 /* 845 /*
835 * init can run on any cpu. 846 * init can run on any cpu.
836 */ 847 */
837 set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR); 848 set_cpus_allowed_ptr(current, cpu_all_mask);
838 /* 849 /*
839 * Tell the world that we're going to be the grim 850 * Tell the world that we're going to be the grim
840 * reaper of innocent orphaned children. 851 * reaper of innocent orphaned children.
@@ -855,8 +866,6 @@ static int __init kernel_init(void * unused)
855 smp_init(); 866 smp_init();
856 sched_init_smp(); 867 sched_init_smp();
857 868
858 cpuset_init_smp();
859
860 do_basic_setup(); 869 do_basic_setup();
861 870
862 /* 871 /*