[PATCH 04/05] Linux Kernel Markers : i386 optimization

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mathieu Desnoyers
Date: Sunday, February 11, 2007 - 1:03 pm

Linux Kernel Markers : i386 optimization

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

--- /dev/null
+++ b/include/asm-i386/marker.h
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+
+#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, \
+			MARKER_OPTIMIZED } ; \
+		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(); \
+		} \
+	} while (0)
+
+/* Offset of the immediate value from the start of the movb instruction, in
+ * bytes. */
+#define MARK_ENABLE_IMMEDIATE_OFFSET 1
+#define MARK_ENABLE_TYPE char
+#define MARK_POLYMORPHIC
+
+extern int arch_marker_set_ins_enable(void *address, char enable);
+
+#endif
--- /dev/null
+++ b/arch/i386/kernel/marker.c
@@ -0,0 +1,93 @@
+/* marker.c
+ *
+ * Erratum 49 fix for Intel PIII and higher.
+ *
+ * Permits marker activation by XMC with correct serialization.
+ *
+ * Reentrant for NMI and trap handler instrumentation.
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Mathieu Desnoyers, (Sun Feb 11, 1:03 pm)
[PATCH 01/05] Linux Kernel Markers : Kconfig menus, Mathieu Desnoyers, (Sun Feb 11, 1:03 pm)
[PATCH 02/05] Linux Kernel Markers, architecture independa ..., Mathieu Desnoyers, (Sun Feb 11, 1:03 pm)
[PATCH 03/05] Linux Kernel Markers : powerpc optimization, Mathieu Desnoyers, (Sun Feb 11, 1:03 pm)
[PATCH 04/05] Linux Kernel Markers : i386 optimization, Mathieu Desnoyers, (Sun Feb 11, 1:03 pm)
[PATCH 05/05] Linux Kernel Markers, non optimized architec ..., Mathieu Desnoyers, (Sun Feb 11, 1:03 pm)
Re: [PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Andrew Morton, (Thu Feb 15, 12:12 am)
Re: [PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Frank Ch. Eigler, (Thu Feb 15, 8:28 am)
Re: [PATCH 05/05] Linux Kernel Markers, non optimized arch ..., Mathieu Desnoyers, (Thu Feb 15, 12:09 pm)
Re: [PATCH 02/05] Linux Kernel Markers, architecture indep ..., Mathieu Desnoyers, (Thu Feb 15, 12:12 pm)
Re: [PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Andrew Morton, (Thu Feb 15, 3:18 pm)
Re: [PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Mathieu Desnoyers, (Thu Feb 15, 3:30 pm)
Re: [PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Vara Prasad, (Thu Feb 15, 4:14 pm)
Re: [PATCH 00/05] Linux Kernel Markers - kernel 2.6.20, Mathieu Desnoyers, (Thu Feb 15, 6:32 pm)
[PATCH] Linux Kernel Markers Documentation, Mathieu Desnoyers, (Thu Feb 15, 6:33 pm)
Re: [PATCH] Linux Kernel Markers Documentation, Randy Dunlap, (Thu Feb 15, 6:45 pm)
Re: [PATCH] Linux Kernel Markers Documentation, Mathieu Desnoyers, (Thu Feb 15, 8:56 pm)
Re: [PATCH] Linux Kernel Markers Documentation - fix, Mathieu Desnoyers, (Thu Feb 15, 9:05 pm)
Re: [PATCH 05/05] Linux Kernel Markers, non optimized arch ..., Mathieu Desnoyers, (Fri Feb 16, 4:38 pm)
Re: [PATCH 05/05] Linux Kernel Markers, non optimized arch ..., Mathieu Desnoyers, (Wed Feb 21, 1:45 pm)
[PATCH] Linux Kernel Markers - cleanup, Mathieu Desnoyers, (Wed Feb 21, 5:18 pm)