This is the mail archive of the systemtap@sources.redhat.com mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC PATCH 3/3] Djprobe improvement patches (Re: Dynamic djprobe)


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 */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]