LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S . Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 0/2] Enable new kprobe event at boot
Date: Wed, 22 May 2019 17:02:46 +0900	[thread overview]
Message-ID: <20190522170246.1746819966139953deed1a03@kernel.org> (raw)
In-Reply-To: <20190522163021.b8d08103dd5df01b2e472e46@kernel.org>

On Wed, 22 May 2019 16:30:21 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> On Wed, 22 May 2019 00:39:32 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
> 
> > > Perhaps we could enable kprobes at early init?
> > 
> > It should be possible, I will try to find what blocks it. I guess after we
> > switch early_text_poke() to text_poke(), we can use kprobes on x86. But
> > for other archs, I need to investigate more.
> 
> OK, I just follow the kernel init related to kprobes
> 
> start_kernel()
>  -> trace_init()
>  -> rcu_init_nohz()
>  -> perf_event_init()
>  -> arch_call_rest_init()
>    -> rest_init()
>      -> rcu_scheduler_starting()
>      -> kernel_thread(kernel_init)
> kernel_init()
>  -> kernel_init_freeable()
>    -> wait_for_completion(&kthreadd_done);
>    -> workqueue_init()
>    -> smp_init()
>    -> do_basic_setup()
>      -> do_initcalls()
>        -> do_initcall_level()
>          (in subsys-level)
>          -> init_kprobes()
> 
> Since optprobe uses workqueue, we can not move it before workqueue_init().
> (but maybe we can disable it in early stage)
> Also, since kprobes depends on rcu, I guess we can not move it before
> rcu_scheduler_starting().

It seems rcu is not initialized yet at this point. It is initialized fully
at core_initcall.

> for kretprobe, we need to get the possible cpus, we need a fix if we move
> it before before smp_init().
> However, there is no reason we need to run it in subsys level. We can
> move init_kprobes() in core or pure level safely.

Also, I missed ftrace (function tracer) is initialized at core_initcall().
So we can move init_kprobes() at postcore_initcall() safely.

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

      reply	other threads:[~2019-05-22  8:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21  7:56 Masami Hiramatsu
2019-05-21  7:56 ` [PATCH 1/2] kprobes: Initialize kprobes at subsys_initcall Masami Hiramatsu
2019-05-21  7:56 ` [PATCH 2/2] tracing/kprobe: Add kprobe_event= boot parameter Masami Hiramatsu
2019-05-21 13:33 ` [PATCH 0/2] Enable new kprobe event at boot Steven Rostedt
2019-05-21 15:39   ` Masami Hiramatsu
2019-05-22  7:30     ` Masami Hiramatsu
2019-05-22  8:02       ` Masami Hiramatsu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522170246.1746819966139953deed1a03@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --subject='Re: [PATCH 0/2] Enable new kprobe event at boot' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).