tracing: Last minute fixes before pushing to Linus
Subsystems (3)
Steven Rostedt
maintainercover tracing: Last minute fixes before pushing to Linus
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next
Head SHA1: f6a694665f132cbf6e2222dd2f173dc35330a8aa
Arnd Bergmann (1):
seq_buf: Avoid type mismatch for seq_buf_init
Lukas Bulwahn (2):
ring-buffer: Remove obsolete rb_event_is_commit()
tracing: Drop unneeded assignment in ring_buffer_resize()
Masami Hiramatsu (1):
tracing: Disable ftrace selftests when any tracer is running
Qiujun Huang (3):
ring-buffer: Fix a typo in function description
ring-buffer: Fix two typos in comments
ring-buffer: Add rb_check_bpage in __rb_allocate_pages
Steven Rostedt (VMware) (2):
Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS"
tracing: Offload eval map updates to a work queue
----
arch/Kconfig | 16 ++++++++++++ include/linux/seq_buf.h | 2 +- include/linux/trace_seq.h | 4 +-- kernel/trace/ring_buffer.c | 61 +++++++++++++++++++------------------------ kernel/trace/trace.c | 51 +++++++++++++++++++++++++++++++----- kernel/trace/trace.h | 5 ++++ kernel/trace/trace_boot.c | 2 ++ kernel/trace/trace_events.c | 2 +- kernel/trace/trace_kprobe.c | 9 +++---- kernel/trace/trace_selftest.c | 2 +- 10 files changed, 102 insertions(+), 52 deletions(-)
Steven Rostedt
maintainerPATCH 1/9 ring-buffer: Remove obsolete rb_event_is_commit()
From: Lukas Bulwahn <[email protected]>
Commit a389d86f7fd0 ("ring-buffer: Have nested events still record running time stamp") removed the only uses of rb_event_is_commit() in rb_update_event() and rb_update_write_stamp().
Hence, since then, make CC=clang W=1 warns:
kernel/trace/ring_buffer.c:2763:1:
warning: unused function 'rb_event_is_commit' [-Wunused-function]
Remove this obsolete function.
--- kernel/trace/ring_buffer.c | 17 ----------------- 1 file changed, 17 deletions(-)
kernel/trace/ring_buffer.c +0 -17
@@ -2629,9 +2629,6 @@ rb_add_time_stamp(struct ring_buffer_event *event, u64 delta, bool abs)return skip_time_extend (event); } -static inline bool rb_event_is_commit (struct ring_buffer_per_cpu *cpu_buffer, -struct ring_buffer_event *event); -#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK static inline bool sched_clock_stable (void ) {
@@ -2759,20 +2756,6 @@ static unsigned rb_calculate_event_length(unsigned length)return length; } -static __always_inline bool -rb_event_is_commit (struct ring_buffer_per_cpu *cpu_buffer, -struct ring_buffer_event *event) -{ -unsigned long addr = (unsigned long )event; -unsigned long index; - - index =rb_event_index (event); - addr &=PAGE_MASK ; - -return cpu_buffer->commit_page->page == (void *)addr && -rb_commit_index (cpu_buffer) == index; -} -static u64 rb_time_delta (struct ring_buffer_event *event) {switch (event->type_len) {
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 2/9 ring-buffer: Fix a typo in function description
In reply to Steven RostedtFrom: Qiujun Huang <[email protected]>
s/ring_buffer_commit_discard/ring_buffer_discard_commit/
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
@@ -3645,7 +3645,7 @@ rb_decrement_entry(struct ring_buffer_per_cpu *cpu_buffer, }/** -* ring_buffer_commit_discard - discard an event that has not been committed +* ring_buffer_discard_commit - discard an event that has not been committed * @buffer: the ring buffer * @event: non committed event to discard *
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 3/9 seq_buf: Avoid type mismatch for seq_buf_init
In reply to Steven RostedtFrom: Arnd Bergmann <[email protected]>
Building with W=2 prints a number of warnings for one function that has a pointer type mismatch:
linux/seq_buf.h: In function 'seq_buf_init':linux/seq_buf.h:35:12: warning: pointer targets in assignment from 'unsigned char *' to 'char *' differ in signedness [-Wpointer-sign]
Change the type in the function prototype according to the type in the structure.
--- include/linux/seq_buf.h | 2 +- include/linux/trace_seq.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/linux/seq_buf.h +1 -1
@@ -30,7 +30,7 @@ static inline void seq_buf_clear(struct seq_buf *s) }static inline void -seq_buf_init (struct seq_buf *s,unsigned char *buf,unsigned int size) +seq_buf_init (struct seq_buf *s,char *buf,unsigned int size) { s->buffer = buf; s->size = size;
include/linux/trace_seq.h +2 -2
@@ -12,7 +12,7 @@*/ struct trace_seq { -unsigned char buffer[PAGE_SIZE ]; +char buffer[PAGE_SIZE ];struct seq_buf seq;int full; };
@@ -51,7 +51,7 @@ static inline int trace_seq_used(struct trace_seq *s)* that is about to be written to and then return the result * of that write. */ -static inline unsigned char * +static inline char *trace_seq_buffer_ptr (struct trace_seq *s) {return s->buffer +seq_buf_used (&s->seq);
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 4/9 tracing: Disable ftrace selftests when any tracer is running
In reply to Steven RostedtFrom: Masami Hiramatsu <[email protected]>
Disable ftrace selftests when any tracer (kernel command line options like ftrace=, trace_events=, kprobe_events=, and boot-time tracing) starts running because selftest can disturb it.
Currently ftrace= and trace_events= are checked, but kprobe_events has a different flag, and boot-time tracing didn't checked. This unifies the disabled flag and all of those boot-time tracing features sets the flag.
This also fixes warnings on kprobe-event selftest (CONFIG_FTRACE_STARTUP_TEST=y and CONFIG_KPROBE_EVENTS=y) with boot-time tracing (ftrace.event.kprobes.EVENT.probes) like below;
[ 59.803496] trace_kprobe: Testing kprobe tracing: [ 59.804258] ------------[ cut here ]------------ [ 59.805682] WARNING: CPU: 3 PID: 1 at kernel/trace/trace_kprobe.c:1987 kprobe_trace_self_tests_ib [ 59.806944] Modules linked in: [ 59.807335] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc7+ #172 [ 59.808029] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/204 [ 59.808999] RIP: 0010:kprobe_trace_self_tests_init+0x5f/0x42b [ 59.809696] Code: e8 03 00 00 48 c7 c7 30 8e 07 82 e8 6d 3c 46 ff 48 c7 c6 00 b2 1a 81 48 c7 c7 7 [ 59.812439] RSP: 0018:ffffc90000013e78 EFLAGS: 00010282 [ 59.813038] RAX: 00000000ffffffef RBX: 0000000000000000 RCX: 0000000000049443 [ 59.813780] RDX: 0000000000049403 RSI: 0000000000049403 RDI: 000000000002deb0 [ 59.814589] RBP: ffffc90000013e90 R08: 0000000000000001 R09: 0000000000000001 [ 59.815349] R10: 0000000000000001 R11: 0000000000000000 R12: 00000000ffffffef [ 59.816138] R13: ffff888004613d80 R14: ffffffff82696940 R15: ffff888004429138 [ 59.816877] FS: 0000000000000000(0000) GS:ffff88807dcc0000(0000) knlGS:0000000000000000 [ 59.817772] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 59.818395] CR2: 0000000001a8dd38 CR3: 0000000002222000 CR4: 00000000000006a0 [ 59.819144] Call Trace: [ 59.819469] ? init_kprobe_trace+0x6b/0x6b [ 59.819948] do_one_initcall+0x5f/0x300 [ 59.820392] ? rcu_read_lock_sched_held+0x4f/0x80 [ 59.820916] kernel_init_freeable+0x22a/0x271 [ 59.821416] ? rest_init+0x241/0x241 [ 59.821841] kernel_init+0xe/0x10f [ 59.822251] ret_from_fork+0x22/0x30 [ 59.822683] irq event stamp: 16403349 [ 59.823121] hardirqs last enabled at (16403359): [<ffffffff810db81e>] console_unlock+0x48e/0x580 [ 59.824074] hardirqs last disabled at (16403368): [<ffffffff810db786>] console_unlock+0x3f6/0x580 [ 59.825036] softirqs last enabled at (16403200): [<ffffffff81c0033a>] __do_softirq+0x33a/0x484 [ 59.825982] softirqs last disabled at (16403087): [<ffffffff81a00f02>] asm_call_irq_on_stack+0x10 [ 59.827034] ---[ end trace 200c544775cdfeb3 ]--- [ 59.827635] trace_kprobe: error on probing function entry.
--- kernel/trace/trace.c | 19 +++++++++++++------ kernel/trace/trace.h | 5 +++++ kernel/trace/trace_boot.c | 2 ++ kernel/trace/trace_events.c | 2 +- kernel/trace/trace_kprobe.c | 9 +++------ kernel/trace/trace_selftest.c | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-)
kernel/trace/trace.c +13 -6
@@ -68,10 +68,21 @@ bool ring_buffer_expanded;static bool __read_mostly tracing_selftest_running;/* -* If a tracer is running, we do not want to run SELFTEST. +* If boot-time tracing including tracers/events via kernel cmdline +* is running, we do not want to run SELFTEST. */ bool __read_mostly tracing_selftest_disabled; +#ifdef CONFIG_FTRACE_STARTUP_TEST +void __init disable_tracing_selftest (const char *reason) +{ +if (!tracing_selftest_disabled) { + tracing_selftest_disabled = true; +pr_info ("Ftrace startup test is disabled due to %s\n" , reason); + } +} +#endif +/* Pipe tracepoints to printk */ struct trace_iterator *tracepoint_print_iter;int tracepoint_printk;
@@ -2112,11 +2123,7 @@ int __init register_tracer(struct tracer *type)apply_trace_boot_options ();/* disable other selftests, since this will break it. */ - tracing_selftest_disabled = true; -#ifdef CONFIG_FTRACE_STARTUP_TEST -printk (KERN_INFO "Disabling FTRACE selftests due to running tracer '%s'\n" , - type->name); -#endif +disable_tracing_selftest ("running a tracer" ); out_unlock:return ret;
kernel/trace/trace.h +5 -0
@@ -719,6 +719,8 @@ extern bool ring_buffer_expanded;extern bool tracing_selftest_disabled;#ifdef CONFIG_FTRACE_STARTUP_TEST +extern void __init disable_tracing_selftest (const char *reason); +extern int trace_selftest_startup_function (struct tracer *trace,struct trace_array *tr); extern int trace_selftest_startup_function_graph(struct tracer *trace,
@@ -742,6 +744,9 @@ extern int trace_selftest_startup_branch(struct tracer *trace,*/ #define __tracer_data __refdata#else +static inline void __init disable_tracing_selftest (const char *reason) +{ +}/* Tracers are seldom changed. Optimize when selftests are disabled. */ #define __tracer_data __read_mostly#endif /* CONFIG_FTRACE_STARTUP_TEST */
kernel/trace/trace_boot.c +2 -0
@@ -344,6 +344,8 @@ static int __init trace_boot_init(void)trace_boot_init_one_instance (tr, trace_node);trace_boot_init_instances (trace_node); +disable_tracing_selftest ("running boot-time tracing" ); +return 0 ; }/*
kernel/trace/trace_events.c +1 -1
@@ -3201,7 +3201,7 @@ static __init int setup_trace_event(char *str) {strlcpy (bootup_event_buf, str,COMMAND_LINE_SIZE ); ring_buffer_expanded = true; - tracing_selftest_disabled = true; +disable_tracing_selftest ("running event tracing" );return 1 ; }
kernel/trace/trace_kprobe.c +3 -6
@@ -25,11 +25,12 @@/* Kprobe early definition from command line */ static char kprobe_boot_events_buf[COMMAND_LINE_SIZE ]__initdata ; -static bool kprobe_boot_events_enabled__initdata ;static int __init set_kprobe_boot_events (char *str) {strlcpy (kprobe_boot_events_buf, str,COMMAND_LINE_SIZE ); +disable_tracing_selftest ("running kprobe events" ); +return 0 ; }__setup ("kprobe_event=" , set_kprobe_boot_events);
@@ -1887,8 +1888,6 @@ static __init void setup_boot_kprobe_events(void) ret =trace_run_command (cmd, create_or_delete_trace_kprobe);if (ret)pr_warn ("Failed to add event(%d): %s\n" , ret, cmd); -else - kprobe_boot_events_enabled = true; cmd = p; }
@@ -1973,10 +1972,8 @@ static __init int kprobe_trace_self_tests_init(void)if (tracing_is_disabled ())return -ENODEV ; -if (kprobe_boot_events_enabled) { -pr_info ("Skipping kprobe tests due to kprobe_event on cmdline\n" ); +if (tracing_selftest_disabled)return 0 ; - } target = kprobe_trace_selftest_target;
kernel/trace/trace_selftest.c +1 -1
@@ -786,7 +786,7 @@ trace_selftest_startup_function_graph(struct tracer *trace,/* Have we just recovered from a hang? */ if (graph_hang_thresh >GRAPH_MAX_FUNC_TEST ) { - tracing_selftest_disabled = true; +disable_tracing_selftest ("recovering from a hang" ); ret =-1 ; goto out; }
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 5/9 tracing: Drop unneeded assignment in ring_buffer_resize()
In reply to Steven RostedtFrom: Lukas Bulwahn <[email protected]>
Since commit 0a1754b2a97e ("ring-buffer: Return 0 on success from ring_buffer_resize()"), computing the size is not needed anymore.
Drop unneeded assignment in ring_buffer_resize().
--- kernel/trace/ring_buffer.c | 2 -- 1 file changed, 2 deletions(-)
kernel/trace/ring_buffer.c +0 -2
@@ -1974,8 +1974,6 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,if (nr_pages <2 ) nr_pages =2 ; - size = nr_pages *BUF_PAGE_SIZE ; -/* prevent another thread from changing buffer sizes */ mutex_lock (&buffer->mutex);
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 6/9 ring-buffer: Fix two typos in comments
In reply to Steven RostedtFrom: Qiujun Huang <[email protected]>
s/inerrupting/interrupting/
s/beween/between/
--- kernel/trace/ring_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer.c +2 -2
@@ -3399,7 +3399,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,/* This did not interrupt any time update */ info->delta = info->ts - info->after; else -/* Just use full timestamp for inerrupting event */ +/* Just use full timestamp for interrupting event */ info->delta = info->ts;barrier ();check_buffer (cpu_buffer, info, tail);
@@ -3436,7 +3436,7 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, info->ts = ts; }else {/* -* Interrupted beween C and E: +* Interrupted between C and E: * Lost the previous events time stamp. Just set the * delta to zero, and this will be the same time as * the event this event interrupted. And the events that
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 7/9 ring-buffer: Add rb_check_bpage in __rb_allocate_pages
In reply to Steven RostedtFrom: Qiujun Huang <[email protected]>
It may be better to check each page is aligned by 4 bytes. The 2 least significant bits of the address will be used as flags.
--- kernel/trace/ring_buffer.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
kernel/trace/ring_buffer.c +11 -8
@@ -1423,7 +1423,8 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer)return 0 ; } -static int __rb_allocate_pages (long nr_pages,struct list_head *pages,int cpu) +static int __rb_allocate_pages (struct ring_buffer_per_cpu *cpu_buffer, +long nr_pages,struct list_head *pages) {struct buffer_page *bpage, *tmp;bool user_thread = current->mm !=NULL ;
@@ -1463,13 +1464,15 @@ static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)struct page *page; bpage =kzalloc_node (ALIGN (sizeof (*bpage),cache_line_size ()), - mflags,cpu_to_node (cpu)); + mflags,cpu_to_node (cpu_buffer->cpu));if (!bpage) goto free_pages; +rb_check_bpage (cpu_buffer, bpage); +list_add (&bpage->list, pages); - page =alloc_pages_node (cpu_to_node (cpu), mflags,0 ); + page =alloc_pages_node (cpu_to_node (cpu_buffer->cpu), mflags,0 );if (!page) goto free_pages; bpage->page =page_address (page);
@@ -1501,7 +1504,7 @@ static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,WARN_ON (!nr_pages); -if (__rb_allocate_pages (nr_pages, &pages, cpu_buffer->cpu)) +if (__rb_allocate_pages (cpu_buffer, nr_pages, &pages))return -ENOMEM ;/*
@@ -2008,8 +2011,8 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,* allocated without receiving ENOMEM */ INIT_LIST_HEAD (&cpu_buffer->new_pages); -if (__rb_allocate_pages (cpu_buffer->nr_pages_to_update, - &cpu_buffer->new_pages, cpu)) { +if (__rb_allocate_pages (cpu_buffer, cpu_buffer->nr_pages_to_update, + &cpu_buffer->new_pages)) {/* not enough memory for new pages */ err = -ENOMEM ; goto out_err;
@@ -2074,8 +2077,8 @@ int ring_buffer_resize(struct trace_buffer *buffer, unsigned long size,INIT_LIST_HEAD (&cpu_buffer->new_pages);if (cpu_buffer->nr_pages_to_update >0 && -__rb_allocate_pages (cpu_buffer->nr_pages_to_update, - &cpu_buffer->new_pages, cpu_id)) { +__rb_allocate_pages (cpu_buffer, cpu_buffer->nr_pages_to_update, + &cpu_buffer->new_pages)) { err = -ENOMEM ; goto out_err; }
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 8/9 Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS"
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
It was believed that metag was the only architecture that required the ring buffer to keep 8 byte words aligned on 8 byte architectures, and with its removal, it was assumed that the ring buffer code did not need to handle this case. It appears that sparc64 also requires this.
The following was reported on a sparc64 boot up:
kernel: futex hash table entries: 65536 (order: 9, 4194304 bytes, linear)
kernel: Running postponed tracer tests:
kernel: Testing tracer function:
kernel: Kernel unaligned access at TPC[552a20] trace_function+0x40/0x140
kernel: Kernel unaligned access at TPC[552a24] trace_function+0x44/0x140
kernel: Kernel unaligned access at TPC[552a20] trace_function+0x40/0x140
kernel: Kernel unaligned access at TPC[552a24] trace_function+0x44/0x140
kernel: Kernel unaligned access at TPC[552a20] trace_function+0x40/0x140
kernel: PASSED
Need to put back the 64BIT aligned code for the ring buffer.
--- arch/Kconfig | 16 ++++++++++++++++ kernel/trace/ring_buffer.c | 17 +++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-)
arch/Kconfig +16 -0
@@ -143,6 +143,22 @@ config UPROBES managed by the kernel and kept transparent to the probed application. ) +config HAVE_64BIT_ALIGNED_ACCESS + def_bool 64BIT && !HAVE_EFFICIENT_UNALIGNED_ACCESS + help + Some architectures require 64 bit accesses to be 64 bit + aligned, which also requires structs containing 64 bit values + to be 64 bit aligned too. This includes some 32 bit + architectures which can do 64 bit accesses, as well as 64 bit + architectures without unaligned access. + + This symbol should be selected by an architecture if 64 bit + accesses are required to be 64 bit aligned in this way even + though it is not a 64 bit architecture. + + See Documentation/unaligned-memory-access.txt for more + information on the topic of unaligned memory accesses. + config HAVE_EFFICIENT_UNALIGNED_ACCESS bool help
kernel/trace/ring_buffer.c +13 -4
@@ -130,7 +130,16 @@ int ring_buffer_print_entry_header(struct trace_seq *s)#define RB_ALIGNMENT 4U#define RB_MAX_SMALL_DATA (RB_ALIGNMENT * RINGBUF_TYPE_DATA_TYPE_LEN_MAX)#define RB_EVNT_MIN_SIZE 8U/* two 32bit words */ -#define RB_ALIGN_DATA __aligned(RB_ALIGNMENT) + +#ifndef CONFIG_HAVE_64BIT_ALIGNED_ACCESS +# define RB_FORCE_8BYTE_ALIGNMENT 0 +# define RB_ARCH_ALIGNMENT RB_ALIGNMENT +#else +# define RB_FORCE_8BYTE_ALIGNMENT 1 +# define RB_ARCH_ALIGNMENT 8U +#endif + +#define RB_ALIGN_DATA __aligned(RB_ARCH_ALIGNMENT)/* define RINGBUF_TYPE_DATA for 'case RINGBUF_TYPE_DATA:' */ #define RINGBUF_TYPE_DATA 0 ... RINGBUF_TYPE_DATA_TYPE_LEN_MAX
@@ -2718,7 +2727,7 @@ rb_update_event(struct ring_buffer_per_cpu *cpu_buffer, event->time_delta = delta; length -=RB_EVNT_HDR_SIZE ; -if (length >RB_MAX_SMALL_DATA ) { +if (length >RB_MAX_SMALL_DATA ||RB_FORCE_8BYTE_ALIGNMENT ) { event->type_len =0 ; event->array[0 ] = length; }else
@@ -2733,11 +2742,11 @@ static unsigned rb_calculate_event_length(unsigned length)if (!length) length++; -if (length >RB_MAX_SMALL_DATA ) +if (length >RB_MAX_SMALL_DATA ||RB_FORCE_8BYTE_ALIGNMENT ) length +=sizeof (event.array[0 ]); length +=RB_EVNT_HDR_SIZE ; - length =ALIGN (length,RB_ALIGNMENT ); + length =ALIGN (length,RB_ARCH_ALIGNMENT );/* * In case the time delta is larger than the 27 bits for it
Signature · 1 line
2.29.2
Steven Rostedt
maintainerPATCH 9/9 tracing: Offload eval map updates to a work queue
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
In order for tracepoints to export their enums to user space, the use of the TRACE_DEFINE_ENUM() macro is used. On boot up, the strings shown in the tracefs "print fmt" lines are processed, and all the enums registered by TRACE_DEFINE_ENUM are replaced with the interger value. This way, userspace tools that read the raw binary data, knows how to evaluate the raw events.
This is currently done in an initcall, but it has been noticed that slow embedded boards that have tracing may take a few seconds to process them all, and a few seconds slow down on an embedded device is detrimental to the system.
Instead, offload the work to a work queue and make sure that its finished by destroying the work queue (which flushes all work) in a late initcall. This will allow the system to continue to boot and run the updates in the background, and this speeds up the boot time. Note, the strings being updated are only used by user space, so finishing the process before the system is fully booted will prevent any race issues.
--- kernel/trace/trace.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
kernel/trace/trace.c +31 -1
@@ -9066,7 +9066,10 @@ int tracing_init_dentry(void)extern struct trace_eval_map *__start_ftrace_eval_maps[];extern struct trace_eval_map *__stop_ftrace_eval_maps[]; -static void __init trace_eval_init (void ) +static struct workqueue_struct *eval_map_wq__initdata ; +static struct work_struct eval_map_work__initdata ; + +static void __init eval_map_work_func (struct work_struct *work) {int len;
@@ -9074,6 +9077,33 @@ static void __init trace_eval_init(void)trace_insert_eval_map (NULL , __start_ftrace_eval_maps, len); } +static int __init trace_eval_init (void ) +{ +INIT_WORK (&eval_map_work, eval_map_work_func); + + eval_map_wq =alloc_workqueue ("eval_map_wq" ,WQ_UNBOUND ,0 ); +if (!eval_map_wq) { +pr_err ("Unable to allocate eval_map_wq\n" ); +/* Do work here */ +eval_map_work_func (&eval_map_work); +return -ENOMEM ; + } + +queue_work (eval_map_wq, &eval_map_work); +return 0 ; +} + +static int __init trace_eval_sync (void ) +{ +/* Make sure the eval map updates are finished */ +if (eval_map_wq) +destroy_workqueue (eval_map_wq); +return 0 ; +} + +late_initcall_sync (trace_eval_sync); + +#ifdef CONFIG_MODULES static void trace_module_add_evals (struct module *mod) {
Signature · 1 line
2.29.2