diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2014-11-20 08:42:02 -0500 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2014-11-20 08:42:02 -0500 |
| commit | a02001086bbfb4da35d1228bebc2f1b442db455f (patch) | |
| tree | 62ab47936cef06fd08657ca5b6cd1df98c19be57 /init | |
| parent | eff264efeeb0898408e8c9df72d8a32621035bed (diff) | |
| parent | fc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff) | |
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'init')
| -rw-r--r-- | init/Kconfig | 147 | ||||
| -rw-r--r-- | init/calibrate.c | 11 | ||||
| -rw-r--r-- | init/do_mounts_rd.c | 10 | ||||
| -rw-r--r-- | init/initramfs.c | 90 | ||||
| -rw-r--r-- | init/main.c | 30 |
5 files changed, 221 insertions, 67 deletions
diff --git a/init/Kconfig b/init/Kconfig index 6069b210d83a..2081a4d3d917 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -507,6 +507,16 @@ config PREEMPT_RCU | |||
| 507 | This option enables preemptible-RCU code that is common between | 507 | This option enables preemptible-RCU code that is common between |
| 508 | TREE_PREEMPT_RCU and, in the old days, TINY_PREEMPT_RCU. | 508 | TREE_PREEMPT_RCU and, in the old days, TINY_PREEMPT_RCU. |
| 509 | 509 | ||
| 510 | config TASKS_RCU | ||
| 511 | bool "Task_based RCU implementation using voluntary context switch" | ||
| 512 | default n | ||
| 513 | help | ||
| 514 | This option enables a task-based RCU implementation that uses | ||
| 515 | only voluntary context switch (not preemption!), idle, and | ||
| 516 | user-mode execution as quiescent states. | ||
| 517 | |||
| 518 | If unsure, say N. | ||
| 519 | |||
| 510 | config RCU_STALL_COMMON | 520 | config RCU_STALL_COMMON |
| 511 | def_bool ( TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE ) | 521 | def_bool ( TREE_RCU || TREE_PREEMPT_RCU || RCU_TRACE ) |
| 512 | help | 522 | help |
| @@ -737,7 +747,7 @@ choice | |||
| 737 | 747 | ||
| 738 | config RCU_NOCB_CPU_NONE | 748 | config RCU_NOCB_CPU_NONE |
| 739 | bool "No build_forced no-CBs CPUs" | 749 | bool "No build_forced no-CBs CPUs" |
| 740 | depends on RCU_NOCB_CPU && !NO_HZ_FULL_ALL | 750 | depends on RCU_NOCB_CPU |
| 741 | help | 751 | help |
| 742 | This option does not force any of the CPUs to be no-CBs CPUs. | 752 | This option does not force any of the CPUs to be no-CBs CPUs. |
| 743 | Only CPUs designated by the rcu_nocbs= boot parameter will be | 753 | Only CPUs designated by the rcu_nocbs= boot parameter will be |
| @@ -751,7 +761,7 @@ config RCU_NOCB_CPU_NONE | |||
| 751 | 761 | ||
| 752 | config RCU_NOCB_CPU_ZERO | 762 | config RCU_NOCB_CPU_ZERO |
| 753 | bool "CPU 0 is a build_forced no-CBs CPU" | 763 | bool "CPU 0 is a build_forced no-CBs CPU" |
| 754 | depends on RCU_NOCB_CPU && !NO_HZ_FULL_ALL | 764 | depends on RCU_NOCB_CPU |
| 755 | help | 765 | help |
| 756 | This option forces CPU 0 to be a no-CBs CPU, so that its RCU | 766 | This option forces CPU 0 to be a no-CBs CPU, so that its RCU |
| 757 | callbacks are invoked by a per-CPU kthread whose name begins | 767 | callbacks are invoked by a per-CPU kthread whose name begins |
| @@ -783,8 +793,13 @@ endchoice | |||
| 783 | 793 | ||
| 784 | endmenu # "RCU Subsystem" | 794 | endmenu # "RCU Subsystem" |
| 785 | 795 | ||
| 796 | config BUILD_BIN2C | ||
| 797 | bool | ||
| 798 | default n | ||
| 799 | |||
| 786 | config IKCONFIG | 800 | config IKCONFIG |
| 787 | tristate "Kernel .config support" | 801 | tristate "Kernel .config support" |
| 802 | select BUILD_BIN2C | ||
| 788 | ---help--- | 803 | ---help--- |
| 789 | This option enables the complete Linux kernel ".config" file | 804 | This option enables the complete Linux kernel ".config" file |
| 790 | contents to be saved in the kernel. It provides documentation | 805 | contents to be saved in the kernel. It provides documentation |
| @@ -806,16 +821,57 @@ config LOG_BUF_SHIFT | |||
| 806 | int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" | 821 | int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" |
| 807 | range 12 21 | 822 | range 12 21 |
| 808 | default 17 | 823 | default 17 |
| 824 | depends on PRINTK | ||
| 809 | help | 825 | help |
| 810 | Select kernel log buffer size as a power of 2. | 826 | Select the minimal kernel log buffer size as a power of 2. |
| 827 | The final size is affected by LOG_CPU_MAX_BUF_SHIFT config | ||
| 828 | parameter, see below. Any higher size also might be forced | ||
| 829 | by "log_buf_len" boot parameter. | ||
| 830 | |||
| 811 | Examples: | 831 | Examples: |
| 812 | 17 => 128 KB | 832 | 17 => 128 KB |
| 813 | 16 => 64 KB | 833 | 16 => 64 KB |
| 814 | 15 => 32 KB | 834 | 15 => 32 KB |
| 815 | 14 => 16 KB | 835 | 14 => 16 KB |
| 816 | 13 => 8 KB | 836 | 13 => 8 KB |
| 817 | 12 => 4 KB | 837 | 12 => 4 KB |
| 818 | 838 | ||
| 839 | config LOG_CPU_MAX_BUF_SHIFT | ||
| 840 | int "CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)" | ||
| 841 | depends on SMP | ||
| 842 | range 0 21 | ||
| 843 | default 12 if !BASE_SMALL | ||
| 844 | default 0 if BASE_SMALL | ||
| 845 | depends on PRINTK | ||
| 846 | help | ||
| 847 | This option allows to increase the default ring buffer size | ||
| 848 | according to the number of CPUs. The value defines the contribution | ||
| 849 | of each CPU as a power of 2. The used space is typically only few | ||
| 850 | lines however it might be much more when problems are reported, | ||
| 851 | e.g. backtraces. | ||
| 852 | |||
| 853 | The increased size means that a new buffer has to be allocated and | ||
| 854 | the original static one is unused. It makes sense only on systems | ||
| 855 | with more CPUs. Therefore this value is used only when the sum of | ||
| 856 | contributions is greater than the half of the default kernel ring | ||
| 857 | buffer as defined by LOG_BUF_SHIFT. The default values are set | ||
| 858 | so that more than 64 CPUs are needed to trigger the allocation. | ||
| 859 | |||
| 860 | Also this option is ignored when "log_buf_len" kernel parameter is | ||
| 861 | used as it forces an exact (power of two) size of the ring buffer. | ||
| 862 | |||
| 863 | The number of possible CPUs is used for this computation ignoring | ||
| 864 | hotplugging making the compuation optimal for the the worst case | ||
| 865 | scenerio while allowing a simple algorithm to be used from bootup. | ||
| 866 | |||
| 867 | Examples shift values and their meaning: | ||
| 868 | 17 => 128 KB for each CPU | ||
| 869 | 16 => 64 KB for each CPU | ||
| 870 | 15 => 32 KB for each CPU | ||
| 871 | 14 => 16 KB for each CPU | ||
| 872 | 13 => 8 KB for each CPU | ||
| 873 | 12 => 4 KB for each CPU | ||
| 874 | |||
| 819 | # | 875 | # |
| 820 | # Architectures with an unreliable sched_clock() should select this: | 876 | # Architectures with an unreliable sched_clock() should select this: |
| 821 | # | 877 | # |
| @@ -844,17 +900,6 @@ config ARCH_SUPPORTS_INT128 | |||
| 844 | config ARCH_WANT_NUMA_VARIABLE_LOCALITY | 900 | config ARCH_WANT_NUMA_VARIABLE_LOCALITY |
| 845 | bool | 901 | bool |
| 846 | 902 | ||
| 847 | # | ||
| 848 | # For architectures that are willing to define _PAGE_NUMA as _PAGE_PROTNONE | ||
| 849 | config ARCH_WANTS_PROT_NUMA_PROT_NONE | ||
| 850 | bool | ||
| 851 | |||
| 852 | config ARCH_USES_NUMA_PROT_NONE | ||
| 853 | bool | ||
| 854 | default y | ||
| 855 | depends on ARCH_WANTS_PROT_NUMA_PROT_NONE | ||
| 856 | depends on NUMA_BALANCING | ||
| 857 | |||
| 858 | config NUMA_BALANCING_DEFAULT_ENABLED | 903 | config NUMA_BALANCING_DEFAULT_ENABLED |
| 859 | bool "Automatically enable NUMA aware memory/task placement" | 904 | bool "Automatically enable NUMA aware memory/task placement" |
| 860 | default y | 905 | default y |
| @@ -1296,6 +1341,10 @@ config SYSCTL_ARCH_UNALIGN_ALLOW | |||
| 1296 | config HAVE_PCSPKR_PLATFORM | 1341 | config HAVE_PCSPKR_PLATFORM |
| 1297 | bool | 1342 | bool |
| 1298 | 1343 | ||
| 1344 | # interpreter that classic socket filters depend on | ||
| 1345 | config BPF | ||
| 1346 | bool | ||
| 1347 | |||
| 1299 | menuconfig EXPERT | 1348 | menuconfig EXPERT |
| 1300 | bool "Configure standard kernel features (expert users)" | 1349 | bool "Configure standard kernel features (expert users)" |
| 1301 | # Unhide debug options, to make the on-by-default options visible | 1350 | # Unhide debug options, to make the on-by-default options visible |
| @@ -1432,6 +1481,7 @@ config FUTEX | |||
| 1432 | 1481 | ||
| 1433 | config HAVE_FUTEX_CMPXCHG | 1482 | config HAVE_FUTEX_CMPXCHG |
| 1434 | bool | 1483 | bool |
| 1484 | depends on FUTEX | ||
| 1435 | help | 1485 | help |
| 1436 | Architectures should select this if futex_atomic_cmpxchg_inatomic() | 1486 | Architectures should select this if futex_atomic_cmpxchg_inatomic() |
| 1437 | is implemented and always working. This removes a couple of runtime | 1487 | is implemented and always working. This removes a couple of runtime |
| @@ -1475,6 +1525,16 @@ config EVENTFD | |||
| 1475 | 1525 | ||
| 1476 | If unsure, say Y. | 1526 | If unsure, say Y. |
| 1477 | 1527 | ||
| 1528 | # syscall, maps, verifier | ||
| 1529 | config BPF_SYSCALL | ||
| 1530 | bool "Enable bpf() system call" if EXPERT | ||
| 1531 | select ANON_INODES | ||
| 1532 | select BPF | ||
| 1533 | default n | ||
| 1534 | help | ||
| 1535 | Enable the bpf() system call that allows to manipulate eBPF | ||
| 1536 | programs and maps via file descriptors. | ||
| 1537 | |||
| 1478 | config SHMEM | 1538 | config SHMEM |
| 1479 | bool "Use full shmem filesystem" if EXPERT | 1539 | bool "Use full shmem filesystem" if EXPERT |
| 1480 | default y | 1540 | default y |
| @@ -1494,6 +1554,16 @@ config AIO | |||
| 1494 | by some high performance threaded applications. Disabling | 1554 | by some high performance threaded applications. Disabling |
| 1495 | this option saves about 7k. | 1555 | this option saves about 7k. |
| 1496 | 1556 | ||
| 1557 | config ADVISE_SYSCALLS | ||
| 1558 | bool "Enable madvise/fadvise syscalls" if EXPERT | ||
| 1559 | default y | ||
| 1560 | help | ||
| 1561 | This option enables the madvise and fadvise syscalls, used by | ||
| 1562 | applications to advise the kernel about their future memory or file | ||
| 1563 | usage, improving performance. If building an embedded system where no | ||
| 1564 | applications use these syscalls, you can disable this option to save | ||
| 1565 | space. | ||
| 1566 | |||
| 1497 | config PCI_QUIRKS | 1567 | config PCI_QUIRKS |
| 1498 | default y | 1568 | default y |
| 1499 | bool "Enable PCI quirk workarounds" if EXPERT | 1569 | bool "Enable PCI quirk workarounds" if EXPERT |
| @@ -1863,6 +1933,49 @@ config MODULE_SIG_HASH | |||
| 1863 | default "sha384" if MODULE_SIG_SHA384 | 1933 | default "sha384" if MODULE_SIG_SHA384 |
| 1864 | default "sha512" if MODULE_SIG_SHA512 | 1934 | default "sha512" if MODULE_SIG_SHA512 |
| 1865 | 1935 | ||
| 1936 | config MODULE_COMPRESS | ||
| 1937 | bool "Compress modules on installation" | ||
| 1938 | depends on MODULES | ||
| 1939 | help | ||
| 1940 | This option compresses the kernel modules when 'make | ||
| 1941 | modules_install' is run. | ||
| 1942 | |||
| 1943 | The modules will be compressed either using gzip or xz depend on the | ||
| 1944 | choice made in "Compression algorithm". | ||
| 1945 | |||
| 1946 | module-init-tools has support for gzip format while kmod handle gzip | ||
| 1947 | and xz compressed modules. | ||
| 1948 | |||
| 1949 | When a kernel module is installed from outside of the main kernel | ||
| 1950 | source and uses the Kbuild system for installing modules then that | ||
| 1951 | kernel module will also be compressed when it is installed. | ||
| 1952 | |||
| 1953 | This option provides little benefit when the modules are to be used inside | ||
| 1954 | an initrd or initramfs, it generally is more efficient to compress the whole | ||
| 1955 | initrd or initramfs instead. | ||
| 1956 | |||
| 1957 | This is fully compatible with signed modules while the signed module is | ||
| 1958 | compressed. module-init-tools or kmod handles decompression and provide to | ||
| 1959 | other layer the uncompressed but signed payload. | ||
| 1960 | |||
| 1961 | choice | ||
| 1962 | prompt "Compression algorithm" | ||
| 1963 | depends on MODULE_COMPRESS | ||
| 1964 | default MODULE_COMPRESS_GZIP | ||
| 1965 | help | ||
| 1966 | This determines which sort of compression will be used during | ||
| 1967 | 'make modules_install'. | ||
| 1968 | |||
| 1969 | GZIP (default) and XZ are supported. | ||
| 1970 | |||
| 1971 | config MODULE_COMPRESS_GZIP | ||
| 1972 | bool "GZIP" | ||
| 1973 | |||
| 1974 | config MODULE_COMPRESS_XZ | ||
| 1975 | bool "XZ" | ||
| 1976 | |||
| 1977 | endchoice | ||
| 1978 | |||
| 1866 | endif # MODULES | 1979 | endif # MODULES |
| 1867 | 1980 | ||
| 1868 | config INIT_ALL_POSSIBLE | 1981 | config INIT_ALL_POSSIBLE |
diff --git a/init/calibrate.c b/init/calibrate.c index 520702db9acc..ce635dccf3d9 100644 --- a/init/calibrate.c +++ b/init/calibrate.c | |||
| @@ -262,6 +262,15 @@ unsigned long __attribute__((weak)) calibrate_delay_is_known(void) | |||
| 262 | return 0; | 262 | return 0; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | /* | ||
| 266 | * Indicate the cpu delay calibration is done. This can be used by | ||
| 267 | * architectures to stop accepting delay timer registrations after this point. | ||
| 268 | */ | ||
| 269 | |||
| 270 | void __attribute__((weak)) calibration_delay_done(void) | ||
| 271 | { | ||
| 272 | } | ||
| 273 | |||
| 265 | void calibrate_delay(void) | 274 | void calibrate_delay(void) |
| 266 | { | 275 | { |
| 267 | unsigned long lpj; | 276 | unsigned long lpj; |
| @@ -301,4 +310,6 @@ void calibrate_delay(void) | |||
| 301 | 310 | ||
| 302 | loops_per_jiffy = lpj; | 311 | loops_per_jiffy = lpj; |
| 303 | printed = true; | 312 | printed = true; |
| 313 | |||
| 314 | calibration_delay_done(); | ||
| 304 | } | 315 | } |
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index a8227022e3a0..e5d059e8aa11 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c | |||
| @@ -311,9 +311,9 @@ static int exit_code; | |||
| 311 | static int decompress_error; | 311 | static int decompress_error; |
| 312 | static int crd_infd, crd_outfd; | 312 | static int crd_infd, crd_outfd; |
| 313 | 313 | ||
| 314 | static int __init compr_fill(void *buf, unsigned int len) | 314 | static long __init compr_fill(void *buf, unsigned long len) |
| 315 | { | 315 | { |
| 316 | int r = sys_read(crd_infd, buf, len); | 316 | long r = sys_read(crd_infd, buf, len); |
| 317 | if (r < 0) | 317 | if (r < 0) |
| 318 | printk(KERN_ERR "RAMDISK: error while reading compressed data"); | 318 | printk(KERN_ERR "RAMDISK: error while reading compressed data"); |
| 319 | else if (r == 0) | 319 | else if (r == 0) |
| @@ -321,13 +321,13 @@ static int __init compr_fill(void *buf, unsigned int len) | |||
| 321 | return r; | 321 | return r; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static int __init compr_flush(void *window, unsigned int outcnt) | 324 | static long __init compr_flush(void *window, unsigned long outcnt) |
| 325 | { | 325 | { |
| 326 | int written = sys_write(crd_outfd, window, outcnt); | 326 | long written = sys_write(crd_outfd, window, outcnt); |
| 327 | if (written != outcnt) { | 327 | if (written != outcnt) { |
| 328 | if (decompress_error == 0) | 328 | if (decompress_error == 0) |
| 329 | printk(KERN_ERR | 329 | printk(KERN_ERR |
| 330 | "RAMDISK: incomplete write (%d != %d)\n", | 330 | "RAMDISK: incomplete write (%ld != %ld)\n", |
| 331 | written, outcnt); | 331 | written, outcnt); |
| 332 | decompress_error = 1; | 332 | decompress_error = 1; |
| 333 | return -1; | 333 | return -1; |
diff --git a/init/initramfs.c b/init/initramfs.c index a8497fab1c3d..ad1bd7787bbb 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
| @@ -19,6 +19,29 @@ | |||
| 19 | #include <linux/syscalls.h> | 19 | #include <linux/syscalls.h> |
| 20 | #include <linux/utime.h> | 20 | #include <linux/utime.h> |
| 21 | 21 | ||
| 22 | static ssize_t __init xwrite(int fd, const char *p, size_t count) | ||
| 23 | { | ||
| 24 | ssize_t out = 0; | ||
| 25 | |||
| 26 | /* sys_write only can write MAX_RW_COUNT aka 2G-4K bytes at most */ | ||
| 27 | while (count) { | ||
| 28 | ssize_t rv = sys_write(fd, p, count); | ||
| 29 | |||
| 30 | if (rv < 0) { | ||
| 31 | if (rv == -EINTR || rv == -EAGAIN) | ||
| 32 | continue; | ||
| 33 | return out ? out : rv; | ||
| 34 | } else if (rv == 0) | ||
| 35 | break; | ||
| 36 | |||
| 37 | p += rv; | ||
| 38 | out += rv; | ||
| 39 | count -= rv; | ||
| 40 | } | ||
| 41 | |||
| 42 | return out; | ||
| 43 | } | ||
| 44 | |||
| 22 | static __initdata char *message; | 45 | static __initdata char *message; |
| 23 | static void __init error(char *x) | 46 | static void __init error(char *x) |
| 24 | { | 47 | { |
| @@ -174,24 +197,24 @@ static __initdata enum state { | |||
| 174 | } state, next_state; | 197 | } state, next_state; |
| 175 | 198 | ||
| 176 | static __initdata char *victim; | 199 | static __initdata char *victim; |
| 177 | static __initdata unsigned count; | 200 | static unsigned long byte_count __initdata; |
| 178 | static __initdata loff_t this_header, next_header; | 201 | static __initdata loff_t this_header, next_header; |
| 179 | 202 | ||
| 180 | static inline void __init eat(unsigned n) | 203 | static inline void __init eat(unsigned n) |
| 181 | { | 204 | { |
| 182 | victim += n; | 205 | victim += n; |
| 183 | this_header += n; | 206 | this_header += n; |
| 184 | count -= n; | 207 | byte_count -= n; |
| 185 | } | 208 | } |
| 186 | 209 | ||
| 187 | static __initdata char *vcollected; | 210 | static __initdata char *vcollected; |
| 188 | static __initdata char *collected; | 211 | static __initdata char *collected; |
| 189 | static __initdata int remains; | 212 | static long remains __initdata; |
| 190 | static __initdata char *collect; | 213 | static __initdata char *collect; |
| 191 | 214 | ||
| 192 | static void __init read_into(char *buf, unsigned size, enum state next) | 215 | static void __init read_into(char *buf, unsigned size, enum state next) |
| 193 | { | 216 | { |
| 194 | if (count >= size) { | 217 | if (byte_count >= size) { |
| 195 | collected = victim; | 218 | collected = victim; |
| 196 | eat(size); | 219 | eat(size); |
| 197 | state = next; | 220 | state = next; |
| @@ -213,9 +236,9 @@ static int __init do_start(void) | |||
| 213 | 236 | ||
| 214 | static int __init do_collect(void) | 237 | static int __init do_collect(void) |
| 215 | { | 238 | { |
| 216 | unsigned n = remains; | 239 | unsigned long n = remains; |
| 217 | if (count < n) | 240 | if (byte_count < n) |
| 218 | n = count; | 241 | n = byte_count; |
| 219 | memcpy(collect, victim, n); | 242 | memcpy(collect, victim, n); |
| 220 | eat(n); | 243 | eat(n); |
| 221 | collect += n; | 244 | collect += n; |
| @@ -257,8 +280,8 @@ static int __init do_header(void) | |||
| 257 | 280 | ||
| 258 | static int __init do_skip(void) | 281 | static int __init do_skip(void) |
| 259 | { | 282 | { |
| 260 | if (this_header + count < next_header) { | 283 | if (this_header + byte_count < next_header) { |
| 261 | eat(count); | 284 | eat(byte_count); |
| 262 | return 1; | 285 | return 1; |
| 263 | } else { | 286 | } else { |
| 264 | eat(next_header - this_header); | 287 | eat(next_header - this_header); |
| @@ -269,9 +292,9 @@ static int __init do_skip(void) | |||
| 269 | 292 | ||
| 270 | static int __init do_reset(void) | 293 | static int __init do_reset(void) |
| 271 | { | 294 | { |
| 272 | while(count && *victim == '\0') | 295 | while (byte_count && *victim == '\0') |
| 273 | eat(1); | 296 | eat(1); |
| 274 | if (count && (this_header & 3)) | 297 | if (byte_count && (this_header & 3)) |
| 275 | error("broken padding"); | 298 | error("broken padding"); |
| 276 | return 1; | 299 | return 1; |
| 277 | } | 300 | } |
| @@ -286,11 +309,11 @@ static int __init maybe_link(void) | |||
| 286 | return 0; | 309 | return 0; |
| 287 | } | 310 | } |
| 288 | 311 | ||
| 289 | static void __init clean_path(char *path, umode_t mode) | 312 | static void __init clean_path(char *path, umode_t fmode) |
| 290 | { | 313 | { |
| 291 | struct stat st; | 314 | struct stat st; |
| 292 | 315 | ||
| 293 | if (!sys_newlstat(path, &st) && (st.st_mode^mode) & S_IFMT) { | 316 | if (!sys_newlstat(path, &st) && (st.st_mode ^ fmode) & S_IFMT) { |
| 294 | if (S_ISDIR(st.st_mode)) | 317 | if (S_ISDIR(st.st_mode)) |
| 295 | sys_rmdir(path); | 318 | sys_rmdir(path); |
| 296 | else | 319 | else |
| @@ -345,8 +368,9 @@ static int __init do_name(void) | |||
| 345 | 368 | ||
| 346 | static int __init do_copy(void) | 369 | static int __init do_copy(void) |
| 347 | { | 370 | { |
| 348 | if (count >= body_len) { | 371 | if (byte_count >= body_len) { |
| 349 | sys_write(wfd, victim, body_len); | 372 | if (xwrite(wfd, victim, body_len) != body_len) |
| 373 | error("write error"); | ||
| 350 | sys_close(wfd); | 374 | sys_close(wfd); |
| 351 | do_utime(vcollected, mtime); | 375 | do_utime(vcollected, mtime); |
| 352 | kfree(vcollected); | 376 | kfree(vcollected); |
| @@ -354,9 +378,10 @@ static int __init do_copy(void) | |||
| 354 | state = SkipIt; | 378 | state = SkipIt; |
| 355 | return 0; | 379 | return 0; |
| 356 | } else { | 380 | } else { |
| 357 | sys_write(wfd, victim, count); | 381 | if (xwrite(wfd, victim, byte_count) != byte_count) |
| 358 | body_len -= count; | 382 | error("write error"); |
| 359 | eat(count); | 383 | body_len -= byte_count; |
| 384 | eat(byte_count); | ||
| 360 | return 1; | 385 | return 1; |
| 361 | } | 386 | } |
| 362 | } | 387 | } |
| @@ -384,21 +409,21 @@ static __initdata int (*actions[])(void) = { | |||
| 384 | [Reset] = do_reset, | 409 | [Reset] = do_reset, |
| 385 | }; | 410 | }; |
| 386 | 411 | ||
| 387 | static int __init write_buffer(char *buf, unsigned len) | 412 | static long __init write_buffer(char *buf, unsigned long len) |
| 388 | { | 413 | { |
| 389 | count = len; | 414 | byte_count = len; |
| 390 | victim = buf; | 415 | victim = buf; |
| 391 | 416 | ||
| 392 | while (!actions[state]()) | 417 | while (!actions[state]()) |
| 393 | ; | 418 | ; |
| 394 | return len - count; | 419 | return len - byte_count; |
| 395 | } | 420 | } |
| 396 | 421 | ||
| 397 | static int __init flush_buffer(void *bufv, unsigned len) | 422 | static long __init flush_buffer(void *bufv, unsigned long len) |
| 398 | { | 423 | { |
| 399 | char *buf = (char *) bufv; | 424 | char *buf = (char *) bufv; |
| 400 | int written; | 425 | long written; |
| 401 | int origLen = len; | 426 | long origLen = len; |
| 402 | if (message) | 427 | if (message) |
| 403 | return -1; | 428 | return -1; |
| 404 | while ((written = write_buffer(buf, len)) < len && !message) { | 429 | while ((written = write_buffer(buf, len)) < len && !message) { |
| @@ -417,13 +442,13 @@ static int __init flush_buffer(void *bufv, unsigned len) | |||
| 417 | return origLen; | 442 | return origLen; |
| 418 | } | 443 | } |
| 419 | 444 | ||
| 420 | static unsigned my_inptr; /* index of next byte to be processed in inbuf */ | 445 | static unsigned long my_inptr; /* index of next byte to be processed in inbuf */ |
| 421 | 446 | ||
| 422 | #include <linux/decompress/generic.h> | 447 | #include <linux/decompress/generic.h> |
| 423 | 448 | ||
| 424 | static char * __init unpack_to_rootfs(char *buf, unsigned len) | 449 | static char * __init unpack_to_rootfs(char *buf, unsigned long len) |
| 425 | { | 450 | { |
| 426 | int written, res; | 451 | long written; |
| 427 | decompress_fn decompress; | 452 | decompress_fn decompress; |
| 428 | const char *compress_name; | 453 | const char *compress_name; |
| 429 | static __initdata char msg_buf[64]; | 454 | static __initdata char msg_buf[64]; |
| @@ -457,7 +482,7 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len) | |||
| 457 | decompress = decompress_method(buf, len, &compress_name); | 482 | decompress = decompress_method(buf, len, &compress_name); |
| 458 | pr_debug("Detected %s compressed data\n", compress_name); | 483 | pr_debug("Detected %s compressed data\n", compress_name); |
| 459 | if (decompress) { | 484 | if (decompress) { |
| 460 | res = decompress(buf, len, NULL, flush_buffer, NULL, | 485 | int res = decompress(buf, len, NULL, flush_buffer, NULL, |
| 461 | &my_inptr, error); | 486 | &my_inptr, error); |
| 462 | if (res) | 487 | if (res) |
| 463 | error("decompressor failed"); | 488 | error("decompressor failed"); |
| @@ -603,8 +628,13 @@ static int __init populate_rootfs(void) | |||
| 603 | fd = sys_open("/initrd.image", | 628 | fd = sys_open("/initrd.image", |
| 604 | O_WRONLY|O_CREAT, 0700); | 629 | O_WRONLY|O_CREAT, 0700); |
| 605 | if (fd >= 0) { | 630 | if (fd >= 0) { |
| 606 | sys_write(fd, (char *)initrd_start, | 631 | ssize_t written = xwrite(fd, (char *)initrd_start, |
| 607 | initrd_end - initrd_start); | 632 | initrd_end - initrd_start); |
| 633 | |||
| 634 | if (written != initrd_end - initrd_start) | ||
| 635 | pr_err("/initrd.image: incomplete write (%zd != %ld)\n", | ||
| 636 | written, initrd_end - initrd_start); | ||
| 637 | |||
| 608 | sys_close(fd); | 638 | sys_close(fd); |
| 609 | free_initrd(); | 639 | free_initrd(); |
| 610 | } | 640 | } |
diff --git a/init/main.c b/init/main.c index e8ae1fef0908..321d0ceb26d3 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * GK 2/5/95 - Changed to support mounting root fs via NFS | 6 | * GK 2/5/95 - Changed to support mounting root fs via NFS |
| 7 | * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 | 7 | * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 |
| 8 | * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 | 8 | * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 |
| 9 | * Simplified starting of init: Michael A. Griffith <grif@acm.org> | 9 | * Simplified starting of init: Michael A. Griffith <grif@acm.org> |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #define DEBUG /* Enable initcall_debug */ | 12 | #define DEBUG /* Enable initcall_debug */ |
| @@ -136,7 +136,7 @@ static char *ramdisk_execute_command; | |||
| 136 | * Used to generate warnings if static_key manipulation functions are used | 136 | * Used to generate warnings if static_key manipulation functions are used |
| 137 | * before jump_label_init is called. | 137 | * before jump_label_init is called. |
| 138 | */ | 138 | */ |
| 139 | bool static_key_initialized __read_mostly = false; | 139 | bool static_key_initialized __read_mostly; |
| 140 | EXPORT_SYMBOL_GPL(static_key_initialized); | 140 | EXPORT_SYMBOL_GPL(static_key_initialized); |
| 141 | 141 | ||
| 142 | /* | 142 | /* |
| @@ -159,8 +159,8 @@ static int __init set_reset_devices(char *str) | |||
| 159 | 159 | ||
| 160 | __setup("reset_devices", set_reset_devices); | 160 | __setup("reset_devices", set_reset_devices); |
| 161 | 161 | ||
| 162 | static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; | 162 | static const char *argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; |
| 163 | const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; | 163 | const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; |
| 164 | static const char *panic_later, *panic_param; | 164 | static const char *panic_later, *panic_param; |
| 165 | 165 | ||
| 166 | extern const struct obs_kernel_param __setup_start[], __setup_end[]; | 166 | extern const struct obs_kernel_param __setup_start[], __setup_end[]; |
| @@ -199,7 +199,6 @@ static int __init obsolete_checksetup(char *line) | |||
| 199 | * still work even if initially too large, it will just take slightly longer | 199 | * still work even if initially too large, it will just take slightly longer |
| 200 | */ | 200 | */ |
| 201 | unsigned long loops_per_jiffy = (1<<12); | 201 | unsigned long loops_per_jiffy = (1<<12); |
| 202 | |||
| 203 | EXPORT_SYMBOL(loops_per_jiffy); | 202 | EXPORT_SYMBOL(loops_per_jiffy); |
| 204 | 203 | ||
| 205 | static int __init debug_kernel(char *str) | 204 | static int __init debug_kernel(char *str) |
| @@ -376,8 +375,8 @@ static void __init setup_command_line(char *command_line) | |||
| 376 | initcall_command_line = | 375 | initcall_command_line = |
| 377 | memblock_virt_alloc(strlen(boot_command_line) + 1, 0); | 376 | memblock_virt_alloc(strlen(boot_command_line) + 1, 0); |
| 378 | static_command_line = memblock_virt_alloc(strlen(command_line) + 1, 0); | 377 | static_command_line = memblock_virt_alloc(strlen(command_line) + 1, 0); |
| 379 | strcpy (saved_command_line, boot_command_line); | 378 | strcpy(saved_command_line, boot_command_line); |
| 380 | strcpy (static_command_line, command_line); | 379 | strcpy(static_command_line, command_line); |
| 381 | } | 380 | } |
| 382 | 381 | ||
| 383 | /* | 382 | /* |
| @@ -445,8 +444,8 @@ void __init parse_early_options(char *cmdline) | |||
| 445 | /* Arch code calls this early on, or if not, just before other parsing. */ | 444 | /* Arch code calls this early on, or if not, just before other parsing. */ |
| 446 | void __init parse_early_param(void) | 445 | void __init parse_early_param(void) |
| 447 | { | 446 | { |
| 448 | static __initdata int done = 0; | 447 | static int done __initdata; |
| 449 | static __initdata char tmp_cmdline[COMMAND_LINE_SIZE]; | 448 | static char tmp_cmdline[COMMAND_LINE_SIZE] __initdata; |
| 450 | 449 | ||
| 451 | if (done) | 450 | if (done) |
| 452 | return; | 451 | return; |
| @@ -500,14 +499,15 @@ static void __init mm_init(void) | |||
| 500 | 499 | ||
| 501 | asmlinkage __visible void __init start_kernel(void) | 500 | asmlinkage __visible void __init start_kernel(void) |
| 502 | { | 501 | { |
| 503 | char * command_line, *after_dashes; | 502 | char *command_line; |
| 504 | extern const struct kernel_param __start___param[], __stop___param[]; | 503 | char *after_dashes; |
| 505 | 504 | ||
| 506 | /* | 505 | /* |
| 507 | * Need to run as early as possible, to initialize the | 506 | * Need to run as early as possible, to initialize the |
| 508 | * lockdep hash: | 507 | * lockdep hash: |
| 509 | */ | 508 | */ |
| 510 | lockdep_init(); | 509 | lockdep_init(); |
| 510 | set_task_stack_end_magic(&init_task); | ||
| 511 | smp_setup_processor_id(); | 511 | smp_setup_processor_id(); |
| 512 | debug_objects_early_init(); | 512 | debug_objects_early_init(); |
| 513 | 513 | ||
| @@ -544,7 +544,7 @@ asmlinkage __visible void __init start_kernel(void) | |||
| 544 | static_command_line, __start___param, | 544 | static_command_line, __start___param, |
| 545 | __stop___param - __start___param, | 545 | __stop___param - __start___param, |
| 546 | -1, -1, &unknown_bootoption); | 546 | -1, -1, &unknown_bootoption); |
| 547 | if (after_dashes) | 547 | if (!IS_ERR_OR_NULL(after_dashes)) |
| 548 | parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, | 548 | parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, |
| 549 | set_init_arg); | 549 | set_init_arg); |
| 550 | 550 | ||
| @@ -572,17 +572,18 @@ asmlinkage __visible void __init start_kernel(void) | |||
| 572 | * fragile until we cpu_idle() for the first time. | 572 | * fragile until we cpu_idle() for the first time. |
| 573 | */ | 573 | */ |
| 574 | preempt_disable(); | 574 | preempt_disable(); |
| 575 | if (WARN(!irqs_disabled(), "Interrupts were enabled *very* early, fixing it\n")) | 575 | if (WARN(!irqs_disabled(), |
| 576 | "Interrupts were enabled *very* early, fixing it\n")) | ||
| 576 | local_irq_disable(); | 577 | local_irq_disable(); |
| 577 | idr_init_cache(); | 578 | idr_init_cache(); |
| 578 | rcu_init(); | 579 | rcu_init(); |
| 579 | tick_nohz_init(); | ||
| 580 | context_tracking_init(); | 580 | context_tracking_init(); |
| 581 | radix_tree_init(); | 581 | radix_tree_init(); |
| 582 | /* init some links before init_ISA_irqs() */ | 582 | /* init some links before init_ISA_irqs() */ |
| 583 | early_irq_init(); | 583 | early_irq_init(); |
| 584 | init_IRQ(); | 584 | init_IRQ(); |
| 585 | tick_init(); | 585 | tick_init(); |
| 586 | rcu_init_nohz(); | ||
| 586 | init_timers(); | 587 | init_timers(); |
| 587 | hrtimers_init(); | 588 | hrtimers_init(); |
| 588 | softirq_init(); | 589 | softirq_init(); |
| @@ -842,7 +843,6 @@ static char *initcall_level_names[] __initdata = { | |||
| 842 | 843 | ||
| 843 | static void __init do_initcall_level(int level) | 844 | static void __init do_initcall_level(int level) |
| 844 | { | 845 | { |
| 845 | extern const struct kernel_param __start___param[], __stop___param[]; | ||
| 846 | initcall_t *fn; | 846 | initcall_t *fn; |
| 847 | 847 | ||
| 848 | strcpy(initcall_command_line, saved_command_line); | 848 | strcpy(initcall_command_line, saved_command_line); |
