Re: [PATCH][2/2] kprobe: kprobe-booster against 2.6.16-rc1 for i386

From: Andrew Morton
Date: Tue Jan 31 2006 - 17:47:28 EST


Masami Hiramatsu <hiramatu@xxxxxxxxxxxxxxxxx> wrote:
>
> +#ifdef CONFIG_PREEMPT
> + unsigned pre_preempt_count = preempt_count();
> +#endif /* CONFIG_PREEMPT */
>
> /*
> * We don't want to be preempted for the entire
> @@ -240,6 +291,21 @@ static int __kprobes kprobe_handler(stru
> /* handler has already set things up, so skip ss setup */
> return 1;
>
> + if (p->ainsn.boostable == 1 &&
> +#ifdef CONFIG_PREEMPT
> + !(pre_preempt_count) && /*
> + * This enables booster when the direct
> + * execution path aren't preempted.
> + */
> +#endif /* CONFIG_PREEMPT */
> + !p->post_handler && !p->break_handler ) {
> + /* Boost up -- we can execute copied instructions directly */
> + reset_current_kprobe();
> + regs->eip = (unsigned long)&p->ainsn.insn;
> + preempt_enable_no_resched();
> + return 1;
> + }
> +

These preempt tricks look rather nasty. Can you please describe what the
problem is, precisely? And how this code avoids it? Perhaps we can find
something cleaner.

Also, the patch adds a preempt_enable() but I don't see a corresponding
preempt_disable(). Am I missing something?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/