This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[RFC PATCH tracing/kprobes] kprobes: Call vmalloc_sync_all() for avoiding in-kernel paging on kprobes
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Frederic Weisbecker <fweisbec at gmail dot com>, Ingo Molnar <mingo at elte dot hu>, lkml<linux-kernel at vger dot kernel dot org>
- Cc: systemtap<systemtap at sources dot redhat dot com>, DLE<dle-develop at lists dot sourceforge dot net>, Masami Hiramatsu <mhiramat at redhat dot com>, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>, Jim Keniston <jkenisto at us dot ibm dot com>, Ingo Molnar <mingo at elte dot hu>, Frederic Weisbecker <fweisbec at gmail dot com>
- Date: Tue, 08 Sep 2009 12:54:38 -0400
- Subject: [RFC PATCH tracing/kprobes] kprobes: Call vmalloc_sync_all() for avoiding in-kernel paging on kprobes
- References: <4A99E8CB.1040600@redhat.com>
Call vmalloc_sync_all() before registering new kprobes and using new
instruction buffers to sync page table entries of the pages on where
kprobes data structure and instruction buffers are.
With this patch, kprobes can avoid in-kernel on-demand paging on these
kprobes, and it allows kprobes to put probes on page-fault path.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/kprobes.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 00d01b0..7cc8266 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -44,6 +44,7 @@
#include <linux/debugfs.h>
#include <linux/kdebug.h>
#include <linux/memory.h>
+#include <linux/vmalloc.h>
#include <asm-generic/sections.h>
#include <asm/cacheflush.h>
@@ -191,6 +192,7 @@ static kprobe_opcode_t __kprobes *__get_insn_slot(void)
kfree(kip);
return NULL;
}
+ vmalloc_sync_all(); /* Prohibit on-demand kernel paging on kprobe */
INIT_LIST_HEAD(&kip->list);
list_add(&kip->list, &kprobe_insn_pages);
memset(kip->slot_used, SLOT_CLEAN, INSNS_PER_PAGE);
@@ -724,6 +726,7 @@ int __kprobes register_kprobe(struct kprobe *p)
}
preempt_enable();
+ vmalloc_sync_all(); /* Prohibit on-demand kernel paging on kprobe */
p->nmissed = 0;
INIT_LIST_HEAD(&p->list);
mutex_lock(&kprobe_mutex);
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com