Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
kprobes: Support delayed unoptimizing
Browse files Browse the repository at this point in the history
Unoptimization occurs when a probe is unregistered or disabled,
and is heavy because it recovers instructions by using
stop_machine(). This patch delays unoptimization operations and
unoptimize several probes at once by using
text_poke_smp_batch(). This can avoid unexpected system slowdown
coming from stop_machine().

Changes in v5:
- Split this patch into several cleanup patches and this patch.
- Fix some text_mutex lock miss.
- Use bool instead of int for behavior flags.
- Add additional comment for (un)optimizing path.

Changes in v2:
- Use dynamic allocated buffers and params.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Rusty Russell <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
Cc: Jason Baron <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
mhiramathitachi authored and Ingo Molnar committed Dec 6, 2010
1 parent 61f4e13 commit 6274de4
Show file tree
Hide file tree
Showing 2 changed files with 237 additions and 77 deletions.
4 changes: 4 additions & 0 deletions arch/x86/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,10 @@ static void __kprobes optimized_callback(struct optimized_kprobe *op,
{
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();

/* This is possible if op is under delayed unoptimizing */
if (kprobe_disabled(&op->kp))
return;

preempt_disable();
if (kprobe_running()) {
kprobes_inc_nmissed_count(&op->kp);
Expand Down
Loading

0 comments on commit 6274de4

Please sign in to comment.