]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/trace/trace.c
Merge tag 'trace-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[karo-tx-linux.git] / kernel / trace / trace.c
index 970aafe80b494a6eee976d9f1553f48a3a6348f9..66f829c47bec77c0dbfc1b9d45c92f303e21e5b3 100644 (file)
@@ -1168,6 +1168,7 @@ static struct {
        { trace_clock,                  "perf",         1 },
        { ktime_get_mono_fast_ns,       "mono",         1 },
        { ktime_get_raw_fast_ns,        "mono_raw",     1 },
+       { ktime_get_boot_fast_ns,       "boot",         1 },
        ARCH_TRACE_CLOCKS
 };
 
@@ -7920,10 +7921,21 @@ __init static int tracer_alloc_buffers(void)
 
        raw_spin_lock_init(&global_trace.start_lock);
 
+       /*
+        * The prepare callbacks allocates some memory for the ring buffer. We
+        * don't free the buffer if the if the CPU goes down. If we were to free
+        * the buffer, then the user would lose any trace that was in the
+        * buffer. The memory will be removed once the "instance" is removed.
+        */
+       ret = cpuhp_setup_state_multi(CPUHP_TRACE_RB_PREPARE,
+                                     "trace/RB:preapre", trace_rb_cpu_prepare,
+                                     NULL);
+       if (ret < 0)
+               goto out_free_cpumask;
        /* Used for event triggers */
        temp_buffer = ring_buffer_alloc(PAGE_SIZE, RB_FL_OVERWRITE);
        if (!temp_buffer)
-               goto out_free_cpumask;
+               goto out_rm_hp_state;
 
        if (trace_create_savedcmd() < 0)
                goto out_free_temp_buffer;
@@ -7984,6 +7996,8 @@ out_free_savedcmd:
        free_saved_cmdlines_buffer(savedcmd);
 out_free_temp_buffer:
        ring_buffer_free(temp_buffer);
+out_rm_hp_state:
+       cpuhp_remove_multi_state(CPUHP_TRACE_RB_PREPARE);
 out_free_cpumask:
        free_cpumask_var(global_trace.tracing_cpumask);
 out_free_buffer_mask: