From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@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>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [BUGFIX PATCH] kprobes/x86: Remove IRQ disabling from jprobe handlers
Date: Wed, 4 Oct 2017 15:18:30 +0900 [thread overview]
Message-ID: <20171004151830.1e460cb7250b8741af0e2dbc@kernel.org> (raw)
In-Reply-To: <20171003171100.p535ul3wml4uhsow@gmail.com>
On Tue, 3 Oct 2017 19:11:00 +0200
Ingo Molnar <mingo@kernel.org> wrote:
>
> * Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > On Tue, 3 Oct 2017 11:33:44 +0200
> > Ingo Molnar <mingo@kernel.org> wrote:
> >
> > >
> > > * Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > >
> > > > Jprobe actually doesn't need to disable IRQs while calling
> > > > handlers, 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 jprobes too.
> > > >
> > > > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > > ---
> > > > arch/x86/kernel/kprobes/core.c | 2 --
> > > > 1 file changed, 2 deletions(-)
> > > >
> > > > diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> > > > index b48e0efd668e..bd36f3c33cd0 100644
> > > > --- a/arch/x86/kernel/kprobes/core.c
> > > > +++ b/arch/x86/kernel/kprobes/core.c
> > > > @@ -1099,8 +1099,6 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
> > > > * raw stack chunk with redzones:
> > > > */
> > > > __memcpy(kcb->jprobes_stack, (kprobe_opcode_t *)addr, MIN_STACK_SIZE(addr));
> > > > - regs->flags &= ~X86_EFLAGS_IF;
> > > > - trace_hardirqs_off();
> > > > regs->ip = (unsigned long)(jp->entry);
> > > >
> > > > /*
> > >
> > > Could you please also do a patch that disables jprobes permanently, in preparation
> > > of eventually removing them later?
> >
> > Would you mean introducing CONFIG_JPROBE_API and cut APIs out,
> > or just adding "__deprecated" for each API?
>
> No, I'd suggest removing in-kernel uses and disabling jprobes in the Kconfig
> altogether, but without removing the code and its integration for the time being.
Hmm, actually we can not disable jprobe, that has no separate Kconfig.
So we need to introduce new kconfig for that.
And, there are several network protocols using jprobe to trace events.
(e.g. NET_DCCPPROBE and NET_TCPPROBE)
I think they need to migrate to trace-event at first.
So, how about below idea?
1. Introduce CONFIG_JPROBE_API which only separate jprobe general parts
(no arch dependent code involves) and make it default n.
2. Mark break_handler and jprobe APIs deprecated so that no new user comes up.
3. migrate in-kernel jprobe user to trace-event or ftrace.
(may take some time)
4. after that, we can completely remove jprobe which will be a series for
all archs. (or just one big patch?)
Thank you,
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2017-10-04 6:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 23:12 [kprobes/x86] a19b2e3d78: WARNING:at_kernel/locking/lockdep.c:#trace_hardirqs_off_caller kernel test robot
2017-09-30 23:12 ` kernel test robot
2017-10-02 7:33 ` Peter Zijlstra
2017-10-02 7:33 ` Peter Zijlstra
2017-10-02 15:46 ` Masami Hiramatsu
2017-10-02 15:46 ` Masami Hiramatsu
2017-10-02 16:05 ` Peter Zijlstra
2017-10-02 16:05 ` Peter Zijlstra
2017-10-03 1:10 ` Masami Hiramatsu
2017-10-03 1:10 ` Masami Hiramatsu
2017-10-02 16:19 ` Linus Torvalds
2017-10-02 16:19 ` Linus Torvalds
2017-10-03 2:26 ` Masami Hiramatsu
2017-10-03 2:26 ` Masami Hiramatsu
2017-10-03 7:18 ` [BUGFIX PATCH] kprobes/x86: Remove IRQ disabling from jprobe handlers Masami Hiramatsu
2017-10-03 9:33 ` Ingo Molnar
2017-10-03 15:24 ` Masami Hiramatsu
2017-10-03 17:11 ` Ingo Molnar
2017-10-04 6:18 ` Masami Hiramatsu [this message]
2017-10-04 10:41 ` Ingo Molnar
2017-10-04 14:08 ` Masami Hiramatsu
2017-10-05 7:57 ` Ingo Molnar
2017-10-05 8:28 ` Masami Hiramatsu
2017-10-03 17:43 ` [tip:x86/urgent] " tip-bot for Masami Hiramatsu
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=20171004151830.1e460cb7250b8741af0e2dbc@kernel.org \
--to=mhiramat@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=mingo@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=torvalds@linux-foundation.org \
--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 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.