mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, Yang Bo <yangbo@deepin.com>,
	Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Laura Abbott <labbott@redhat.com>
Subject: Re: [PATCH -tip] x86: kprobes: Cleanup preempt disabling and enabling
Date: Sat, 3 Mar 2018 21:25:45 +0900	[thread overview]
Message-ID: <20180303212545.8aa1ddb856975ffcac4672b5@kernel.org> (raw)
In-Reply-To: <20180303095823.phaoeuvcjhoirwg3@gmail.com>

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>

  reply	other threads:[~2018-03-03 12:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  3:46 Masami Hiramatsu
2018-03-03  9:58 ` Ingo Molnar
2018-03-03 12:25   ` Masami Hiramatsu [this message]
2018-03-04  9:50     ` 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=20180303212545.8aa1ddb856975ffcac4672b5@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=labbott@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yangbo@deepin.com \
    /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

all inboxes | Powered by JetHome®