mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/2] tracing: make tracer_init_tracefs initcall asynchronous
@ 2022-04-26 12:24 Mark-PK Tsai
  2022-04-26 12:24 ` [PATCH v4 1/2] tracing: Avoid adding tracer option before update_tracer_options Mark-PK Tsai
  2022-04-26 12:24 ` [PATCH v4 2/2] tracing: make tracer_init_tracefs initcall asynchronous Mark-PK Tsai
  0 siblings, 2 replies; 3+ messages in thread
From: Mark-PK Tsai @ 2022-04-26 12:24 UTC (permalink / raw)
  To: rostedt
  Cc: linux-arm-kernel, linux-kernel, linux-mediatek, mark-pk.tsai,
	matthias.bgg, mingo, yj.chiang

Move trace_eval_init() to subsys_initcall to make it start
earlier.
And to avoid tracer_init_tracefs being blocked by
trace_event_sem which trace_eval_init() hold [1],
queue tracer_init_tracefs() to eval_map_wq to let
the two works being executed sequentially.

It can speed up the initialization of kernel as result
of making tracer_init_tracefs asynchronous.

On my arm64 platform, it reduce ~20ms of 125ms which total
time do_initcalls spend.

Changes in v2:
- Fix the use of ftrace_eval_maps in INIT_DATA after initmem_free().

  In v1, a kthread is create for tracer_init_tracefs() which
  might cause kernel crash if initmem is free before it finish.
  In v2, the work of tracer_init_tracefs() is separated into 2 parts,
  one is put to subsys_initcall and the other is queue to eval_map_wq
  which can make sure it always finish before initmem is free.

Changes in v3:
- Avoid adding tracer option before __update_tracer_options finish to fix
  the warning report by kernel test robot.

Reported-by: kernel test robot <oliver.sang@intel.com>
  https://lore.kernel.org/lkml/20220322133339.GA32582@xsang-OptiPlex-9020/

Changes in v4:
- Set `tracer_options_updated = true` before calling __update_tracer_options().
  Otherwise, __update_tracer_options() will skip all the tracer in trace_array.
- Init tracerfs_init_work only when eval_map_wq is successfully created.

Mark-PK Tsai (2):
  tracing: Avoid adding tracer option before update_tracer_options
  tracing: make tracer_init_tracefs initcall asynchronous

 kernel/trace/trace.c | 39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

-- 
2.18.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-26 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 12:24 [PATCH v4 0/2] tracing: make tracer_init_tracefs initcall asynchronous Mark-PK Tsai
2022-04-26 12:24 ` [PATCH v4 1/2] tracing: Avoid adding tracer option before update_tracer_options Mark-PK Tsai
2022-04-26 12:24 ` [PATCH v4 2/2] tracing: make tracer_init_tracefs initcall asynchronous Mark-PK Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®