[patch 24/24] Linux Kernel Markers - Use Immediate Values
Make markers use immediate values. Changelog : - Use imv_* instead of immediate_*. Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]> --- Documentation/markers.txt | 17 + include/linux/marker.h| 42 -- kernel/marker.c |8 ++-- kernel/module.c |1 + 4 files changed, 52 insertions(+), 16 deletions(-) Index: linux-2.6-lttng/include/linux/marker.h === --- linux-2.6-lttng.orig/include/linux/marker.h 2007-12-05 20:53:25.0 -0500 +++ linux-2.6-lttng/include/linux/marker.h 2007-12-05 20:53:54.0 -0500 @@ -12,6 +12,7 @@ * See the file COPYING for more details. */ +#include #include struct module; @@ -42,7 +43,7 @@ struct marker { const char *format; /* Marker format string, describing the * variable argument list. */ - char state; /* Marker state. */ + DEFINE_IMV(char, state);/* Immediate value state. */ char ptype; /* probe type : 0 : single, 1 : multi */ void (*call)(const struct marker *mdata,/* Probe wrapper */ void *call_private, const char *fmt, ...); @@ -53,13 +54,14 @@ struct marker { #ifdef CONFIG_MARKERS /* + * Generic marker flavor always available. * Note : the empty asm volatile with read constraint is used here instead of a * "used" attribute to fix a gcc 4.1.x bug. * Make sure the alignment of the structure in the __markers section will * 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(name, call_private, format, args...) \ +#define __trace_mark(generic, name, call_private, format, args...) \ do {\ static const char __mstrtab_##name[]\ __attribute__((section("__markers_strings"))) \ @@ -70,17 +72,23 @@ struct marker { 0, 0, marker_probe_cb, \ { __mark_empty_function, NULL}, NULL }; \ __mark_check_format(format, ## args); \ - if (unlikely(__mark_##name.state)) {\ - (*__mark_##name.call) \ - (&__mark_##name, call_private, \ - format, ## args); \ + if (!generic) { \ + if (unlikely(imv_read(__mark_##name.state)))\ + (*__mark_##name.call) \ + (&__mark_##name, call_private, \ + format, ## args); \ + } else {\ + if (unlikely(_imv_read(__mark_##name.state))) \ + (*__mark_##name.call) \ + (&__mark_##name, call_private, \ + format, ## args); \ } \ } while (0) extern void marker_update_probe_range(struct marker *begin, struct marker *end); #else /* !CONFIG_MARKERS */ -#define __trace_mark(name, call_private, format, args...) \ +#define __trace_mark(generic, name, call_private, format, args...) \ __mark_check_format(format, ## args) static inline void marker_update_probe_range(struct marker *begin, struct marker *end) @@ -88,15 +96,29 @@ static inline void marker_update_probe_r #endif /* CONFIG_MARKERS */ /** - * trace_mark - Marker + * trace_mark - Marker using code patching * @name: marker name, not quoted. * @format: format string * @args...: variable argument list * - * Places a marker. + * Places a marker using optimized code patching technique (imv_read()) + * to be enabled. */ #define trace_mark(name, format, args...) \ - __trace_mark(name, NULL, format, ## args) + __trace_mark(0, name, NULL, format, ## args) + +/** + * _trace_mark - Marker using variable read + * @name: marker name, not quoted. + * @format: format string + * @args...: variable argument list + * + * Places a marker using a standard memory read (_imv_read()) to be + * enabled. Should be used for markers in __init and __exit functions and in + * lockdep code. + */ +#define _trace_mark(name, format, args...) \ + __trace_mark(1, name, NULL, format, ## args) /** * MARK_NOARGS - Format string for a marker with no argument. Index:
[patch 24/24] Linux Kernel Markers - Use Immediate Values
Make markers use immediate values. Changelog : - Use imv_* instead of immediate_*. Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED] --- Documentation/markers.txt | 17 + include/linux/marker.h| 42 -- kernel/marker.c |8 ++-- kernel/module.c |1 + 4 files changed, 52 insertions(+), 16 deletions(-) Index: linux-2.6-lttng/include/linux/marker.h === --- linux-2.6-lttng.orig/include/linux/marker.h 2007-12-05 20:53:25.0 -0500 +++ linux-2.6-lttng/include/linux/marker.h 2007-12-05 20:53:54.0 -0500 @@ -12,6 +12,7 @@ * See the file COPYING for more details. */ +#include linux/immediate.h #include linux/types.h struct module; @@ -42,7 +43,7 @@ struct marker { const char *format; /* Marker format string, describing the * variable argument list. */ - char state; /* Marker state. */ + DEFINE_IMV(char, state);/* Immediate value state. */ char ptype; /* probe type : 0 : single, 1 : multi */ void (*call)(const struct marker *mdata,/* Probe wrapper */ void *call_private, const char *fmt, ...); @@ -53,13 +54,14 @@ struct marker { #ifdef CONFIG_MARKERS /* + * Generic marker flavor always available. * Note : the empty asm volatile with read constraint is used here instead of a * used attribute to fix a gcc 4.1.x bug. * Make sure the alignment of the structure in the __markers section will * 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(name, call_private, format, args...) \ +#define __trace_mark(generic, name, call_private, format, args...) \ do {\ static const char __mstrtab_##name[]\ __attribute__((section(__markers_strings))) \ @@ -70,17 +72,23 @@ struct marker { 0, 0, marker_probe_cb, \ { __mark_empty_function, NULL}, NULL }; \ __mark_check_format(format, ## args); \ - if (unlikely(__mark_##name.state)) {\ - (*__mark_##name.call) \ - (__mark_##name, call_private, \ - format, ## args); \ + if (!generic) { \ + if (unlikely(imv_read(__mark_##name.state)))\ + (*__mark_##name.call) \ + (__mark_##name, call_private, \ + format, ## args); \ + } else {\ + if (unlikely(_imv_read(__mark_##name.state))) \ + (*__mark_##name.call) \ + (__mark_##name, call_private, \ + format, ## args); \ } \ } while (0) extern void marker_update_probe_range(struct marker *begin, struct marker *end); #else /* !CONFIG_MARKERS */ -#define __trace_mark(name, call_private, format, args...) \ +#define __trace_mark(generic, name, call_private, format, args...) \ __mark_check_format(format, ## args) static inline void marker_update_probe_range(struct marker *begin, struct marker *end) @@ -88,15 +96,29 @@ static inline void marker_update_probe_r #endif /* CONFIG_MARKERS */ /** - * trace_mark - Marker + * trace_mark - Marker using code patching * @name: marker name, not quoted. * @format: format string * @args...: variable argument list * - * Places a marker. + * Places a marker using optimized code patching technique (imv_read()) + * to be enabled. */ #define trace_mark(name, format, args...) \ - __trace_mark(name, NULL, format, ## args) + __trace_mark(0, name, NULL, format, ## args) + +/** + * _trace_mark - Marker using variable read + * @name: marker name, not quoted. + * @format: format string + * @args...: variable argument list + * + * Places a marker using a standard memory read (_imv_read()) to be + * enabled. Should be used for markers in __init and __exit functions and in + * lockdep code. + */ +#define _trace_mark(name, format, args...) \ + __trace_mark(1, name, NULL, format, ## args) /** * MARK_NOARGS - Format string for a marker with no argument. Index: