lkml.org 
[lkml]   [2017]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -tip v3 7/7] kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT
On Tue, 3 Oct 2017 19:57:22 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

>
> Sorry for the late reply. Coming back from Kernel Recipes, I fell way
> behind in email.
>
> On Fri, 29 Sep 2017 00:29:38 -0700
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > > > + * 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.
> >
> > Steve, could you correct me if I'm wrong. I thought if the kernel is
> > compiled with CONFIG_PREEMPT=y, even in the kernel, it can be preempted
> > suddenly. It means timer interrupt occurs at kernel path and it yield
> > to new task (=preempt.) Do I miss something?
>
> The above sounds correct. I believe Ingo was pointing out the line that
> states "With CONFIG_PREEMPT, such interrupts can be preempted", which
> is not true. I think you meant that interrupts can preempt the kernel
> and cause it to schedule out. The line above sounds like you meant the
> interrupt was preempted, which can't happen.

Ah, now I got it. Yes, interrupt itself is not preempted...

Thank you!

>
> -- Steve


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2017-10-04 16:03    [W:0.100 / U:2.272 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site