]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - init/main.c
PCI/ASPM: Fix link_state teardown on device removal
[mirror_ubuntu-bionic-kernel.git] / init / main.c
index a8100b9548398e8b102052f2c1418b21ea423825..e42209b89ed56692f61e2ebc5311127b0efbd75c 100644 (file)
@@ -544,8 +544,8 @@ asmlinkage __visible void __init start_kernel(void)
        setup_command_line(command_line);
        setup_nr_cpu_ids();
        setup_per_cpu_areas();
-       boot_cpu_state_init();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
+       boot_cpu_hotplug_init();
 
        build_all_zonelists(NULL);
        page_alloc_init();
@@ -801,16 +801,16 @@ __setup("initcall_blacklist=", initcall_blacklist);
 
 static int __init_or_module do_one_initcall_debug(initcall_t fn)
 {
-       ktime_t calltime, delta, rettime;
+       unsigned long long calltime, delta, rettime;
        unsigned long long duration;
        int ret;
 
        printk(KERN_DEBUG "calling  %pF @ %i\n", fn, task_pid_nr(current));
-       calltime = ktime_get();
+       calltime = local_clock();
        ret = fn();
-       rettime = ktime_get();
-       delta = ktime_sub(rettime, calltime);
-       duration = (unsigned long long) ktime_to_ns(delta) >> 10;
+       rettime = local_clock();
+       delta = rettime - calltime;
+       duration = delta >> 10;
        printk(KERN_DEBUG "initcall %pF returned %d after %lld usecs\n",
                 fn, ret, duration);
 
@@ -980,6 +980,13 @@ __setup("rodata=", set_debug_rodata);
 static void mark_readonly(void)
 {
        if (rodata_enabled) {
+               /*
+                * load_module() results in W+X mappings, which are cleaned up
+                * with call_rcu_sched().  Let's make sure that queued work is
+                * flushed so that we don't hit false positives looking for
+                * insecure pages which are W+X.
+                */
+               rcu_barrier_sched();
                mark_rodata_ro();
                rodata_test();
        } else
@@ -1002,6 +1009,13 @@ static int __ref kernel_init(void *unused)
        ftrace_free_init_mem();
        free_initmem();
        mark_readonly();
+
+       /*
+        * Kernel mappings are now finalized - update the userspace page-table
+        * to finalize PTI.
+        */
+       pti_finalize();
+
        system_state = SYSTEM_RUNNING;
        numa_default_policy();