2007-08-01 21:57:50

by Noah Watkins

[permalink] [raw]
Subject: [patch 1/1] Adds flavor field to __mark_marker

This patch demonstrates an extension field to the
low-level marker functionality, and updates macros to accept
this additional data.


Index: linux-2.6.22-rc6-mm1/include/linux/marker.h
===================================================================
--- linux-2.6.22-rc6-mm1.orig/include/linux/marker.h 2007-08-01 15:39:36.000000000 -0500
+++ linux-2.6.22-rc6-mm1/include/linux/marker.h 2007-08-01 15:39:37.000000000 -0500
@@ -31,10 +31,14 @@
const char *args; /* List of arguments litteraly transformed
* into a string: "arg1, arg2, arg3".
*/
+ const int flavor; /* site-defined marker flavor */
immediate_char_t state; /* Immediate value state. */
marker_probe_func *call;/* Probe handler function pointer */
void *pdata; /* Private probe data */
-} __attribute__((aligned(8)));
+} __attribute__((aligned(32)));
+
+/* Default marker flavor */
+#define MARKER_DEFAULT 0

#ifdef CONFIG_MARKERS

@@ -46,7 +50,7 @@
* not add unwanted padding between the beginning of the section and the
* structure. Force alignment to the same alignment as the section start.
*/
-#define __trace_mark(generic, name, format, args...) \
+#define ___trace_mark(generic, flavor, name, format, args...) \
do { \
static const char __mstrtab_name_##name[] \
__attribute__((section("__markers_strings"))) \
@@ -60,7 +64,7 @@
static struct __mark_marker __mark_##name \
__attribute__((section("__markers"))) = \
{ __mstrtab_name_##name, __mstrtab_format_##name, \
- __mstrtab_args_##name, { 0 }, \
+ __mstrtab_args_##name, flavor, { 0 }, \
__mark_empty_function, NULL }; \
asm volatile ( "" : : "i" (&__mark_##name)); \
__mark_check_format(format, ## args); \
@@ -81,6 +85,9 @@
} \
} while (0)

+#define __trace_mark(generic, name, format, args...) \
+ ___trace_mark(generic, MARKER_DEFAULT, name, format, ## args)
+
extern void module_marker_update(struct module *mod);
#else /* !CONFIG_MARKERS */
#define __trace_mark(generic, name, format, args...) \
Index: linux-2.6.22-rc6-mm1/include/asm-generic/vmlinux.lds.h
===================================================================
--- linux-2.6.22-rc6-mm1.orig/include/asm-generic/vmlinux.lds.h 2007-08-01 15:39:36.000000000 -0500
+++ linux-2.6.22-rc6-mm1/include/asm-generic/vmlinux.lds.h 2007-08-01 15:40:06.000000000 -0500
@@ -13,7 +13,7 @@
#define DATA_DATA \
*(.data) \
*(.data.init.refok) \
- . = ALIGN(8); \
+ . = ALIGN(32); \
VMLINUX_SYMBOL(__start___markers) = .; \
*(__markers) \
VMLINUX_SYMBOL(__stop___markers) = .;

--