From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: ast@fb.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org,
rostedt@goodmis.org, peterz@infradead.org, ast@kernel.org,
ananth@linux.vnet.ibm.com, hpa@zytor.com, mingo@kernel.org,
paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org,
tglx@linutronix.de
Subject: [tip:perf/core] kprobes/x86: Remove IRQ disabling from ftrace-based/optimized kprobes
Date: Thu, 28 Sep 2017 03:54:33 -0700 [thread overview]
Message-ID: <tip-a19b2e3d783964d48d2b494439648e929bcdc976@git.kernel.org> (raw)
In-Reply-To: <150581534039.32348.11331736206004264553.stgit@devbox>
Commit-ID: a19b2e3d783964d48d2b494439648e929bcdc976
Gitweb: https://git.kernel.org/tip/a19b2e3d783964d48d2b494439648e929bcdc976
Author: Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Tue, 19 Sep 2017 19:02:20 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 28 Sep 2017 09:25:50 +0200
kprobes/x86: Remove IRQ disabling from ftrace-based/optimized kprobes
Kkprobes don't need to disable IRQs if they are called from the
ftrace/jump trampoline code, because Documentation/kprobes.txt says:
-----
Probe handlers are run with preemption disabled. Depending on the
architecture and optimization state, handlers may also run with
interrupts disabled (e.g., kretprobe handlers and optimized kprobe
handlers run without interrupt disabled on x86/x86-64).
-----
So let's remove IRQ disabling from those handlers.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/150581534039.32348.11331736206004264553.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/kprobes/ftrace.c | 9 ++-------
arch/x86/kernel/kprobes/opt.c | 4 ----
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/kprobes/ftrace.c b/arch/x86/kernel/kprobes/ftrace.c
index bcfee4f..8dc0161 100644
--- a/arch/x86/kernel/kprobes/ftrace.c
+++ b/arch/x86/kernel/kprobes/ftrace.c
@@ -61,14 +61,11 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
{
struct kprobe *p;
struct kprobe_ctlblk *kcb;
- unsigned long flags;
-
- /* Disable irq for emulating a breakpoint and avoiding preempt */
- local_irq_save(flags);
+ /* Preempt is disabled by ftrace */
p = get_kprobe((kprobe_opcode_t *)ip);
if (unlikely(!p) || kprobe_disabled(p))
- goto end;
+ return;
kcb = get_kprobe_ctlblk();
if (kprobe_running()) {
@@ -91,8 +88,6 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
* resets current kprobe, and keep preempt count +1.
*/
}
-end:
- local_irq_restore(flags);
}
NOKPROBE_SYMBOL(kprobe_ftrace_handler);
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 32c35cb..e941136 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -154,13 +154,10 @@ STACK_FRAME_NON_STANDARD(optprobe_template_func);
static void
optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
{
- unsigned long flags;
-
/* This is possible if op is under delayed unoptimizing */
if (kprobe_disabled(&op->kp))
return;
- local_irq_save(flags);
preempt_disable();
if (kprobe_running()) {
kprobes_inc_nmissed_count(&op->kp);
@@ -182,7 +179,6 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
__this_cpu_write(current_kprobe, NULL);
}
preempt_enable_no_resched();
- local_irq_restore(flags);
}
NOKPROBE_SYMBOL(optimized_callback);
next prev parent reply other threads:[~2017-09-28 10:58 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-bot for Masami Hiramatsu [this message]
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
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=tip-a19b2e3d783964d48d2b494439648e929bcdc976@git.kernel.org \
--to=tipbot@zytor.com \
--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=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.