public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: masami.hiramatsu.pt@hitachi.com, linux-kernel@vger.kernel.org,
	mingo@elte.hu
Subject: Re: [PATCH] kprobes,x86: disable irq durinr optimized callback
Date: Tue, 26 Apr 2011 09:46:25 -0400	[thread overview]
Message-ID: <20110426134625.GA21840@home.goodmis.org> (raw)
In-Reply-To: <1303822891-8450-1-git-send-email-jolsa@redhat.com>

On Tue, Apr 26, 2011 at 03:01:31PM +0200, Jiri Olsa wrote:
> hi,
> 
> attached patch is disabling irqs during optimized callback,
> so we dont miss any in-irq kprobes as missed.
> 
> Also I think there's small window where current_kprobe variable
> could be touched in non-safe way, but I was not able to hit
> any issue.
> 
> I'm not sure wether this is a bug or if it was intentional to have
> irqs enabled during the pre_handler callback.

That's not very convincing. Did you see if we actually did miss events.
If that's the case then it is a bug. The conversion to optimizing should
not cause events to be missed.


> 
> wbr,
> jirka
> 
> ---
> Disabling irqs during optimized callback, so we dont miss
> any in-irq kprobes as missed.
> 
> Interrupts are also disabled during non-optimized kprobes callbacks.
> 
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> ---
>  arch/x86/kernel/kprobes.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
> index c969fd9..917cb31 100644
> --- a/arch/x86/kernel/kprobes.c
> +++ b/arch/x86/kernel/kprobes.c
> @@ -1183,11 +1183,13 @@ static void __kprobes optimized_callback(struct optimized_kprobe *op,
>  					 struct pt_regs *regs)
>  {
>  	struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
> +	unsigned long flags;
>  
>  	/* This is possible if op is under delayed unoptimizing */
>  	if (kprobe_disabled(&op->kp))
>  		return;
>  
> +	local_irq_save(flags);
>  	preempt_disable();

No reason to disable preemption if you disabled interrupts.

>  	if (kprobe_running()) {
>  		kprobes_inc_nmissed_count(&op->kp);
> @@ -1208,6 +1210,7 @@ static void __kprobes optimized_callback(struct optimized_kprobe *op,
>  		__this_cpu_write(current_kprobe, NULL);
>  	}
>  	preempt_enable_no_resched();

Remove the preempt_enable_no_resched() as well.

BTW, what's up with all these preempt_enable_no_resched()'s laying
around in the kprobe code? Looks to me that this can cause lots of
missing wakeups (preemption leaks). Which would make this horrible for
real-time.

-- Steve

> +	local_irq_restore(flags);
>  }
>  
>  static int __kprobes copy_optimized_instructions(u8 *dest, u8 *src)

  reply	other threads:[~2011-04-26 13:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 13:01 [PATCH] kprobes,x86: disable irq durinr optimized callback Jiri Olsa
2011-04-26 13:46 ` Steven Rostedt [this message]
2011-04-26 14:19   ` Jiri Olsa
2011-04-27  0:51     ` Masami Hiramatsu
2011-05-09 11:11       ` Jiri Olsa
2011-05-10 10:40 ` Ingo Molnar
2011-05-10 11:39   ` Jiri Olsa
2011-05-10 11:44     ` Ingo Molnar
2011-05-11 11:06       ` [PATCH, v2] kprobes, x86: Disable irq during " Jiri Olsa
2011-05-11 13:10         ` [tip:perf/urgent] kprobes, x86: Disable irqs " tip-bot for Jiri Olsa

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=20110426134625.GA21840@home.goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    /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