This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 04/05] Linux Kernel Markers : i386 optimisation
- From: Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- To: linux-kernel at vger dot kernel dot org
- Cc: Linus Torvalds <torvalds at osdl dot org>, Andrew Morton <akpm at osdl dot org>, Ingo Molnar <mingo at redhat dot com>, Greg Kroah-Hartman <gregkh at suse dot de>, Christoph Hellwig <hch at infradead dot org>, ltt-dev at shafik dot org, systemtap at sources dot redhat dot com, Douglas Niehaus <niehaus at eecs dot ku dot edu>, Thomas Gleixner <tglx at linutronix dot de>, Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- Date: Thu, 11 Jan 2007 19:02:17 -0500
- Subject: [PATCH 04/05] Linux Kernel Markers : i386 optimisation
- References: <11685601382063-git-send-email-mathieu.desnoyers@polymtl.ca>
Linux Kernel Markers : i386 optimisation
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- /dev/null
+++ b/include/asm-i386/marker.h
@@ -0,0 +1,54 @@
+/*
+ * marker.h
+ *
+ * Code markup for dynamic and static tracing. i386 architecture optimisations.
+ *
+ * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * This file is released under the GPLv2.
+ * See the file COPYING for more details.
+ */
+
+
+struct __mark_marker_c {
+ const char *name;
+ marker_probe_func **call;
+ const char *format;
+} __attribute__((packed));
+
+struct __mark_marker {
+ struct __mark_marker_c *cmark;
+ volatile char *enable;
+} __attribute__((packed));
+
+#ifdef CONFIG_MARKERS
+#define MARK(name, format, args...) \
+ do { \
+ static marker_probe_func *__mark_call_##name = \
+ __mark_empty_function; \
+ static const struct __mark_marker_c __mark_c_##name \
+ __attribute__((section(".markers.c"))) = \
+ { #name, &__mark_call_##name, format } ; \
+ char condition; \
+ asm volatile( ".section .markers, \"a\";\n\t" \
+ ".long %1, 0f;\n\t" \
+ ".previous;\n\t" \
+ ".align 2\n\t" \
+ "0:\n\t" \
+ "movb $0,%0;\n\t" \
+ : "=r" (condition) \
+ : "m" (__mark_c_##name)); \
+ __mark_check_format(format, ## args); \
+ if (unlikely(condition)) { \
+ preempt_disable(); \
+ (*__mark_call_##name)(format, ## args); \
+ preempt_enable_no_resched(); \
+ } \
+ } while (0)
+
+/* Offset of the immediate value from the start of the movb instruction, in
+ * bytes. */
+#define MARK_ENABLE_IMMEDIATE_OFFSET 1
+#define MARK_POLYMORPHIC
+
+#endif