Steven Rostedt <rost...@goodmis.org> a écrit :


        ring_buffer_set_clock(tr->trace_buffer.buffer,
                                early_trace_clock);

Then have:

static u64 early_timestamp __initdata;

static __init u64 early_trace_clock(void)
{
        return early_timestamp;
}

Then we can have:

+       preempt_disable_notrace();
+       for (i = 0; i < vearly_entries_count; i++) {
+               entry = &ftrace_vearly_entries[i];
+
+#ifdef CONFIG_X86_TSC
+               ns = cycles_to_ns(entry->clock, cpu_khz);
+#else
+               ns = entry->clock;
+#endif

                early_timestamp = ns;

+               trace_function(tr, entry->ip, entry->parent_ip, 0, 0);

And it will fill the entries properly, and you don't need to worry
about delta's or anything.

+       }
+       preempt_enable_notrace();

        /* Set the default clock back */
        ring_buffer_set_clock(tr->trace_buffer.buffer,
                        trace_local_clock);


Thanks, this solution looks very clean.

+static struct ftrace_vearly_obs_param ftrace_vearly_params[] __initdata = {
+       { .str = "ftrace_vearly", .setup_func = set_ftrace_vearly_enable },
+#ifdef CONFIG_DYNAMIC_FTRACE
+       {
+               .str = "ftrace_notrace",
+               .data = &ftrace_data_notrace,
+               .setup_func = set_ftrace_vearly_filtering,
+       },
+       {
+               .str = "ftrace_filter",
+               .data = &ftrace_data_filter,
+               .setup_func = set_ftrace_vearly_filtering,
+       },
+#endif

Hmm, wouldn't this actually still be able to work even if
DYNAMIC_FTRACE was not set?

Yes your right, it should work without DYNAMIC_FTRACE. But I just notice that
FTRACE_MCOUNT_RECORD depends on DYNAMIC_FTRACE.

kernel/trace/Kconfig:
...
config FTRACE_MCOUNT_RECORD
        def_bool y
        depends on DYNAMIC_FTRACE
        depends on HAVE_FTRACE_MCOUNT_RECORD

include/asm-generic/vmlinux.lds.h:
...
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
#define MCOUNT_REC()    . = ALIGN(8);                           \
                        VMLINUX_SYMBOL(__start_mcount_loc) = .; \
                        *(__mcount_loc)                         \
                        VMLINUX_SYMBOL(__stop_mcount_loc) = .;
#else
#define MCOUNT_REC()

#endif



Reply via email to