diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/Kconfig | 343 | ||||
-rw-r--r-- | init/do_mounts.c | 6 | ||||
-rw-r--r-- | init/do_mounts_initrd.c | 15 | ||||
-rw-r--r-- | init/init_task.c | 2 | ||||
-rw-r--r-- | init/initramfs.c | 8 | ||||
-rw-r--r-- | init/main.c | 85 | ||||
-rw-r--r-- | init/version.c | 2 |
7 files changed, 296 insertions, 165 deletions
diff --git a/init/Kconfig b/init/Kconfig index 3b34a88cf34..247084be059 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -20,49 +20,14 @@ config CONSTRUCTORS bool depends on !UML -config HAVE_IRQ_WORK - bool - config IRQ_WORK bool - depends on HAVE_IRQ_WORK config BUILDTIME_EXTABLE_SORT bool menu "General setup" -config EXPERIMENTAL - bool "Prompt for development and/or incomplete code/drivers" - ---help--- - Some of the various things that Linux supports (such as network - drivers, file systems, network protocols, etc.) can be in a state - of development where the functionality, stability, or the level of - testing is not yet high enough for general use. This is usually - known as the "alpha-test" phase among developers. If a feature is - currently in alpha-test, then the developers usually discourage - uninformed widespread use of this feature by the general public to - avoid "Why doesn't this work?" type mail messages. However, active - testing and use of these systems is welcomed. Just be aware that it - may not meet the normal level of reliability or it may fail to work - in some special cases. Detailed bug reports from people familiar - with the kernel internals are usually welcomed by the developers - (before submitting bug reports, please read the documents - <file:README>, <file:MAINTAINERS>, <file:REPORTING-BUGS>, - <file:Documentation/BUG-HUNTING>, and - <file:Documentation/oops-tracing.txt> in the kernel source). - - This option will also make obsoleted drivers available. These are - drivers that have been replaced by something else, and/or are - scheduled to be removed in a future kernel release. - - Unless you intend to help test and develop a feature or driver that - falls into this category, or you have a situation that requires - using these features, you should probably say N here, which will - cause the configurator to present you with fewer choices. If - you say Y here, you will be offered the choice of using features or - drivers that are currently considered to be in the alpha-test phase. - config BROKEN bool @@ -88,6 +53,20 @@ config CROSS_COMPILE need to set this unless you want the configured kernel build directory to select the cross-compiler automatically. +config COMPILE_TEST + bool "Compile also drivers which will not load" + default n + help + Some drivers can be compiled on a different platform than they are + intended to be run on. Despite they cannot be loaded there (or even + when they load they cannot be used due to missing HW support), + developers still, opposing to distributors, might want to build such + drivers to compile-test them. + + If you are a developer and want to build everything available, say Y + here. If you are a user/distributor, say N here to exclude useless + drivers to be distributed. + config LOCALVERSION string "Local version - append to kernel release" help @@ -133,10 +112,13 @@ config HAVE_KERNEL_XZ config HAVE_KERNEL_LZO bool +config HAVE_KERNEL_LZ4 + bool + choice prompt "Kernel compression mode" default KERNEL_GZIP - depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO + depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 help The linux kernel is a kind of self-extracting executable. Several compression algorithms are available, which differ @@ -203,6 +185,18 @@ config KERNEL_LZO size is about 10% bigger than gzip; however its speed (both compression and decompression) is the fastest. +config KERNEL_LZ4 + bool "LZ4" + depends on HAVE_KERNEL_LZ4 + help + LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding. + A preliminary version of LZ4 de/compression tool is available at + <https://code.google.com/p/lz4/>. + + Its compression ratio is worse than LZO. The size of the kernel + is about 8% bigger than LZO. But the decompression speed is + faster than LZO. + endchoice config DEFAULT_HOSTNAME @@ -247,7 +241,7 @@ config SYSVIPC_SYSCTL config POSIX_MQUEUE bool "POSIX Message Queues" - depends on NET && EXPERIMENTAL + depends on NET ---help--- POSIX variant of message queues is a part of IPC. In POSIX message queues every message has a priority which decides about succession @@ -326,15 +320,18 @@ source "kernel/time/Kconfig" menu "CPU/Task time and stats accounting" +config VIRT_CPU_ACCOUNTING + bool + choice prompt "Cputime accounting" default TICK_CPU_ACCOUNTING if !PPC64 - default VIRT_CPU_ACCOUNTING if PPC64 + default VIRT_CPU_ACCOUNTING_NATIVE if PPC64 # Kind of a stub config for the pure tick based cputime accounting config TICK_CPU_ACCOUNTING bool "Simple tick based cputime accounting" - depends on !S390 + depends on !S390 && !NO_HZ_FULL help This is the basic tick based cputime accounting that maintains statistics about user, system and idle time spent on per jiffies @@ -342,9 +339,10 @@ config TICK_CPU_ACCOUNTING If unsure, say Y. -config VIRT_CPU_ACCOUNTING +config VIRT_CPU_ACCOUNTING_NATIVE bool "Deterministic task and CPU time accounting" - depends on HAVE_VIRT_CPU_ACCOUNTING + depends on HAVE_VIRT_CPU_ACCOUNTING && !NO_HZ_FULL + select VIRT_CPU_ACCOUNTING help Select this option to enable more accurate task and CPU time accounting. This is done by reading a CPU counter on each @@ -354,9 +352,26 @@ config VIRT_CPU_ACCOUNTING this also enables accounting of stolen time on logically-partitioned systems. +config VIRT_CPU_ACCOUNTING_GEN + bool "Full dynticks CPU time accounting" + depends on HAVE_CONTEXT_TRACKING && 64BIT + select VIRT_CPU_ACCOUNTING + select CONTEXT_TRACKING + help + Select this option to enable task and CPU time accounting on full + dynticks systems. This accounting is implemented by watching every + kernel-user boundaries using the context tracking subsystem. + The accounting is thus performed at the expense of some significant + overhead. + + For now this is only useful if you are working on the full + dynticks subsystem development. + + If unsure, say N. + config IRQ_TIME_ACCOUNTING bool "Fine granularity task level IRQ time accounting" - depends on HAVE_IRQ_TIME_ACCOUNTING + depends on HAVE_IRQ_TIME_ACCOUNTING && !NO_HZ_FULL help Select this option to enable fine granularity task irq time accounting. This is done by reading a timestamp on each @@ -393,7 +408,7 @@ config BSD_PROCESS_ACCT_V3 at <http://www.gnu.org/software/acct/>. config TASKSTATS - bool "Export task/process statistics through netlink (EXPERIMENTAL)" + bool "Export task/process statistics through netlink" depends on NET default n help @@ -406,7 +421,7 @@ config TASKSTATS Say N if unsure. config TASK_DELAY_ACCT - bool "Enable per-task delay accounting (EXPERIMENTAL)" + bool "Enable per-task delay accounting" depends on TASKSTATS help Collect information on time spent by a task waiting for system @@ -417,7 +432,7 @@ config TASK_DELAY_ACCT Say N if unsure. config TASK_XACCT - bool "Enable extended accounting over taskstats (EXPERIMENTAL)" + bool "Enable extended accounting over taskstats" depends on TASKSTATS help Collect extended task accounting data and send the data @@ -426,7 +441,7 @@ config TASK_XACCT Say N if unsure. config TASK_IO_ACCOUNTING - bool "Enable per-task storage I/O accounting (EXPERIMENTAL)" + bool "Enable per-task storage I/O accounting" depends on TASK_XACCT help Collect information on the number of bytes of storage I/O which this @@ -445,6 +460,7 @@ choice config TREE_RCU bool "Tree-based hierarchical RCU" depends on !PREEMPT && SMP + select IRQ_WORK help This option selects the RCU implementation that is designed for very large SMP system with hundreds or @@ -453,7 +469,7 @@ config TREE_RCU config TREE_PREEMPT_RCU bool "Preemptible tree-based hierarchical RCU" - depends on PREEMPT && SMP + depends on PREEMPT help This option selects the RCU implementation that is designed for very large SMP systems with hundreds or @@ -461,6 +477,8 @@ config TREE_PREEMPT_RCU is also required. It also scales down nicely to smaller systems. + Select this option if you are unsure. + config TINY_RCU bool "UP-only small-memory-footprint RCU" depends on !PREEMPT && !SMP @@ -470,22 +488,22 @@ config TINY_RCU is not required. This option greatly reduces the memory footprint of RCU. -config TINY_PREEMPT_RCU - bool "Preemptible UP-only small-memory-footprint RCU" - depends on PREEMPT && !SMP - help - This option selects the RCU implementation that is designed - for real-time UP systems. This option greatly reduces the - memory footprint of RCU. - endchoice config PREEMPT_RCU - def_bool ( TREE_PREEMPT_RCU || TINY_PREEMPT_RCU ) + def_bool TREE_PREEMPT_RCU help This option enables preemptible-RCU code that is common between the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations. +config RCU_STALL_COMMON + def_bool ( TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE ) + help + This option enables RCU CPU stall code that is common between + the TINY and TREE variants of RCU. The purpose is to allow + the tiny variants to disable RCU CPU stall warnings, while + making these warnings mandatory for the tree variants. + config CONTEXT_TRACKING bool @@ -509,6 +527,7 @@ config RCU_USER_QS config CONTEXT_TRACKING_FORCE bool "Force context tracking" depends on CONTEXT_TRACKING + default CONTEXT_TRACKING help Probe on user/kernel boundaries by default in order to test the features that rely on it such as userspace RCU extended @@ -579,16 +598,19 @@ config RCU_FANOUT_EXACT config RCU_FAST_NO_HZ bool "Accelerate last non-dyntick-idle CPU's grace periods" - depends on NO_HZ && SMP + depends on NO_HZ_COMMON && SMP default n help - This option causes RCU to attempt to accelerate grace periods in - order to allow CPUs to enter dynticks-idle state more quickly. - On the other hand, this option increases the overhead of the - dynticks-idle checking, thus degrading scheduling latency. + This option permits CPUs to enter dynticks-idle state even if + they have RCU callbacks queued, and prevents RCU from waking + these CPUs up more than roughly once every four jiffies (by + default, you can adjust this using the rcutree.rcu_idle_gp_delay + parameter), thus improving energy efficiency. On the other + hand, this option increases the duration of RCU grace periods, + for example, slowing down synchronize_rcu(). - Say Y if energy efficiency is critically important, and you don't - care about real-time response. + Say Y if energy efficiency is critically important, and you + don't care about increased grace-period durations. Say N if you are unsure. @@ -666,16 +688,72 @@ config RCU_NOCB_CPU This option offloads callback invocation from the set of CPUs specified at boot time by the rcu_nocbs parameter. - For each such CPU, a kthread ("rcuoN") will be created to - invoke callbacks, where the "N" is the CPU being offloaded. - Nothing prevents this kthread from running on the specified - CPUs, but (1) the kthreads may be preempted between each - callback, and (2) affinity or cgroups can be used to force - the kthreads to run on whatever set of CPUs is desired. - - Say Y here if you want reduced OS jitter on selected CPUs. + For each such CPU, a kthread ("rcuox/N") will be created to + invoke callbacks, where the "N" is the CPU being offloaded, + and where the "x" is "b" for RCU-bh, "p" for RCU-preempt, and + "s" for RCU-sched. Nothing prevents this kthread from running + on the specified CPUs, but (1) the kthreads may be preempted + between each callback, and (2) affinity or cgroups can be used + to force the kthreads to run on whatever set of CPUs is desired. + + Say Y here if you want to help to debug reduced OS jitter. Say N here if you are unsure. +choice + prompt "Build-forced no-CBs CPUs" + default RCU_NOCB_CPU_NONE + help + This option allows no-CBs CPUs (whose RCU callbacks are invoked + from kthreads rather than from softirq context) to be specified + at build time. Additional no-CBs CPUs may be specified by + the rcu_nocbs= boot parameter. + +config RCU_NOCB_CPU_NONE + bool "No build_forced no-CBs CPUs" + depends on RCU_NOCB_CPU && !NO_HZ_FULL + help + This option does not force any of the CPUs to be no-CBs CPUs. + Only CPUs designated by the rcu_nocbs= boot parameter will be + no-CBs CPUs, whose RCU callbacks will be invoked by per-CPU + kthreads whose names begin with "rcuo". All other CPUs will + invoke their own RCU callbacks in softirq context. + + Select this option if you want to choose no-CBs CPUs at + boot time, for example, to allow testing of different no-CBs + configurations without having to rebuild the kernel each time. + +config RCU_NOCB_CPU_ZERO + bool "CPU 0 is a build_forced no-CBs CPU" + depends on RCU_NOCB_CPU && !NO_HZ_FULL + help + This option forces CPU 0 to be a no-CBs CPU, so that its RCU + callbacks are invoked by a per-CPU kthread whose name begins + with "rcuo". Additional CPUs may be designated as no-CBs + CPUs using the rcu_nocbs= boot parameter will be no-CBs CPUs. + All other CPUs will invoke their own RCU callbacks in softirq + context. + + Select this if CPU 0 needs to be a no-CBs CPU for real-time + or energy-efficiency reasons, but the real reason it exists + is to ensure that randconfig testing covers mixed systems. + +config RCU_NOCB_CPU_ALL + bool "All CPUs are build_forced no-CBs CPUs" + depends on RCU_NOCB_CPU + help + This option forces all CPUs to be no-CBs CPUs. The rcu_nocbs= + boot parameter will be ignored. All CPUs' RCU callbacks will + be executed in the context of per-CPU rcuo kthreads created for + this purpose. Assuming that the kthreads whose names start with + "rcuo" are bound to "housekeeping" CPUs, this reduces OS jitter + on the remaining CPUs, but might decrease memory locality during + RCU-callback invocation, thus potentially degrading throughput. + + Select this if all CPUs need to be no-CBs CPUs for real-time + or energy-efficiency reasons. + +endchoice + endmenu # "RCU Subsystem" config IKCONFIG @@ -717,6 +795,9 @@ config LOG_BUF_SHIFT config HAVE_UNSTABLE_SCHED_CLOCK bool +config GENERIC_SCHED_CLOCK + bool + # # For architectures that want to enable the support for NUMA-affine scheduler # balancing logic: @@ -836,7 +917,7 @@ config MEMCG Note that setting this option increases fixed memory overhead associated with each page of memory in the system. By this, - 20(40)bytes/PAGE_SIZE on 32(64)bit system will be occupied by memory + 8(16)bytes/PAGE_SIZE on 32(64)bit system will be occupied by memory usage tracking struct at boot. Total amount of this is printed out at boot. @@ -880,8 +961,8 @@ config MEMCG_SWAP_ENABLED select this option (if, for some reason, they need to disable it then swapaccount=0 does the trick). config MEMCG_KMEM - bool "Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)" - depends on MEMCG && EXPERIMENTAL + bool "Memory Resource Controller Kernel Memory accounting" + depends on MEMCG depends on SLUB || SLAB help The Kernel Memory extension for Memory Resource Controller can limit @@ -893,7 +974,7 @@ config MEMCG_KMEM config CGROUP_HUGETLB bool "HugeTLB Resource Controller for Control Groups" - depends on RESOURCE_COUNTERS && HUGETLB_PAGE && EXPERIMENTAL + depends on RESOURCE_COUNTERS && HUGETLB_PAGE default n help Provides a cgroup Resource Controller for HugeTLB pages. @@ -932,7 +1013,6 @@ config FAIR_GROUP_SCHED config CFS_BANDWIDTH bool "CPU bandwidth provisioning for FAIR_GROUP_SCHED" - depends on EXPERIMENTAL depends on FAIR_GROUP_SCHED default n help @@ -944,7 +1024,6 @@ config CFS_BANDWIDTH config RT_GROUP_SCHED bool "Group scheduling for SCHED_RR/FIFO" - depends on EXPERIMENTAL depends on CGROUP_SCHED default n help @@ -1026,8 +1105,7 @@ config IPC_NS different IPC objects in different namespaces. config USER_NS - bool "User namespace (EXPERIMENTAL)" - depends on EXPERIMENTAL + bool "User namespace" depends on UIDGID_CONVERTED select UIDGID_STRICT_TYPE_CHECKS @@ -1035,6 +1113,13 @@ config USER_NS help This allows containers, i.e. vservers, to use user namespaces to provide different user info for different servers. + + When user namespaces are enabled in the kernel it is + recommended that the MEMCG and MEMCG_KMEM options also be + enabled and that user-space use the memory control groups to + limit the amount of memory a memory unprivileged users can + use. + If unsure, say N. config PID_NS @@ -1063,20 +1148,7 @@ config UIDGID_CONVERTED bool default y - # Networking - depends on NET_9P = n - # Filesystems - depends on 9P_FS = n - depends on AFS_FS = n - depends on CEPH_FS = n - depends on CIFS = n - depends on CODA_FS = n - depends on GFS2_FS = n - depends on NCP_FS = n - depends on NFSD = n - depends on NFS_FS = n - depends on OCFS2_FS = n depends on XFS_FS = n config UIDGID_STRICT_TYPE_CHECKS @@ -1182,7 +1254,7 @@ config CC_OPTIMIZE_FOR_SIZE Enabling this option will pass "-Os" instead of "-O2" to gcc resulting in a smaller kernel. - If unsure, say Y. + If unsure, say N. config SYSCTL bool @@ -1190,6 +1262,32 @@ config SYSCTL config ANON_INODES bool +config HAVE_UID16 + bool + +config SYSCTL_EXCEPTION_TRACE + bool + help + Enable support for /proc/sys/debug/exception-trace. + +config SYSCTL_ARCH_UNALIGN_NO_WARN + bool + help + Enable support for /proc/sys/kernel/ignore-unaligned-usertrap + Allows arch to define/use @no_unaligned_warning to possibly warn + about unaligned access emulation going on under the hood. + +config SYSCTL_ARCH_UNALIGN_ALLOW + bool + help + Enable support for /proc/sys/kernel/unaligned-trap + Allows arches to define/use @unaligned_enabled to runtime toggle + the unaligned access emulation. + see arch/parisc/kernel/unaligned.c for reference + +config HAVE_PCSPKR_PLATFORM + bool + menuconfig EXPERT bool "Configure standard kernel features (expert users)" # Unhide debug options, to make the on-by-default options visible @@ -1200,9 +1298,6 @@ menuconfig EXPERT environments which can tolerate a "non-standard" kernel. Only use this if you really know what you are doing. -config HAVE_UID16 - bool - config UID16 bool "Enable 16-bit UID system calls" if EXPERT depends on HAVE_UID16 @@ -1227,11 +1322,6 @@ config SYSCTL_SYSCALL If unsure say N here. -config SYSCTL_EXCEPTION_TRACE - bool - help - Enable support for /proc/sys/debug/exception-trace. - config KALLSYMS bool "Load all symbols for debugging/ksymoops" if EXPERT default y @@ -1257,12 +1347,10 @@ config KALLSYMS_ALL Say N unless you really need all symbols. -config HOTPLUG - def_bool y - config PRINTK default y bool "Enable support for printk" if EXPERT + select IRQ_WORK help This option enables normal printk support. Removing it eliminates most of the message strings from the kernel image @@ -1297,9 +1385,6 @@ config PCSPKR_PLATFORM This option allows to disable the internal PC-Speaker support, saving some memory. -config HAVE_PCSPKR_PLATFORM - bool - config BASE_FULL default y bool "Enable full-sized data structures for core" if EXPERT @@ -1371,8 +1456,17 @@ config AIO default y help This option enables POSIX asynchronous I/O which may by used - by some high performance threaded applications. Disabling - this option saves about 7k. + by some high performance threaded applications. Disabling + this option saves about 7k. + +config PCI_QUIRKS + default y + bool "Enable PCI quirk workarounds" if EXPERT + depends on PCI + help + This enables workarounds for various PCI chipset + bugs/quirks. Disable this only if your target machine is + unaffected by PCI quirks. config EMBEDDED bool "Embedded system" @@ -1447,15 +1541,6 @@ config VM_EVENT_COUNTERS on EXPERT systems. /proc/vmstat will only show page counts if VM event counters are disabled. -config PCI_QUIRKS - default y - bool "Enable PCI quirk workarounds" if EXPERT - depends on PCI - help - This enables workarounds for various PCI chipset - bugs/quirks. Disable this only if your target machine is - unaffected by PCI quirks. - config SLUB_DEBUG default y bool "Enable SLUB debugging support" if EXPERT @@ -1619,7 +1704,7 @@ config MODULE_UNLOAD config MODULE_FORCE_UNLOAD bool "Forced module unloading" - depends on MODULE_UNLOAD && EXPERIMENTAL + depends on MODULE_UNLOAD help This option allows you to force a module to unload, even if the kernel believes it is unsafe: the kernel will remove the module @@ -1676,6 +1761,17 @@ config MODULE_SIG_FORCE Reject unsigned modules or signed modules for which we don't have a key. Without this, such modules will simply taint the kernel. +config MODULE_SIG_ALL + bool "Automatically sign all modules" + default y + depends on MODULE_SIG + help + Sign all modules during make modules_install. Without this option, + modules must be signed manually, using the scripts/sign-file tool. + +comment "Do not forget to sign required modules with scripts/sign-file" + depends on MODULE_SIG_FORCE && !MODULE_SIG_ALL + choice prompt "Which hash algorithm should modules be signed with?" depends on MODULE_SIG @@ -1708,6 +1804,15 @@ config MODULE_SIG_SHA512 endchoice +config MODULE_SIG_HASH + string + depends on MODULE_SIG + default "sha1" if MODULE_SIG_SHA1 + default "sha224" if MODULE_SIG_SHA224 + default "sha256" if MODULE_SIG_SHA256 + default "sha384" if MODULE_SIG_SHA384 + default "sha512" if MODULE_SIG_SHA512 + endif # MODULES config INIT_ALL_POSSIBLE diff --git a/init/do_mounts.c b/init/do_mounts.c index 1d1b6348f90..816014c4627 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -81,9 +81,9 @@ struct uuidcmp { * * Returns 1 if the device matches, and 0 otherwise. */ -static int match_dev_by_uuid(struct device *dev, void *data) +static int match_dev_by_uuid(struct device *dev, const void *data) { - struct uuidcmp *cmp = data; + const struct uuidcmp *cmp = data; struct hd_struct *part = dev_to_part(dev); if (!part->info) @@ -536,7 +536,7 @@ void __init prepare_namespace(void) int is_floppy; if (root_delay) { - printk(KERN_INFO "Waiting %dsec before mounting root device...\n", + printk(KERN_INFO "Waiting %d sec before mounting root device...\n", root_delay); ssleep(root_delay); } diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 5e4ded51788..3e0878e8a80 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -36,6 +36,10 @@ __setup("noinitrd", no_initrd); static int init_linuxrc(struct subprocess_info *info, struct cred *new) { sys_unshare(CLONE_FS | CLONE_FILES); + /* stdin/stdout/stderr for /linuxrc */ + sys_open("/dev/console", O_RDWR, 0); + sys_dup(0); + sys_dup(0); /* move initrd over / and chdir/chroot in initrd root */ sys_chdir("/root"); sys_mount(".", "/", NULL, MS_MOVE, NULL); @@ -46,6 +50,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new) static void __init handle_initrd(void) { + struct subprocess_info *info; static char *argv[] = { "linuxrc", NULL, }; extern char *envp_init[]; int error; @@ -57,14 +62,20 @@ static void __init handle_initrd(void) sys_mkdir("/old", 0700); sys_chdir("/old"); + /* try loading default modules from initrd */ + load_default_modules(); + /* * In case that a resume from disk is carried out by linuxrc or one of * its children, we need to tell the freezer not to wait for us. */ current->flags |= PF_FREEZER_SKIP; - call_usermodehelper_fns("/linuxrc", argv, envp_init, UMH_WAIT_PROC, - init_linuxrc, NULL, NULL); + info = call_usermodehelper_setup("/linuxrc", argv, envp_init, + GFP_KERNEL, init_linuxrc, NULL, NULL); + if (!info) + return; + call_usermodehelper_exec(info, UMH_WAIT_PROC); current->flags &= ~PF_FREEZER_SKIP; diff --git a/init/init_task.c b/init/init_task.c index 8b2f3996b03..ba0a7f362d9 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -2,6 +2,8 @@ #include <linux/export.h> #include <linux/mqueue.h> #include <linux/sched.h> +#include <linux/sched/sysctl.h> +#include <linux/sched/rt.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/mm.h> diff --git a/init/initramfs.c b/init/initramfs.c index 84c6bf11130..a67ef9dbda9 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -592,7 +592,7 @@ static int __init populate_rootfs(void) initrd_end - initrd_start); if (!err) { free_initrd(); - return 0; + goto done; } else { clean_rootfs(); unpack_to_rootfs(__initramfs_start, __initramfs_size); @@ -607,6 +607,7 @@ static int __init populate_rootfs(void) sys_close(fd); free_initrd(); } + done: #else printk(KERN_INFO "Unpacking initramfs...\n"); err = unpack_to_rootfs((char *)initrd_start, @@ -615,6 +616,11 @@ static int __init populate_rootfs(void) printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err); free_initrd(); #endif + /* + * Try loading default modules from initramfs. This gives + * us a chance to load before device_initcalls. + */ + load_default_modules(); } return 0; } diff --git a/init/main.c b/init/main.c index 85d69dffe86..d03d2ec2eac 100644 --- a/init/main.c +++ b/init/main.c @@ -9,6 +9,8 @@ * Simplified starting of init: Michael A. Griffith <grif@acm.org> */ +#define DEBUG /* Enable initcall_debug */ + #include <linux/types.h> #include <linux/module.h> #include <linux/proc_fs.h> @@ -70,6 +72,9 @@ #include <linux/perf_event.h> #include <linux/file.h> #include <linux/ptrace.h> +#include <linux/blkdev.h> +#include <linux/elevator.h> +#include <linux/sched_clock.h> #include <asm/io.h> #include <asm/bugs.h> @@ -172,8 +177,8 @@ static int __init obsolete_checksetup(char *line) if (line[n] == '\0' || line[n] == '=') had_early_param = 1; } else if (!p->setup_func) { - printk(KERN_WARNING "Parameter %s is obsolete," - " ignored\n", p->str); + pr_warn("Parameter %s is obsolete, ignored\n", + p->str); return 1; } else if (p->setup_func(line + n)) return 1; @@ -382,7 +387,7 @@ static noinline void __init_refok rest_init(void) init_idle_bootup_task(current); schedule_preempt_disabled(); /* Call into cpu_idle with preempt disabled */ - cpu_idle(); + cpu_startup_entry(CPUHP_ONLINE); } /* Check for early params. */ @@ -396,8 +401,7 @@ static int __init do_early_param(char *param, char *val, const char *unused) strcmp(p->str, "earlycon") == 0) ) { if (p->setup_func(val) != 0) - printk(KERN_WARNING - "Malformed early option '%s'\n", param); + pr_warn("Malformed early option '%s'\n", param); } } /* We accept everything at this stage. */ @@ -492,10 +496,9 @@ asmlinkage void __init start_kernel(void) * Interrupts are still disabled. Do necessary setups, then * enable them */ - tick_init(); boot_cpu_init(); page_address_init(); - printk(KERN_NOTICE "%s", linux_banner); + pr_notice("%s", linux_banner); setup_arch(&command_line); mm_init_owner(&init_mm, &init_task); mm_init_cpumask(&init_mm); @@ -507,7 +510,7 @@ asmlinkage void __init start_kernel(void) build_all_zonelists(NULL, NULL); page_alloc_init(); - printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); + pr_notice("Kernel command line: %s\n", boot_command_line); parse_early_param(); parse_args("Booting kernel", static_command_line, __start___param, __stop___param - __start___param, @@ -537,28 +540,26 @@ asmlinkage void __init start_kernel(void) * fragile until we cpu_idle() for the first time. */ preempt_disable(); - if (!irqs_disabled()) { - printk(KERN_WARNING "start_kernel(): bug: interrupts were " - "enabled *very* early, fixing it\n"); + if (WARN(!irqs_disabled(), "Interrupts were enabled *very* early, fixing it\n")) local_irq_disable(); - } idr_init_cache(); - perf_event_init(); rcu_init(); + tick_nohz_init(); radix_tree_init(); /* init some links before init_ISA_irqs() */ early_irq_init(); init_IRQ(); + tick_init(); init_timers(); hrtimers_init(); softirq_init(); timekeeping_init(); time_init(); + sched_clock_postinit(); + perf_event_init(); profile_init(); call_function_init(); - if (!irqs_disabled()) - printk(KERN_CRIT "start_kernel(): bug: interrupts were " - "enabled early\n"); + WARN(!irqs_disabled(), "Interrupts were enabled early\n"); early_boot_irqs_disabled = false; local_irq_enable(); @@ -585,8 +586,7 @@ asmlinkage void __init start_kernel(void) #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) { - printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " - "disabling it.\n", + pr_crit("initrd overwritten (0x%08lx < 0x%08lx) - disabling it.\n", page_to_pfn(virt_to_page((void *)initrd_start)), min_low_pfn); initrd_start = 0; @@ -604,7 +604,7 @@ asmlinkage void __init start_kernel(void) pidmap_init(); anon_vma_init(); #ifdef CONFIG_X86 - if (efi_enabled) + if (efi_enabled(EFI_RUNTIME_SERVICES)) efi_enter_virtual_mode(); #endif thread_info_cache_init(); @@ -632,7 +632,7 @@ asmlinkage void __init start_kernel(void) acpi_early_init(); /* before LAPIC and SMP init */ sfi_init_late(); - if (efi_enabled) { + if (efi_enabled(EFI_RUNTIME_SERVICES)) { efi_late_init(); efi_free_boot_services(); } @@ -657,22 +657,20 @@ static void __init do_ctors(void) bool initcall_debug; core_param(initcall_debug, initcall_debug, bool, 0644); -static char msgbuf[64]; - static int __init_or_module do_one_initcall_debug(initcall_t fn) { ktime_t calltime, delta, rettime; unsigned long long duration; int ret; - printk(KERN_DEBUG "calling %pF @ %i\n", fn, task_pid_nr(current)); + pr_debug("calling %pF @ %i\n", fn, task_pid_nr(current)); calltime = ktime_get(); ret = fn(); rettime = ktime_get(); delta = ktime_sub(rettime, calltime); duration = (unsigned long long) ktime_to_ns(delta) >> 10; - printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n", fn, - ret, duration); + pr_debug("initcall %pF returned %d after %lld usecs\n", + fn, ret, duration); return ret; } @@ -681,6 +679,7 @@ int __init_or_module do_one_initcall(initcall_t fn) { int count = preempt_count(); int ret; + char msgbuf[64]; if (initcall_debug) ret = do_one_initcall_debug(fn); @@ -689,20 +688,15 @@ int __init_or_module do_one_initcall(initcall_t fn) msgbuf[0] = 0; - if (ret && ret != -ENODEV && initcall_debug) - sprintf(msgbuf, "error code %d ", ret); - if (preempt_count() != count) { - strlcat(msgbuf, "preemption imbalance ", sizeof(msgbuf)); + sprintf(msgbuf, "preemption imbalance "); preempt_count() = count; } if (irqs_disabled()) { strlcat(msgbuf, "disabled interrupts ", sizeof(msgbuf)); local_irq_enable(); } - if (msgbuf[0]) { - printk("initcall %pF returned with %s\n", fn, msgbuf); - } + WARN(msgbuf[0], "initcall %pF returned with %s\n", fn, msgbuf); return ret; } @@ -794,6 +788,17 @@ static void __init do_pre_smp_initcalls(void) do_one_initcall(*fn); } +/* + * This function requests modules which should be loaded by default and is + * called twice right after initrd is mounted and right before init is + * exec'd. If such modules are on either initrd or rootfs, they will be + * loaded before control is passed to userland. + */ +void __init load_default_modules(void) +{ + load_default_elevator_module(); +} + static int run_init_process(const char *init_filename) { argv_init[0] = init_filename; @@ -802,7 +807,7 @@ static int run_init_process(const char *init_filename) (const char __user *const __user *)envp_init); } -static void __init kernel_init_freeable(void); +static noinline void __init kernel_init_freeable(void); static int __ref kernel_init(void *unused) { @@ -819,8 +824,7 @@ static int __ref kernel_init(void *unused) if (ramdisk_execute_command) { if (!run_init_process(ramdisk_execute_command)) return 0; - printk(KERN_WARNING "Failed to execute %s\n", - ramdisk_execute_command); + pr_err("Failed to execute %s\n", ramdisk_execute_command); } /* @@ -832,8 +836,8 @@ static int __ref kernel_init(void *unused) if (execute_command) { if (!run_init_process(execute_command)) return 0; - printk(KERN_WARNING "Failed to execute %s. Attempting " - "defaults...\n", execute_command); + pr_err("Failed to execute %s. Attempting defaults...\n", + execute_command); } if (!run_init_process("/sbin/init") || !run_init_process("/etc/init") || @@ -845,7 +849,7 @@ static int __ref kernel_init(void *unused) "See Linux Documentation/init.txt for guidance."); } -static void __init kernel_init_freeable(void) +static noinline void __init kernel_init_freeable(void) { /* * Wait until kthreadd is all set-up. @@ -878,7 +882,7 @@ static void __init kernel_init_freeable(void) /* Open the /dev/console on the rootfs, this should never fail */ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) - printk(KERN_WARNING "Warning: unable to open an initial console.\n"); + pr_err("Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); @@ -900,4 +904,7 @@ static void __init kernel_init_freeable(void) * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ + + /* rootfs is available now, try loading default modules */ + load_default_modules(); } diff --git a/init/version.c b/init/version.c index 58170f18912..1a4718e500f 100644 --- a/init/version.c +++ b/init/version.c @@ -12,7 +12,7 @@ #include <linux/utsname.h> #include <generated/utsrelease.h> #include <linux/version.h> -#include <linux/proc_fs.h> +#include <linux/proc_ns.h> #ifndef CONFIG_KALLSYMS #define version(a) Version_ ## a |