aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig228
-rw-r--r--init/do_mounts.c86
-rw-r--r--init/do_mounts_initrd.c7
-rw-r--r--init/do_mounts_md.c2
-rw-r--r--init/do_mounts_rd.c4
-rw-r--r--init/initramfs.c5
-rw-r--r--init/main.c78
-rw-r--r--init/noinitramfs.c6
8 files changed, 242 insertions, 174 deletions
diff --git a/init/Kconfig b/init/Kconfig
index 5cff9a980c39..88c10468db46 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -21,6 +21,13 @@ config CONSTRUCTORS
21 depends on !UML 21 depends on !UML
22 default y 22 default y
23 23
24config HAVE_IRQ_WORK
25 bool
26
27config IRQ_WORK
28 bool
29 depends on HAVE_IRQ_WORK
30
24menu "General setup" 31menu "General setup"
25 32
26config EXPERIMENTAL 33config EXPERIMENTAL
@@ -64,7 +71,7 @@ config BROKEN_ON_SMP
64 71
65config LOCK_KERNEL 72config LOCK_KERNEL
66 bool 73 bool
67 depends on SMP || PREEMPT 74 depends on (SMP || PREEMPT) && BKL
68 default y 75 default y
69 76
70config INIT_ENV_ARG_LIMIT 77config INIT_ENV_ARG_LIMIT
@@ -179,7 +186,7 @@ config KERNEL_LZO
179 depends on HAVE_KERNEL_LZO 186 depends on HAVE_KERNEL_LZO
180 help 187 help
181 Its compression ratio is the poorest among the 4. The kernel 188 Its compression ratio is the poorest among the 4. The kernel
182 size is about about 10% bigger than gzip; however its speed 189 size is about 10% bigger than gzip; however its speed
183 (both compression and decompression) is the fastest. 190 (both compression and decompression) is the fastest.
184 191
185endchoice 192endchoice
@@ -320,13 +327,19 @@ config AUDITSYSCALL
320 help 327 help
321 Enable low-overhead system-call auditing infrastructure that 328 Enable low-overhead system-call auditing infrastructure that
322 can be used independently or with another kernel subsystem, 329 can be used independently or with another kernel subsystem,
323 such as SELinux. To use audit's filesystem watch feature, please 330 such as SELinux.
324 ensure that INOTIFY is configured. 331
332config AUDIT_WATCH
333 def_bool y
334 depends on AUDITSYSCALL
335 select FSNOTIFY
325 336
326config AUDIT_TREE 337config AUDIT_TREE
327 def_bool y 338 def_bool y
328 depends on AUDITSYSCALL 339 depends on AUDITSYSCALL
329 select INOTIFY 340 select FSNOTIFY
341
342source "kernel/irq/Kconfig"
330 343
331menu "RCU Subsystem" 344menu "RCU Subsystem"
332 345
@@ -336,6 +349,7 @@ choice
336 349
337config TREE_RCU 350config TREE_RCU
338 bool "Tree-based hierarchical RCU" 351 bool "Tree-based hierarchical RCU"
352 depends on !PREEMPT && SMP
339 help 353 help
340 This option selects the RCU implementation that is 354 This option selects the RCU implementation that is
341 designed for very large SMP system with hundreds or 355 designed for very large SMP system with hundreds or
@@ -343,7 +357,7 @@ config TREE_RCU
343 smaller systems. 357 smaller systems.
344 358
345config TREE_PREEMPT_RCU 359config TREE_PREEMPT_RCU
346 bool "Preemptable tree-based hierarchical RCU" 360 bool "Preemptible tree-based hierarchical RCU"
347 depends on PREEMPT 361 depends on PREEMPT
348 help 362 help
349 This option selects the RCU implementation that is 363 This option selects the RCU implementation that is
@@ -361,8 +375,22 @@ config TINY_RCU
361 is not required. This option greatly reduces the 375 is not required. This option greatly reduces the
362 memory footprint of RCU. 376 memory footprint of RCU.
363 377
378config TINY_PREEMPT_RCU
379 bool "Preemptible UP-only small-memory-footprint RCU"
380 depends on !SMP && PREEMPT
381 help
382 This option selects the RCU implementation that is designed
383 for real-time UP systems. This option greatly reduces the
384 memory footprint of RCU.
385
364endchoice 386endchoice
365 387
388config PREEMPT_RCU
389 def_bool ( TREE_PREEMPT_RCU || TINY_PREEMPT_RCU )
390 help
391 This option enables preemptible-RCU code that is common between
392 the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
393
366config RCU_TRACE 394config RCU_TRACE
367 bool "Enable tracing for RCU" 395 bool "Enable tracing for RCU"
368 depends on TREE_RCU || TREE_PREEMPT_RCU 396 depends on TREE_RCU || TREE_PREEMPT_RCU
@@ -383,9 +411,12 @@ config RCU_FANOUT
383 help 411 help
384 This option controls the fanout of hierarchical implementations 412 This option controls the fanout of hierarchical implementations
385 of RCU, allowing RCU to work efficiently on machines with 413 of RCU, allowing RCU to work efficiently on machines with
386 large numbers of CPUs. This value must be at least the cube 414 large numbers of CPUs. This value must be at least the fourth
387 root of NR_CPUS, which allows NR_CPUS up to 32,768 for 32-bit 415 root of NR_CPUS, which allows NR_CPUS to be insanely large.
388 systems and up to 262,144 for 64-bit systems. 416 The default value of RCU_FANOUT should be used for production
417 systems, but if you are stress-testing the RCU implementation
418 itself, small RCU_FANOUT values allow you to test large-system
419 code paths on small(er) systems.
389 420
390 Select a specific number if testing RCU itself. 421 Select a specific number if testing RCU itself.
391 Take the default if unsure. 422 Take the default if unsure.
@@ -487,7 +518,6 @@ if CGROUPS
487 518
488config CGROUP_DEBUG 519config CGROUP_DEBUG
489 bool "Example debug cgroup subsystem" 520 bool "Example debug cgroup subsystem"
490 depends on CGROUPS
491 default n 521 default n
492 help 522 help
493 This option enables a simple cgroup subsystem that 523 This option enables a simple cgroup subsystem that
@@ -498,7 +528,6 @@ config CGROUP_DEBUG
498 528
499config CGROUP_NS 529config CGROUP_NS
500 bool "Namespace cgroup subsystem" 530 bool "Namespace cgroup subsystem"
501 depends on CGROUPS
502 help 531 help
503 Provides a simple namespace cgroup subsystem to 532 Provides a simple namespace cgroup subsystem to
504 provide hierarchical naming of sets of namespaces, 533 provide hierarchical naming of sets of namespaces,
@@ -507,21 +536,18 @@ config CGROUP_NS
507 536
508config CGROUP_FREEZER 537config CGROUP_FREEZER
509 bool "Freezer cgroup subsystem" 538 bool "Freezer cgroup subsystem"
510 depends on CGROUPS
511 help 539 help
512 Provides a way to freeze and unfreeze all tasks in a 540 Provides a way to freeze and unfreeze all tasks in a
513 cgroup. 541 cgroup.
514 542
515config CGROUP_DEVICE 543config CGROUP_DEVICE
516 bool "Device controller for cgroups" 544 bool "Device controller for cgroups"
517 depends on CGROUPS && EXPERIMENTAL
518 help 545 help
519 Provides a cgroup implementing whitelists for devices which 546 Provides a cgroup implementing whitelists for devices which
520 a process in the cgroup can mknod or open. 547 a process in the cgroup can mknod or open.
521 548
522config CPUSETS 549config CPUSETS
523 bool "Cpuset support" 550 bool "Cpuset support"
524 depends on CGROUPS
525 help 551 help
526 This option will let you create and manage CPUSETs which 552 This option will let you create and manage CPUSETs which
527 allow dynamically partitioning a system into sets of CPUs and 553 allow dynamically partitioning a system into sets of CPUs and
@@ -537,7 +563,6 @@ config PROC_PID_CPUSET
537 563
538config CGROUP_CPUACCT 564config CGROUP_CPUACCT
539 bool "Simple CPU accounting cgroup subsystem" 565 bool "Simple CPU accounting cgroup subsystem"
540 depends on CGROUPS
541 help 566 help
542 Provides a simple Resource Controller for monitoring the 567 Provides a simple Resource Controller for monitoring the
543 total CPU consumed by the tasks in a cgroup. 568 total CPU consumed by the tasks in a cgroup.
@@ -547,11 +572,10 @@ config RESOURCE_COUNTERS
547 help 572 help
548 This option enables controller independent resource accounting 573 This option enables controller independent resource accounting
549 infrastructure that works with cgroups. 574 infrastructure that works with cgroups.
550 depends on CGROUPS
551 575
552config CGROUP_MEM_RES_CTLR 576config CGROUP_MEM_RES_CTLR
553 bool "Memory Resource Controller for Control Groups" 577 bool "Memory Resource Controller for Control Groups"
554 depends on CGROUPS && RESOURCE_COUNTERS 578 depends on RESOURCE_COUNTERS
555 select MM_OWNER 579 select MM_OWNER
556 help 580 help
557 Provides a memory resource controller that manages both anonymous 581 Provides a memory resource controller that manages both anonymous
@@ -573,8 +597,8 @@ config CGROUP_MEM_RES_CTLR
573 could in turn add some fork/exit overhead. 597 could in turn add some fork/exit overhead.
574 598
575config CGROUP_MEM_RES_CTLR_SWAP 599config CGROUP_MEM_RES_CTLR_SWAP
576 bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)" 600 bool "Memory Resource Controller Swap Extension"
577 depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL 601 depends on CGROUP_MEM_RES_CTLR && SWAP
578 help 602 help
579 Add swap management feature to memory resource controller. When you 603 Add swap management feature to memory resource controller. When you
580 enable this, you can limit mem+swap usage per cgroup. In other words, 604 enable this, you can limit mem+swap usage per cgroup. In other words,
@@ -592,7 +616,7 @@ config CGROUP_MEM_RES_CTLR_SWAP
592 616
593menuconfig CGROUP_SCHED 617menuconfig CGROUP_SCHED
594 bool "Group CPU scheduler" 618 bool "Group CPU scheduler"
595 depends on EXPERIMENTAL && CGROUPS 619 depends on EXPERIMENTAL
596 default n 620 default n
597 help 621 help
598 This feature lets CPU scheduler recognize task groups and control CPU 622 This feature lets CPU scheduler recognize task groups and control CPU
@@ -621,7 +645,7 @@ endif #CGROUP_SCHED
621 645
622config BLK_CGROUP 646config BLK_CGROUP
623 tristate "Block IO controller" 647 tristate "Block IO controller"
624 depends on CGROUPS && BLOCK 648 depends on BLOCK
625 default n 649 default n
626 ---help--- 650 ---help---
627 Generic block IO controller cgroup interface. This is the common 651 Generic block IO controller cgroup interface. This is the common
@@ -630,11 +654,14 @@ config BLK_CGROUP
630 654
631 Currently, CFQ IO scheduler uses it to recognize task groups and 655 Currently, CFQ IO scheduler uses it to recognize task groups and
632 control disk bandwidth allocation (proportional time slice allocation) 656 control disk bandwidth allocation (proportional time slice allocation)
633 to such task groups. 657 to such task groups. It is also used by bio throttling logic in
658 block layer to implement upper limit in IO rates on a device.
634 659
635 This option only enables generic Block IO controller infrastructure. 660 This option only enables generic Block IO controller infrastructure.
636 One needs to also enable actual IO controlling logic in CFQ for it 661 One needs to also enable actual IO controlling logic/policy. For
637 to take effect. (CONFIG_CFQ_GROUP_IOSCHED=y). 662 enabling proportional weight division of disk bandwidth in CFQ seti
663 CONFIG_CFQ_GROUP_IOSCHED=y and for enabling throttling policy set
664 CONFIG_BLK_THROTTLE=y.
638 665
639 See Documentation/cgroups/blkio-controller.txt for more information. 666 See Documentation/cgroups/blkio-controller.txt for more information.
640 667
@@ -648,57 +675,7 @@ config DEBUG_BLK_CGROUP
648 675
649endif # CGROUPS 676endif # CGROUPS
650 677
651config MM_OWNER 678menuconfig NAMESPACES
652 bool
653
654config SYSFS_DEPRECATED
655 bool
656
657config SYSFS_DEPRECATED_V2
658 bool "enable deprecated sysfs features to support old userspace tools"
659 depends on SYSFS
660 default n
661 select SYSFS_DEPRECATED
662 help
663 This option switches the layout of sysfs to the deprecated
664 version. Do not use it on recent distributions.
665
666 The current sysfs layout features a unified device tree at
667 /sys/devices/, which is able to express a hierarchy between
668 class devices. If the deprecated option is set to Y, the
669 unified device tree is split into a bus device tree at
670 /sys/devices/ and several individual class device trees at
671 /sys/class/. The class and bus devices will be connected by
672 "<subsystem>:<name>" and the "device" links. The "block"
673 class devices, will not show up in /sys/class/block/. Some
674 subsystems will suppress the creation of some devices which
675 depend on the unified device tree.
676
677 This option is not a pure compatibility option that can
678 be safely enabled on newer distributions. It will change the
679 layout of sysfs to the non-extensible deprecated version,
680 and disable some features, which can not be exported without
681 confusing older userspace tools. Since 2007/2008 all major
682 distributions do not enable this option, and ship no tools which
683 depend on the deprecated layout or this option.
684
685 If you are using a new kernel on an older distribution, or use
686 older userspace tools, you might need to say Y here. Do not say Y,
687 if the original kernel, that came with your distribution, has
688 this option set to N.
689
690config RELAY
691 bool "Kernel->user space relay support (formerly relayfs)"
692 help
693 This option enables support for relay interface support in
694 certain file systems (such as debugfs).
695 It is designed to provide an efficient mechanism for tools and
696 facilities to relay large amounts of data from kernel space to
697 user space.
698
699 If unsure, say N.
700
701config NAMESPACES
702 bool "Namespaces support" if EMBEDDED 679 bool "Namespaces support" if EMBEDDED
703 default !EMBEDDED 680 default !EMBEDDED
704 help 681 help
@@ -707,48 +684,102 @@ config NAMESPACES
707 or same user id or pid may refer to different tasks when used in 684 or same user id or pid may refer to different tasks when used in
708 different namespaces. 685 different namespaces.
709 686
687if NAMESPACES
688
710config UTS_NS 689config UTS_NS
711 bool "UTS namespace" 690 bool "UTS namespace"
712 depends on NAMESPACES 691 default y
713 help 692 help
714 In this namespace tasks see different info provided with the 693 In this namespace tasks see different info provided with the
715 uname() system call 694 uname() system call
716 695
717config IPC_NS 696config IPC_NS
718 bool "IPC namespace" 697 bool "IPC namespace"
719 depends on NAMESPACES && (SYSVIPC || POSIX_MQUEUE) 698 depends on (SYSVIPC || POSIX_MQUEUE)
699 default y
720 help 700 help
721 In this namespace tasks work with IPC ids which correspond to 701 In this namespace tasks work with IPC ids which correspond to
722 different IPC objects in different namespaces. 702 different IPC objects in different namespaces.
723 703
724config USER_NS 704config USER_NS
725 bool "User namespace (EXPERIMENTAL)" 705 bool "User namespace (EXPERIMENTAL)"
726 depends on NAMESPACES && EXPERIMENTAL 706 depends on EXPERIMENTAL
707 default y
727 help 708 help
728 This allows containers, i.e. vservers, to use user namespaces 709 This allows containers, i.e. vservers, to use user namespaces
729 to provide different user info for different servers. 710 to provide different user info for different servers.
730 If unsure, say N. 711 If unsure, say N.
731 712
732config PID_NS 713config PID_NS
733 bool "PID Namespaces (EXPERIMENTAL)" 714 bool "PID Namespaces"
734 default n 715 default y
735 depends on NAMESPACES && EXPERIMENTAL
736 help 716 help
737 Support process id namespaces. This allows having multiple 717 Support process id namespaces. This allows having multiple
738 processes with the same pid as long as they are in different 718 processes with the same pid as long as they are in different
739 pid namespaces. This is a building block of containers. 719 pid namespaces. This is a building block of containers.
740 720
741 Unless you want to work with an experimental feature
742 say N here.
743
744config NET_NS 721config NET_NS
745 bool "Network namespace" 722 bool "Network namespace"
746 default n 723 depends on NET
747 depends on NAMESPACES && EXPERIMENTAL && NET 724 default y
748 help 725 help
749 Allow user space to create what appear to be multiple instances 726 Allow user space to create what appear to be multiple instances
750 of the network stack. 727 of the network stack.
751 728
729endif # NAMESPACES
730
731config MM_OWNER
732 bool
733
734config SYSFS_DEPRECATED
735 bool "enable deprecated sysfs features to support old userspace tools"
736 depends on SYSFS
737 default n
738 help
739 This option adds code that switches the layout of the "block" class
740 devices, to not show up in /sys/class/block/, but only in
741 /sys/block/.
742
743 This switch is only active when the sysfs.deprecated=1 boot option is
744 passed or the SYSFS_DEPRECATED_V2 option is set.
745
746 This option allows new kernels to run on old distributions and tools,
747 which might get confused by /sys/class/block/. Since 2007/2008 all
748 major distributions and tools handle this just fine.
749
750 Recent distributions and userspace tools after 2009/2010 depend on
751 the existence of /sys/class/block/, and will not work with this
752 option enabled.
753
754 Only if you are using a new kernel on an old distribution, you might
755 need to say Y here.
756
757config SYSFS_DEPRECATED_V2
758 bool "enabled deprecated sysfs features by default"
759 default n
760 depends on SYSFS
761 depends on SYSFS_DEPRECATED
762 help
763 Enable deprecated sysfs by default.
764
765 See the CONFIG_SYSFS_DEPRECATED option for more details about this
766 option.
767
768 Only if you are using a new kernel on an old distribution, you might
769 need to say Y here. Even then, odds are you would not need it
770 enabled, you can always pass the boot option if absolutely necessary.
771
772config RELAY
773 bool "Kernel->user space relay support (formerly relayfs)"
774 help
775 This option enables support for relay interface support in
776 certain file systems (such as debugfs).
777 It is designed to provide an efficient mechanism for tools and
778 facilities to relay large amounts of data from kernel space to
779 user space.
780
781 If unsure, say N.
782
752config BLK_DEV_INITRD 783config BLK_DEV_INITRD
753 bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" 784 bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support"
754 depends on BROKEN || !FRV 785 depends on BROKEN || !FRV
@@ -983,6 +1014,7 @@ config PERF_EVENTS
983 default y if (PROFILING || PERF_COUNTERS) 1014 default y if (PROFILING || PERF_COUNTERS)
984 depends on HAVE_PERF_EVENTS 1015 depends on HAVE_PERF_EVENTS
985 select ANON_INODES 1016 select ANON_INODES
1017 select IRQ_WORK
986 help 1018 help
987 Enable kernel support for various performance events provided 1019 Enable kernel support for various performance events provided
988 by software and hardware. 1020 by software and hardware.
@@ -1143,30 +1175,6 @@ config TRACEPOINTS
1143 1175
1144source "arch/Kconfig" 1176source "arch/Kconfig"
1145 1177
1146config SLOW_WORK
1147 default n
1148 bool
1149 help
1150 The slow work thread pool provides a number of dynamically allocated
1151 threads that can be used by the kernel to perform operations that
1152 take a relatively long time.
1153
1154 An example of this would be CacheFiles doing a path lookup followed
1155 by a series of mkdirs and a create call, all of which have to touch
1156 disk.
1157
1158 See Documentation/slow-work.txt.
1159
1160config SLOW_WORK_DEBUG
1161 bool "Slow work debugging through debugfs"
1162 default n
1163 depends on SLOW_WORK && DEBUG_FS
1164 help
1165 Display the contents of the slow work run queue through debugfs,
1166 including items currently executing.
1167
1168 See Documentation/slow-work.txt.
1169
1170endmenu # General setup 1178endmenu # General setup
1171 1179
1172config HAVE_GENERIC_DMA_COHERENT 1180config HAVE_GENERIC_DMA_COHERENT
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 02e3ca4fc527..830aaec9c7d5 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -58,6 +58,62 @@ static int __init readwrite(char *str)
58__setup("ro", readonly); 58__setup("ro", readonly);
59__setup("rw", readwrite); 59__setup("rw", readwrite);
60 60
61#ifdef CONFIG_BLOCK
62/**
63 * match_dev_by_uuid - callback for finding a partition using its uuid
64 * @dev: device passed in by the caller
65 * @data: opaque pointer to a 36 byte char array with a UUID
66 *
67 * Returns 1 if the device matches, and 0 otherwise.
68 */
69static int match_dev_by_uuid(struct device *dev, void *data)
70{
71 u8 *uuid = data;
72 struct hd_struct *part = dev_to_part(dev);
73
74 if (!part->info)
75 goto no_match;
76
77 if (memcmp(uuid, part->info->uuid, sizeof(part->info->uuid)))
78 goto no_match;
79
80 return 1;
81no_match:
82 return 0;
83}
84
85
86/**
87 * devt_from_partuuid - looks up the dev_t of a partition by its UUID
88 * @uuid: 36 byte char array containing a hex ascii UUID
89 *
90 * The function will return the first partition which contains a matching
91 * UUID value in its partition_meta_info struct. This does not search
92 * by filesystem UUIDs.
93 *
94 * Returns the matching dev_t on success or 0 on failure.
95 */
96static dev_t __init devt_from_partuuid(char *uuid_str)
97{
98 dev_t res = 0;
99 struct device *dev = NULL;
100 u8 uuid[16];
101
102 /* Pack the requested UUID in the expected format. */
103 part_pack_uuid(uuid_str, uuid);
104
105 dev = class_find_device(&block_class, NULL, uuid, &match_dev_by_uuid);
106 if (!dev)
107 goto done;
108
109 res = dev->devt;
110 put_device(dev);
111
112done:
113 return res;
114}
115#endif
116
61/* 117/*
62 * Convert a name into device number. We accept the following variants: 118 * Convert a name into device number. We accept the following variants:
63 * 119 *
@@ -68,6 +124,8 @@ __setup("rw", readwrite);
68 * of partition - device number of disk plus the partition number 124 * of partition - device number of disk plus the partition number
69 * 5) /dev/<disk_name>p<decimal> - same as the above, that form is 125 * 5) /dev/<disk_name>p<decimal> - same as the above, that form is
70 * used when disk name of partitioned disk ends on a digit. 126 * used when disk name of partitioned disk ends on a digit.
127 * 6) PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF representing the
128 * unique id of a partition if the partition table provides it.
71 * 129 *
72 * If name doesn't have fall into the categories above, we return (0,0). 130 * If name doesn't have fall into the categories above, we return (0,0).
73 * block_class is used to check if something is a disk name. If the disk 131 * block_class is used to check if something is a disk name. If the disk
@@ -82,6 +140,18 @@ dev_t name_to_dev_t(char *name)
82 dev_t res = 0; 140 dev_t res = 0;
83 int part; 141 int part;
84 142
143#ifdef CONFIG_BLOCK
144 if (strncmp(name, "PARTUUID=", 9) == 0) {
145 name += 9;
146 if (strlen(name) != 36)
147 goto fail;
148 res = devt_from_partuuid(name);
149 if (!res)
150 goto fail;
151 goto done;
152 }
153#endif
154
85 if (strncmp(name, "/dev/", 5) != 0) { 155 if (strncmp(name, "/dev/", 5) != 0) {
86 unsigned maj, min; 156 unsigned maj, min;
87 157
@@ -221,7 +291,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
221 if (err) 291 if (err)
222 return err; 292 return err;
223 293
224 sys_chdir("/root"); 294 sys_chdir((const char __user __force *)"/root");
225 ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev; 295 ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev;
226 printk("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", 296 printk("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
227 current->fs->pwd.mnt->mnt_sb->s_type->name, 297 current->fs->pwd.mnt->mnt_sb->s_type->name,
@@ -291,13 +361,13 @@ out:
291#ifdef CONFIG_ROOT_NFS 361#ifdef CONFIG_ROOT_NFS
292static int __init mount_nfs_root(void) 362static int __init mount_nfs_root(void)
293{ 363{
294 void *data = nfs_root_data(); 364 char *root_dev, *root_data;
295 365
296 create_dev("/dev/root", ROOT_DEV); 366 if (nfs_root_data(&root_dev, &root_data) != 0)
297 if (data && 367 return 0;
298 do_mount_root("/dev/root", "nfs", root_mountflags, data) == 0) 368 if (do_mount_root(root_dev, "nfs", root_mountflags, root_data) != 0)
299 return 1; 369 return 0;
300 return 0; 370 return 1;
301} 371}
302#endif 372#endif
303 373
@@ -418,5 +488,5 @@ void __init prepare_namespace(void)
418out: 488out:
419 devtmpfs_mount("dev"); 489 devtmpfs_mount("dev");
420 sys_mount(".", "/", NULL, MS_MOVE, NULL); 490 sys_mount(".", "/", NULL, MS_MOVE, NULL);
421 sys_chroot("."); 491 sys_chroot((const char __user __force *)".");
422} 492}
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 2b108538d0d9..3098a38f3ae1 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -24,10 +24,11 @@ static int __init no_initrd(char *str)
24 24
25__setup("noinitrd", no_initrd); 25__setup("noinitrd", no_initrd);
26 26
27static int __init do_linuxrc(void * shell) 27static int __init do_linuxrc(void *_shell)
28{ 28{
29 static char *argv[] = { "linuxrc", NULL, }; 29 static const char *argv[] = { "linuxrc", NULL, };
30 extern char * envp_init[]; 30 extern const char *envp_init[];
31 const char *shell = _shell;
31 32
32 sys_close(old_fd);sys_close(root_fd); 33 sys_close(old_fd);sys_close(root_fd);
33 sys_setsid(); 34 sys_setsid();
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 69aebbf8fd2d..32c4799b8c91 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -283,7 +283,7 @@ static void __init autodetect_raid(void)
283 283
284 wait_for_device_probe(); 284 wait_for_device_probe();
285 285
286 fd = sys_open("/dev/md0", 0, 0); 286 fd = sys_open((const char __user __force *) "/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);
289 sys_close(fd); 289 sys_close(fd);
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index bf3ef667bf36..6e1ee6987c78 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -168,7 +168,7 @@ int __init rd_load_image(char *from)
168 char rotator[4] = { '|' , '/' , '-' , '\\' }; 168 char rotator[4] = { '|' , '/' , '-' , '\\' };
169#endif 169#endif
170 170
171 out_fd = sys_open("/dev/ram", O_RDWR, 0); 171 out_fd = sys_open((const char __user __force *) "/dev/ram", O_RDWR, 0);
172 if (out_fd < 0) 172 if (out_fd < 0)
173 goto out; 173 goto out;
174 174
@@ -267,7 +267,7 @@ noclose_input:
267 sys_close(out_fd); 267 sys_close(out_fd);
268out: 268out:
269 kfree(buf); 269 kfree(buf);
270 sys_unlink("/dev/ram"); 270 sys_unlink((const char __user __force *) "/dev/ram");
271 return res; 271 return res;
272} 272}
273 273
diff --git a/init/initramfs.c b/init/initramfs.c
index 371c3da64ad3..2531811d42cb 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -529,7 +529,7 @@ static void __init clean_rootfs(void)
529 struct linux_dirent64 *dirp; 529 struct linux_dirent64 *dirp;
530 int num; 530 int num;
531 531
532 fd = sys_open("/", O_RDONLY, 0); 532 fd = sys_open((const char __user __force *) "/", O_RDONLY, 0);
533 WARN_ON(fd < 0); 533 WARN_ON(fd < 0);
534 if (fd < 0) 534 if (fd < 0)
535 return; 535 return;
@@ -589,7 +589,8 @@ static int __init populate_rootfs(void)
589 } 589 }
590 printk(KERN_INFO "rootfs image is not initramfs (%s)" 590 printk(KERN_INFO "rootfs image is not initramfs (%s)"
591 "; looks like an initrd\n", err); 591 "; looks like an initrd\n", err);
592 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); 592 fd = sys_open((const char __user __force *) "/initrd.image",
593 O_WRONLY|O_CREAT, 0700);
593 if (fd >= 0) { 594 if (fd >= 0) {
594 sys_write(fd, (char *)initrd_start, 595 sys_write(fd, (char *)initrd_start,
595 initrd_end - initrd_start); 596 initrd_end - initrd_start);
diff --git a/init/main.c b/init/main.c
index a42fdf4aeba9..e59af24a0b7c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -32,7 +32,6 @@
32#include <linux/start_kernel.h> 32#include <linux/start_kernel.h>
33#include <linux/security.h> 33#include <linux/security.h>
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/workqueue.h>
36#include <linux/profile.h> 35#include <linux/profile.h>
37#include <linux/rcupdate.h> 36#include <linux/rcupdate.h>
38#include <linux/moduleparam.h> 37#include <linux/moduleparam.h>
@@ -66,11 +65,9 @@
66#include <linux/ftrace.h> 65#include <linux/ftrace.h>
67#include <linux/async.h> 66#include <linux/async.h>
68#include <linux/kmemcheck.h> 67#include <linux/kmemcheck.h>
69#include <linux/kmemtrace.h>
70#include <linux/sfi.h> 68#include <linux/sfi.h>
71#include <linux/shmem_fs.h> 69#include <linux/shmem_fs.h>
72#include <linux/slab.h> 70#include <linux/slab.h>
73#include <trace/boot.h>
74 71
75#include <asm/io.h> 72#include <asm/io.h>
76#include <asm/bugs.h> 73#include <asm/bugs.h>
@@ -200,15 +197,15 @@ static int __init set_reset_devices(char *str)
200 197
201__setup("reset_devices", set_reset_devices); 198__setup("reset_devices", set_reset_devices);
202 199
203static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; 200static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
204char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; 201const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
205static const char *panic_later, *panic_param; 202static const char *panic_later, *panic_param;
206 203
207extern struct obs_kernel_param __setup_start[], __setup_end[]; 204extern const struct obs_kernel_param __setup_start[], __setup_end[];
208 205
209static int __init obsolete_checksetup(char *line) 206static int __init obsolete_checksetup(char *line)
210{ 207{
211 struct obs_kernel_param *p; 208 const struct obs_kernel_param *p;
212 int had_early_param = 0; 209 int had_early_param = 0;
213 210
214 p = __setup_start; 211 p = __setup_start;
@@ -427,7 +424,6 @@ static void __init setup_command_line(char *command_line)
427static __initdata DECLARE_COMPLETION(kthreadd_done); 424static __initdata DECLARE_COMPLETION(kthreadd_done);
428 425
429static noinline void __init_refok rest_init(void) 426static noinline void __init_refok rest_init(void)
430 __releases(kernel_lock)
431{ 427{
432 int pid; 428 int pid;
433 429
@@ -444,7 +440,6 @@ static noinline void __init_refok rest_init(void)
444 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns); 440 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
445 rcu_read_unlock(); 441 rcu_read_unlock();
446 complete(&kthreadd_done); 442 complete(&kthreadd_done);
447 unlock_kernel();
448 443
449 /* 444 /*
450 * The boot idle thread must execute schedule() 445 * The boot idle thread must execute schedule()
@@ -462,7 +457,7 @@ static noinline void __init_refok rest_init(void)
462/* Check for early params. */ 457/* Check for early params. */
463static int __init do_early_param(char *param, char *val) 458static int __init do_early_param(char *param, char *val)
464{ 459{
465 struct obs_kernel_param *p; 460 const struct obs_kernel_param *p;
466 461
467 for (p = __setup_start; p < __setup_end; p++) { 462 for (p = __setup_start; p < __setup_end; p++) {
468 if ((p->early && strcmp(param, p->str) == 0) || 463 if ((p->early && strcmp(param, p->str) == 0) ||
@@ -532,6 +527,7 @@ static void __init mm_init(void)
532 page_cgroup_init_flatmem(); 527 page_cgroup_init_flatmem();
533 mem_init(); 528 mem_init();
534 kmem_cache_init(); 529 kmem_cache_init();
530 percpu_init_late();
535 pgtable_cache_init(); 531 pgtable_cache_init();
536 vmalloc_init(); 532 vmalloc_init();
537} 533}
@@ -539,7 +535,7 @@ static void __init mm_init(void)
539asmlinkage void __init start_kernel(void) 535asmlinkage void __init start_kernel(void)
540{ 536{
541 char * command_line; 537 char * command_line;
542 extern struct kernel_param __start___param[], __stop___param[]; 538 extern const struct kernel_param __start___param[], __stop___param[];
543 539
544 smp_setup_processor_id(); 540 smp_setup_processor_id();
545 541
@@ -559,13 +555,11 @@ asmlinkage void __init start_kernel(void)
559 555
560 local_irq_disable(); 556 local_irq_disable();
561 early_boot_irqs_off(); 557 early_boot_irqs_off();
562 early_init_irq_lock_class();
563 558
564/* 559/*
565 * Interrupts are still disabled. Do necessary setups, then 560 * Interrupts are still disabled. Do necessary setups, then
566 * enable them 561 * enable them
567 */ 562 */
568 lock_kernel();
569 tick_init(); 563 tick_init();
570 boot_cpu_init(); 564 boot_cpu_init();
571 page_address_init(); 565 page_address_init();
@@ -663,7 +657,6 @@ asmlinkage void __init start_kernel(void)
663#endif 657#endif
664 page_cgroup_init(); 658 page_cgroup_init();
665 enable_debug_pagealloc(); 659 enable_debug_pagealloc();
666 kmemtrace_init();
667 kmemleak_init(); 660 kmemleak_init();
668 debug_objects_mem_init(); 661 debug_objects_mem_init();
669 idr_init_cache(); 662 idr_init_cache();
@@ -725,38 +718,39 @@ int initcall_debug;
725core_param(initcall_debug, initcall_debug, bool, 0644); 718core_param(initcall_debug, initcall_debug, bool, 0644);
726 719
727static char msgbuf[64]; 720static char msgbuf[64];
728static struct boot_trace_call call;
729static struct boot_trace_ret ret;
730 721
731int do_one_initcall(initcall_t fn) 722static int __init_or_module do_one_initcall_debug(initcall_t fn)
732{ 723{
733 int count = preempt_count();
734 ktime_t calltime, delta, rettime; 724 ktime_t calltime, delta, rettime;
725 unsigned long long duration;
726 int ret;
735 727
736 if (initcall_debug) { 728 printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current));
737 call.caller = task_pid_nr(current); 729 calltime = ktime_get();
738 printk("calling %pF @ %i\n", fn, call.caller); 730 ret = fn();
739 calltime = ktime_get(); 731 rettime = ktime_get();
740 trace_boot_call(&call, fn); 732 delta = ktime_sub(rettime, calltime);
741 enable_boot_trace(); 733 duration = (unsigned long long) ktime_to_ns(delta) >> 10;
742 } 734 printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn,
735 ret, duration);
743 736
744 ret.result = fn(); 737 return ret;
738}
745 739
746 if (initcall_debug) { 740int __init_or_module do_one_initcall(initcall_t fn)
747 disable_boot_trace(); 741{
748 rettime = ktime_get(); 742 int count = preempt_count();
749 delta = ktime_sub(rettime, calltime); 743 int ret;
750 ret.duration = (unsigned long long) ktime_to_ns(delta) >> 10; 744
751 trace_boot_ret(&ret, fn); 745 if (initcall_debug)
752 printk("initcall %pF returned %d after %Ld usecs\n", fn, 746 ret = do_one_initcall_debug(fn);
753 ret.result, ret.duration); 747 else
754 } 748 ret = fn();
755 749
756 msgbuf[0] = 0; 750 msgbuf[0] = 0;
757 751
758 if (ret.result && ret.result != -ENODEV && initcall_debug) 752 if (ret && ret != -ENODEV && initcall_debug)
759 sprintf(msgbuf, "error code %d ", ret.result); 753 sprintf(msgbuf, "error code %d ", ret);
760 754
761 if (preempt_count() != count) { 755 if (preempt_count() != count) {
762 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); 756 strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf));
@@ -770,7 +764,7 @@ int do_one_initcall(initcall_t fn)
770 printk("initcall %pF returned with %s\n", fn, msgbuf); 764 printk("initcall %pF returned with %s\n", fn, msgbuf);
771 } 765 }
772 766
773 return ret.result; 767 return ret;
774} 768}
775 769
776 770
@@ -796,7 +790,6 @@ static void __init do_initcalls(void)
796 */ 790 */
797static void __init do_basic_setup(void) 791static void __init do_basic_setup(void)
798{ 792{
799 init_workqueues();
800 cpuset_init_smp(); 793 cpuset_init_smp();
801 usermodehelper_init(); 794 usermodehelper_init();
802 init_tmpfs(); 795 init_tmpfs();
@@ -814,7 +807,7 @@ static void __init do_pre_smp_initcalls(void)
814 do_one_initcall(*fn); 807 do_one_initcall(*fn);
815} 808}
816 809
817static void run_init_process(char *init_filename) 810static void run_init_process(const char *init_filename)
818{ 811{
819 argv_init[0] = init_filename; 812 argv_init[0] = init_filename;
820 kernel_execve(init_filename, argv_init, envp_init); 813 kernel_execve(init_filename, argv_init, envp_init);
@@ -824,12 +817,10 @@ static void run_init_process(char *init_filename)
824 * makes it inline to init() and it becomes part of init.text section 817 * makes it inline to init() and it becomes part of init.text section
825 */ 818 */
826static noinline int init_post(void) 819static noinline int init_post(void)
827 __releases(kernel_lock)
828{ 820{
829 /* need to finish all async __init code before freeing the memory */ 821 /* need to finish all async __init code before freeing the memory */
830 async_synchronize_full(); 822 async_synchronize_full();
831 free_initmem(); 823 free_initmem();
832 unlock_kernel();
833 mark_rodata_ro(); 824 mark_rodata_ro();
834 system_state = SYSTEM_RUNNING; 825 system_state = SYSTEM_RUNNING;
835 numa_default_policy(); 826 numa_default_policy();
@@ -869,8 +860,6 @@ static int __init kernel_init(void * unused)
869 * Wait until kthreadd is all set-up. 860 * Wait until kthreadd is all set-up.
870 */ 861 */
871 wait_for_completion(&kthreadd_done); 862 wait_for_completion(&kthreadd_done);
872 lock_kernel();
873
874 /* 863 /*
875 * init can allocate pages on any node 864 * init can allocate pages on any node
876 */ 865 */
@@ -894,7 +883,6 @@ static int __init kernel_init(void * unused)
894 smp_prepare_cpus(setup_max_cpus); 883 smp_prepare_cpus(setup_max_cpus);
895 884
896 do_pre_smp_initcalls(); 885 do_pre_smp_initcalls();
897 start_boot_trace();
898 886
899 smp_init(); 887 smp_init();
900 sched_init_smp(); 888 sched_init_smp();
diff --git a/init/noinitramfs.c b/init/noinitramfs.c
index f4c1a3a1b8c5..267739d85179 100644
--- a/init/noinitramfs.c
+++ b/init/noinitramfs.c
@@ -29,17 +29,17 @@ static int __init default_rootfs(void)
29{ 29{
30 int err; 30 int err;
31 31
32 err = sys_mkdir("/dev", 0755); 32 err = sys_mkdir((const char __user __force *) "/dev", 0755);
33 if (err < 0) 33 if (err < 0)
34 goto out; 34 goto out;
35 35
36 err = sys_mknod((const char __user *) "/dev/console", 36 err = sys_mknod((const char __user __force *) "/dev/console",
37 S_IFCHR | S_IRUSR | S_IWUSR, 37 S_IFCHR | S_IRUSR | S_IWUSR,
38 new_encode_dev(MKDEV(5, 1))); 38 new_encode_dev(MKDEV(5, 1)));
39 if (err < 0) 39 if (err < 0)
40 goto out; 40 goto out;
41 41
42 err = sys_mkdir("/root", 0700); 42 err = sys_mkdir((const char __user __force *) "/root", 0700);
43 if (err < 0) 43 if (err < 0)
44 goto out; 44 goto out;
45 45