From: Ingo Molnar <mingo@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: mingo@redhat.com, x86@kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
"H . Peter Anvin" <hpa@zytor.com>,
"Paul E . McKenney" <paulmck@linux.vnet.ibm.com>,
Alexei Starovoitov <ast@kernel.org>,
Alexei Starovoitov <ast@fb.com>
Subject: Re: [PATCH -tip v3 7/7] kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT
Date: Thu, 28 Sep 2017 09:22:20 +0200 [thread overview]
Message-ID: <20170928072220.iv5subwl4u4zcqcp@gmail.com> (raw)
In-Reply-To: <150581537997.32348.14125457458719053753.stgit@devbox>
* Masami Hiramatsu <mhiramat@kernel.org> wrote:
> To enable jump optimized probe with CONFIG_PREEMPT, use
> synchronize_rcu_tasks() to wait for all tasks preempted
> on trampoline code back on track.
This sentence does not parse. It's missing a verb, but I'm not sure.
> Since the jump optimized kprobes can replace multiple
> instructions, there can be tasks which are preempted
> on the 2nd (or 3rd) instructions. If the kprobe
> replaces those instructions by a jump instruction,
> when those tasks back to the preempted place, it is
> a middle of the jump instruction and causes a kernel
> panic.
Again, sentence appears to be missing a verb and also an adjective I think.
> To avoid such tragedies in advance, kprobe optimizer
> prepare a detour route using normal kprobe (e.g.
> int3 breakpoint on x86), and wait for the tasks which
> is interrrupted on such place by synchronize_sched()
> when CONFIG_PREEMPT=n.
s/tragedies/mishaps
Part after the first comma does not parse.
Also the way to refer to kprobes is "kprobes" and "normal kprobes".
Use 'kprobe' only when talking about a specific kprobe instance or such.
You use this correctly later on in the changelog ...
> If CONFIG_PREEMPT=y, things be more complicated, because
s/be/are or s/be/get
> such interrupted thread can be preempted (other thread
> can be scheduled in interrupt handler.) So, kprobes
full stop in the wrong place.
> optimizer has to wait for those tasks scheduled normally.
missing verb.
> In this case we can use synchronize_rcu_tasks() which
> ensures that all preempted tasks back on track and
> schedule it.
More careful changelogs please.
> + * are done. Because optprobe may modify multiple instructions,
> + * there is a chance that the Nth instruction is interrupted. In that
> + * case, running interrupt can return to the Nth byte of jump
> + * instruction. This can be avoided by waiting for returning of
> + * such interrupts, since (until here) the first byte of the optimized
> + * probe is already replaced with normal kprobe (sw breakpoint) and
> + * all threads which reach to the probed address will hit it and
> + * bypass the copied instructions (instead of executing the original.)
> + * With CONFIG_PREEMPT, such interrupts can be preepmted. To wait
> + * for such thread, we will use synchronize_rcu_tasks() which ensures
> + * all preeempted tasks are scheduled normally (not preempted).
> + * So we can ensure there is no threads preempted at probed address.
What? Interrupts cannot be preempted.
Also, "To wait for such threads", or "To wait for such a thread".
Thanks,
Ingo
next prev parent reply other threads:[~2017-09-28 7:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 9:58 [PATCH -tip v3 0/7] kprobes/x86: Preempt related enhancements Masami Hiramatsu
2017-09-19 9:59 ` [PATCH -tip v3 1/7] kprobes: Improve smoke test to check preemptible Masami Hiramatsu
2017-09-28 10:52 ` [tip:perf/core] kprobes: Improve smoke test to check preemptibility tip-bot for Masami Hiramatsu
2017-09-19 9:59 ` [PATCH -tip v3 2/7] kprobes/x86: Move get_kprobe_ctlblk in irq-disabled block Masami Hiramatsu
2017-09-28 10:52 ` [tip:perf/core] kprobes/x86: Move the get_kprobe_ctlblk() into " tip-bot for Masami Hiramatsu
2017-09-19 10:00 ` [PATCH -tip v3 3/7] kprobes: Warn if optprobe handler tries to change execution path Masami Hiramatsu
2017-09-28 10:53 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2017-10-10 17:02 ` [PATCH -tip v3 3/7] " Naveen N. Rao
2017-10-12 5:04 ` Masami Hiramatsu
2017-10-17 8:05 ` Naveen N. Rao
2017-09-19 10:00 ` [PATCH -tip v3 4/7] kprobes/x86: Disable preempt in optprobe Masami Hiramatsu
2017-09-28 10:53 ` [tip:perf/core] kprobes/x86: Disable preemption " tip-bot for Masami Hiramatsu
2017-09-19 10:01 ` [PATCH -tip v3 5/7] kprobes/x86: Disable preempt ftrace-based jprobe Masami Hiramatsu
2017-09-28 10:54 ` [tip:perf/core] kprobes/x86: Disable preemption in ftrace-based jprobes tip-bot for Masami Hiramatsu
2017-09-19 10:02 ` [PATCH -tip v3 6/7] kprobes/x86: Remove disable_irq from ftrace-based/optimized kprobe Masami Hiramatsu
2017-09-28 7:25 ` Ingo Molnar
2017-09-29 6:48 ` Masami Hiramatsu
2017-09-28 10:54 ` [tip:perf/core] kprobes/x86: Remove IRQ disabling from ftrace-based/optimized kprobes tip-bot for Masami Hiramatsu
2017-09-19 10:03 ` [PATCH -tip v3 7/7] kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT Masami Hiramatsu
2017-09-28 7:22 ` Ingo Molnar [this message]
2017-09-29 7:29 ` Masami Hiramatsu
2017-09-29 7:37 ` Ingo Molnar
2017-09-29 14:44 ` Masami Hiramatsu
2017-09-29 17:45 ` Ingo Molnar
2017-09-30 5:12 ` Masami Hiramatsu
2017-10-03 23:57 ` Steven Rostedt
2017-10-04 14:01 ` Masami Hiramatsu
2017-09-21 22:00 ` [PATCH -tip v3 0/7] kprobes/x86: Preempt related enhancements Alexei Starovoitov
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=20170928072220.iv5subwl4u4zcqcp@gmail.com \
--to=mingo@kernel.org \
--cc=ananth@linux.vnet.ibm.com \
--cc=ast@fb.com \
--cc=ast@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox