This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
[RFC PATCH 3/3] Djprobe improvement patches (Re: Dynamic djprobe)
- From: Masami Hiramatsu <hiramatu at sdl dot hitachi dot co dot jp>
- To: Masami Hiramatsu <hiramatu at sdl dot hitachi dot co dot jp>
- Cc: systemtap at sources dot redhat dot com, "Keshavamurthy, Anil S" <anil dot s dot keshavamurthy at intel dot com>, Roland McGrath <roland at redhat dot com>, Richard J Moore <richardj_moore at uk dot ibm dot com>, Andi Kleen <ak at muc dot de>, michel dot dagenais at polymtl dot ca, Mathieu Desnoyers <compudj at krystal dot dyndns dot org>, "Frank Ch. Eigler" <fche at redhat dot com>, Karim Yaghmour <karim at opersys dot com>, Satoshi Oshima <soshima at redhat dot com>, Hideo Aoki <haoki at redhat dot com>, Yumiko Sugita <sugita at sdl dot hitachi dot co dot jp>
- Date: Wed, 03 Aug 2005 02:07:31 +0900
- Subject: [RFC PATCH 3/3] Djprobe improvement patches (Re: Dynamic djprobe)
- References: <42EA740A.10601@sdl.hitachi.co.jp>
Hi,
This patch introduces code serializing function. Pentium 4 has trace
cache that should be flushed on each CPU when the execution codes are
changed. So, I implemented a serializing function by using CPUID.
Thanks,
--
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: hiramatu@sdl.hitachi.co.jp
arch/i386/kernel/kprobes.c | 5 +++--
arch/i386/mm/pageattr.c | 10 ++++++++++
include/asm-i386/cacheflush.h | 2 ++
3 files changed, 15 insertions(+), 2 deletions(-)
diff -Narup linux-2.6.12-djprobe.3/arch/i386/kernel/kprobes.c linux-2.6.12-djprobe.4/arch/i386/kernel/kprobes.c
--- linux-2.6.12-djprobe.3/arch/i386/kernel/kprobes.c 2005-08-02 14:41:56.000000000 +0900
+++ linux-2.6.12-djprobe.4/arch/i386/kernel/kprobes.c 2005-08-02 20:27:05.000000000 +0900
@@ -32,6 +32,7 @@
#include <linux/preempt.h>
#include <asm/kdebug.h>
#include <asm/desc.h>
+#include <asm/cacheflush.h>
/* kprobe_status settings */
#define KPROBE_HIT_ACTIVE 0x00000001
@@ -418,7 +419,7 @@ static inline void __set_jmp_op(void *fr
struct __arch_jmp_op *jop;
jop = (struct __arch_jmp_op *)from;
jop->raddr=(long)(to) - ((long)(from) + 5);
- smp_mb();
+ smp_flush_icache_all();
jop->op = RELATIVEJUMP_INSTRUCTION;
}
/* switch back to the kprobe */
@@ -428,7 +429,7 @@ static inline void __set_breakpoint_op(v
*jop2 = (struct __arch_jmp_op *)orig;
jop->op = BREAKPOINT_INSTRUCTION;
- smp_mb();
+ smp_flush_icache_all();
jop->raddr = jop2->raddr;
}
/*
diff -Narup linux-2.6.12-djprobe.3/arch/i386/mm/pageattr.c linux-2.6.12-djprobe.4/arch/i386/mm/pageattr.c
--- linux-2.6.12-djprobe.3/arch/i386/mm/pageattr.c 2005-06-18 04:48:29.000000000 +0900
+++ linux-2.6.12-djprobe.4/arch/i386/mm/pageattr.c 2005-08-02 14:49:25.000000000 +0900
@@ -217,5 +217,15 @@ void kernel_map_pages(struct page *page,
}
#endif
+static void local_flush_icache(void * info)
+{
+ cpuid_eax(0);
+}
+
+void smp_flush_icache_all(void)
+{
+ on_each_cpu(local_flush_icache, NULL, 1,1);
+}
+
EXPORT_SYMBOL(change_page_attr);
EXPORT_SYMBOL(global_flush_tlb);
diff -Narup linux-2.6.12-djprobe.3/include/asm-i386/cacheflush.h linux-2.6.12-djprobe.4/include/asm-i386/cacheflush.h
--- linux-2.6.12-djprobe.3/include/asm-i386/cacheflush.h 2005-06-18 04:48:29.000000000 +0900
+++ linux-2.6.12-djprobe.4/include/asm-i386/cacheflush.h 2005-08-02 14:49:25.000000000 +0900
@@ -31,4 +31,6 @@ int change_page_attr(struct page *page,
void kernel_map_pages(struct page *page, int numpages, int enable);
#endif
+void smp_flush_icache_all(void);
+
#endif /* _I386_CACHEFLUSH_H */