dma-buf: DMABUF_SYSFS_STATS should depend on DMA_SHARED_BUFFER
[linux-2.6-microblaze.git] / init / main.c
index e9c42a1..f5b8246 100644 (file)
 #include <linux/profile.h>
 #include <linux/kfence.h>
 #include <linux/rcupdate.h>
+#include <linux/srcu.h>
 #include <linux/moduleparam.h>
 #include <linux/kallsyms.h>
+#include <linux/buildid.h>
 #include <linux/writeback.h>
 #include <linux/cpu.h>
 #include <linux/cpuset.h>
@@ -386,16 +388,6 @@ static char * __init xbc_make_cmdline(const char *key)
        return new_cmdline;
 }
 
-static u32 boot_config_checksum(unsigned char *p, u32 size)
-{
-       u32 ret = 0;
-
-       while (size--)
-               ret += *p++;
-
-       return ret;
-}
-
 static int __init bootconfig_params(char *param, char *val,
                                    const char *unused, void *arg)
 {
@@ -439,7 +431,7 @@ static void __init setup_boot_config(void)
                return;
        }
 
-       if (boot_config_checksum((unsigned char *)data, size) != csum) {
+       if (xbc_calc_checksum(data, size) != csum) {
                pr_err("bootconfig checksum failed\n");
                return;
        }
@@ -692,6 +684,7 @@ noinline void __ref rest_init(void)
         */
        rcu_read_lock();
        tsk = find_task_by_pid_ns(pid, &init_pid_ns);
+       tsk->flags |= PF_NO_SETAFFINITY;
        set_cpus_allowed_ptr(tsk, cpumask_of(smp_processor_id()));
        rcu_read_unlock();
 
@@ -872,6 +865,47 @@ void __init __weak arch_call_rest_init(void)
        rest_init();
 }
 
+static void __init print_unknown_bootoptions(void)
+{
+       char *unknown_options;
+       char *end;
+       const char *const *p;
+       size_t len;
+
+       if (panic_later || (!argv_init[1] && !envp_init[2]))
+               return;
+
+       /*
+        * Determine how many options we have to print out, plus a space
+        * before each
+        */
+       len = 1; /* null terminator */
+       for (p = &argv_init[1]; *p; p++) {
+               len++;
+               len += strlen(*p);
+       }
+       for (p = &envp_init[2]; *p; p++) {
+               len++;
+               len += strlen(*p);
+       }
+
+       unknown_options = memblock_alloc(len, SMP_CACHE_BYTES);
+       if (!unknown_options) {
+               pr_err("%s: Failed to allocate %zu bytes\n",
+                       __func__, len);
+               return;
+       }
+       end = unknown_options;
+
+       for (p = &argv_init[1]; *p; p++)
+               end += sprintf(end, " %s", *p);
+       for (p = &envp_init[2]; *p; p++)
+               end += sprintf(end, " %s", *p);
+
+       pr_notice("Unknown command line parameters:%s\n", unknown_options);
+       memblock_free(__pa(unknown_options), len);
+}
+
 asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
 {
        char *command_line;
@@ -880,6 +914,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
        set_task_stack_end_magic(&init_task);
        smp_setup_processor_id();
        debug_objects_early_init();
+       init_vmlinux_build_id();
 
        cgroup_init_early();
 
@@ -913,6 +948,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
                                  static_command_line, __start___param,
                                  __stop___param - __start___param,
                                  -1, -1, NULL, &unknown_bootoption);
+       print_unknown_bootoptions();
        if (!IS_ERR_OR_NULL(after_dashes))
                parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
                           NULL, set_init_arg);
@@ -941,11 +977,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
         * time - but meanwhile we still have a functioning scheduler.
         */
        sched_init();
-       /*
-        * Disable preemption - early bootup scheduling is extremely
-        * fragile until we cpu_idle() for the first time.
-        */
-       preempt_disable();
+
        if (WARN(!irqs_disabled(),
                 "Interrupts were enabled *very* early, fixing it\n"))
                local_irq_disable();
@@ -979,6 +1011,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
        tick_init();
        rcu_init_nohz();
        init_timers();
+       srcu_init();
        hrtimers_init();
        softirq_init();
        timekeeping_init();
@@ -1444,6 +1477,11 @@ static int __ref kernel_init(void *unused)
 {
        int ret;
 
+       /*
+        * Wait until kthreadd is all set-up.
+        */
+       wait_for_completion(&kthreadd_done);
+
        kernel_init_freeable();
        /* need to finish all async __init code before freeing the memory */
        async_synchronize_full();
@@ -1524,11 +1562,6 @@ void __init console_on_rootfs(void)
 
 static noinline void __init kernel_init_freeable(void)
 {
-       /*
-        * Wait until kthreadd is all set-up.
-        */
-       wait_for_completion(&kthreadd_done);
-
        /* Now the scheduler is fully set up and can do blocking allocations */
        gfp_allowed_mask = __GFP_BITS_MASK;