[PATCH 1/3] tracing: Export eval_map_wq for asynchronous use by other modules

Yaxiong Tian posted 3 patches 2 weeks, 5 days ago
There is a newer version of this series
[PATCH 1/3] tracing: Export eval_map_wq for asynchronous use by other modules
Posted by Yaxiong Tian 2 weeks, 5 days ago
The eval_map_work_func() function, though queued in eval_map_wq,
holds the trace_event_sem read-write lock for a long time during
kernel boot. This causes blocking issues for other functions.

Making eval_map_wq extern allows other modules to schedule their
work asynchronously on this queue,  preventing it from blocking
the main boot thread.

Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
---
 kernel/trace/trace.c | 2 +-
 kernel/trace/trace.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index e18005807395..cb073d0c86a6 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -10774,7 +10774,7 @@ int tracing_init_dentry(void)
 extern struct trace_eval_map *__start_ftrace_eval_maps[];
 extern struct trace_eval_map *__stop_ftrace_eval_maps[];
 
-static struct workqueue_struct *eval_map_wq __initdata;
+struct workqueue_struct *eval_map_wq __initdata;
 static struct work_struct eval_map_work __initdata;
 static struct work_struct tracerfs_init_work __initdata;
 
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index de4e6713b84e..44aaabc46a7a 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -770,6 +770,8 @@ extern unsigned long nsecs_to_usecs(unsigned long nsecs);
 
 extern unsigned long tracing_thresh;
 
+extern struct workqueue_struct *eval_map_wq __initdata;
+
 /* PID filtering */
 
 bool trace_find_filtered_pid(struct trace_pid_list *filtered_pids,
-- 
2.25.1
Re: [PATCH 1/3] tracing: Export eval_map_wq for asynchronous use by other modules
Posted by Steven Rostedt 2 weeks, 3 days ago
On Thu, 22 Jan 2026 11:24:15 +0800
Yaxiong Tian <tianyaxiong@kylinos.cn> wrote:

> The eval_map_work_func() function, though queued in eval_map_wq,
> holds the trace_event_sem read-write lock for a long time during
> kernel boot. This causes blocking issues for other functions.
> 
> Making eval_map_wq extern allows other modules to schedule their
> work asynchronously on this queue,  preventing it from blocking
> the main boot thread.

If you are going to make this wq generic for other parts of the tracing
code, then let's rename it. As "eval_map" is specific to the enum mappings
being updated (which I hope someday I can get that update working at build
time. And when I do, the name will be totally meaningless).

Let's rename it to "trace_init_wq" instead.

-- Steve
Re: [PATCH 1/3] tracing: Export eval_map_wq for asynchronous use by other modules
Posted by Yaxiong Tian 2 weeks, 1 day ago
在 2026/1/24 04:32, Steven Rostedt 写道:
> On Thu, 22 Jan 2026 11:24:15 +0800
> Yaxiong Tian <tianyaxiong@kylinos.cn> wrote:
>
>> The eval_map_work_func() function, though queued in eval_map_wq,
>> holds the trace_event_sem read-write lock for a long time during
>> kernel boot. This causes blocking issues for other functions.
>>
>> Making eval_map_wq extern allows other modules to schedule their
>> work asynchronously on this queue,  preventing it from blocking
>> the main boot thread.
> If you are going to make this wq generic for other parts of the tracing
> code, then let's rename it. As "eval_map" is specific to the enum mappings
> being updated (which I hope someday I can get that update working at build
> time. And when I do, the name will be totally meaningless).
>
> Let's rename it to "trace_init_wq" instead.
>
> -- Steve

Thank you for your suggestion. I have renamed it to trace_init_wq and 
released the V2 version.