lkml.org 
[lkml]   [2018]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -tip] x86: kprobes: Cleanup preempt disabling and enabling
On Sat, 3 Mar 2018 10:58:23 +0100
Ingo Molnar <mingo@kernel.org> wrote:

>
> * Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > +/*
> > + * Interrupts are disabled on entry as trap3 is an interrupt gate and they
> > + * remain disabled throughout this function.
> > + */
> > +int kprobe_int3_handler(struct pt_regs *regs)
> > +{
> > + struct kprobe_ctlblk *kcb;
> > + int ret;
> > +
> > + if (user_mode(regs))
> > + return 0;
> > +
> > + /*
> > + * We don't want to be preempted for the entire
> > + * duration of kprobe processing.
> > + */
> > + preempt_disable();
> > +
> > + kcb = get_kprobe_ctlblk();
> > + ret = kprobe_int3_dispatcher(regs, kcb);
> > +
> > + if (!kprobe_ready_for_singlestep(regs))
> > + preempt_enable_no_resched();
> > +
> > + return ret;
>
> What's the point of disabling preemption, if IRQs are disabled already?
>
> There's no preemption when IRQs are off...

Ahh, right! Whole the kprobe singlestepping, IRQs are off (kprobes drops
IF from regs->flags for single stepping) so we don't need to care about
preempt count anymore...

Thank you!


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2018-03-03 13:26    [W:0.679 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site