Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
* Alexey Dobriyan ([EMAIL PROTECTED]) wrote: > On Thu, May 10, 2007 at 09:12:41AM -0400, Mathieu Desnoyers wrote: > > Linux Kernel Markers - Architecture Independant Code fix 2 > > > > Fix trivial SMP bug in list_modules. > > > --- linux-2.6-lttng.orig/kernel/module.c2007-05-10 08:51:02.0 > > -0400 > > +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.0 -0400 > > @@ -2657,13 +2657,16 @@ > > /* Enumerate loaded modules */ > > struct list_head*i; > > struct module *mod; > > - unsigned long refcount = 0; > > + unsigned long refcount; > > + int cpu; > > > > mutex_lock(_mutex); > > list_for_each(i, ) { > > mod = list_entry(i, struct module, list); > > + refcount = 0; > > #ifdef CONFIG_MODULE_UNLOAD > > - refcount = local_read(>ref[0].count); > > + for_each_online_cpu(cpu) > > + refcount += local_read(>ref[cpu].count); > > #endif //CONFIG_MODULE_UNLOAD > > Still wrong: module_get on cpu X, cpu X hot unplugged. There is > module_refcount() for you. Ok, fixing. thanks. -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
On Thu, May 10, 2007 at 09:12:41AM -0400, Mathieu Desnoyers wrote: > Linux Kernel Markers - Architecture Independant Code fix 2 > > Fix trivial SMP bug in list_modules. > --- linux-2.6-lttng.orig/kernel/module.c 2007-05-10 08:51:02.0 > -0400 > +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.0 -0400 > @@ -2657,13 +2657,16 @@ > /* Enumerate loaded modules */ > struct list_head*i; > struct module *mod; > - unsigned long refcount = 0; > + unsigned long refcount; > + int cpu; > > mutex_lock(_mutex); > list_for_each(i, ) { > mod = list_entry(i, struct module, list); > + refcount = 0; > #ifdef CONFIG_MODULE_UNLOAD > - refcount = local_read(>ref[0].count); > + for_each_online_cpu(cpu) > + refcount += local_read(>ref[cpu].count); > #endif //CONFIG_MODULE_UNLOAD Still wrong: module_get on cpu X, cpu X hot unplugged. There is module_refcount() for you. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
Linux Kernel Markers - Architecture Independant Code fix 2 Fix trivial SMP bug in list_modules. Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]> --- kernel/module.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: linux-2.6-lttng/kernel/module.c === --- linux-2.6-lttng.orig/kernel/module.c2007-05-10 08:51:02.0 -0400 +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.0 -0400 @@ -2657,13 +2657,16 @@ /* Enumerate loaded modules */ struct list_head*i; struct module *mod; - unsigned long refcount = 0; + unsigned long refcount; + int cpu; mutex_lock(_mutex); list_for_each(i, ) { mod = list_entry(i, struct module, list); + refcount = 0; #ifdef CONFIG_MODULE_UNLOAD - refcount = local_read(>ref[0].count); + for_each_online_cpu(cpu) + refcount += local_read(>ref[cpu].count); #endif //CONFIG_MODULE_UNLOAD trace_mark(list_module, "%s %d %lu", mod->name, mod->state, refcount); -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
Hi Alexey, * Alexey Dobriyan ([EMAIL PROTECTED]) wrote: > On Wed, May 09, 2007 at 09:55:57PM -0400, Mathieu Desnoyers wrote: > > --- /dev/null > > +++ linux-2.6-lttng/include/linux/marker.h > > @@ -0,0 +1,124 @@ > > > +#ifdef __KERNEL__ > > Just don't add this file to include/linux/Kbuild and remove __KERNEL__ > ifdef. > > > --- linux-2.6-lttng.orig/include/linux/module.h > > +++ linux-2.6-lttng/include/linux/module.h > > @@ -356,6 +356,9 @@ > > /* The command line arguments (may be mangled). People like > >keeping pointers to this stuff */ > > char *args; > > + > > + const struct __mark_marker *markers; > > + unsigned int num_markers; > > #ifdef CONFIG_MARKERS, please. > Ok, I merged the patch from SystemTAP to help them parse the markers section, but seeing the violent objections it gets, I guess they will have to figure out another way to parse it. Let's drop the allow-userspace-applications-to-use-markerh-to-parse-the-markers-section-in-the-kernel-binary.patch then. > > --- linux-2.6-lttng.orig/kernel/module.c > > +++ linux-2.6-lttng/kernel/module.c > > > @@ -1659,6 +1884,9 @@ > > unsigned int unusedcrcindex; > > unsigned int unusedgplindex; > > unsigned int unusedgplcrcindex; > > + unsigned int markersindex; > > + unsigned int markersdataindex; > > + unsigned int markersstringsindex; > > Bunch of underscores wouldn't hurt. > Hrm, I used the exact same variable naming style already present in the function. Do you suggest changing _every_ variable name to underscores ? > > +void list_modules(void) > > +{ > > + /* Enumerate loaded modules */ > > + struct list_head*i; > > + struct module *mod; > > + unsigned long refcount = 0; > > + > > + mutex_lock(_mutex); > > + list_for_each(i, ) { > > + mod = list_entry(i, struct module, list); > > +#ifdef CONFIG_MODULE_UNLOAD > > + refcount = local_read(>ref[0].count); > ^ > Buy second CPU, already. ;-) > Good catch, will fix. I do already have more than one, don't worry ;) > > +#endif //CONFIG_MODULE_UNLOAD > > + trace_mark(list_module, "%s %d %lu", > > + mod->name, mod->state, refcount); > > + } > > + mutex_unlock(_mutex); > > +} > -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
Hi Alexey, * Alexey Dobriyan ([EMAIL PROTECTED]) wrote: On Wed, May 09, 2007 at 09:55:57PM -0400, Mathieu Desnoyers wrote: --- /dev/null +++ linux-2.6-lttng/include/linux/marker.h @@ -0,0 +1,124 @@ +#ifdef __KERNEL__ Just don't add this file to include/linux/Kbuild and remove __KERNEL__ ifdef. --- linux-2.6-lttng.orig/include/linux/module.h +++ linux-2.6-lttng/include/linux/module.h @@ -356,6 +356,9 @@ /* The command line arguments (may be mangled). People like keeping pointers to this stuff */ char *args; + + const struct __mark_marker *markers; + unsigned int num_markers; #ifdef CONFIG_MARKERS, please. Ok, I merged the patch from SystemTAP to help them parse the markers section, but seeing the violent objections it gets, I guess they will have to figure out another way to parse it. Let's drop the allow-userspace-applications-to-use-markerh-to-parse-the-markers-section-in-the-kernel-binary.patch then. --- linux-2.6-lttng.orig/kernel/module.c +++ linux-2.6-lttng/kernel/module.c @@ -1659,6 +1884,9 @@ unsigned int unusedcrcindex; unsigned int unusedgplindex; unsigned int unusedgplcrcindex; + unsigned int markersindex; + unsigned int markersdataindex; + unsigned int markersstringsindex; Bunch of underscores wouldn't hurt. Hrm, I used the exact same variable naming style already present in the function. Do you suggest changing _every_ variable name to underscores ? +void list_modules(void) +{ + /* Enumerate loaded modules */ + struct list_head*i; + struct module *mod; + unsigned long refcount = 0; + + mutex_lock(module_mutex); + list_for_each(i, modules) { + mod = list_entry(i, struct module, list); +#ifdef CONFIG_MODULE_UNLOAD + refcount = local_read(mod-ref[0].count); ^ Buy second CPU, already. ;-) Good catch, will fix. I do already have more than one, don't worry ;) +#endif //CONFIG_MODULE_UNLOAD + trace_mark(list_module, %s %d %lu, + mod-name, mod-state, refcount); + } + mutex_unlock(module_mutex); +} -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
Linux Kernel Markers - Architecture Independant Code fix 2 Fix trivial SMP bug in list_modules. Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED] --- kernel/module.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: linux-2.6-lttng/kernel/module.c === --- linux-2.6-lttng.orig/kernel/module.c2007-05-10 08:51:02.0 -0400 +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.0 -0400 @@ -2657,13 +2657,16 @@ /* Enumerate loaded modules */ struct list_head*i; struct module *mod; - unsigned long refcount = 0; + unsigned long refcount; + int cpu; mutex_lock(module_mutex); list_for_each(i, modules) { mod = list_entry(i, struct module, list); + refcount = 0; #ifdef CONFIG_MODULE_UNLOAD - refcount = local_read(mod-ref[0].count); + for_each_online_cpu(cpu) + refcount += local_read(mod-ref[cpu].count); #endif //CONFIG_MODULE_UNLOAD trace_mark(list_module, %s %d %lu, mod-name, mod-state, refcount); -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
On Thu, May 10, 2007 at 09:12:41AM -0400, Mathieu Desnoyers wrote: Linux Kernel Markers - Architecture Independant Code fix 2 Fix trivial SMP bug in list_modules. --- linux-2.6-lttng.orig/kernel/module.c 2007-05-10 08:51:02.0 -0400 +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.0 -0400 @@ -2657,13 +2657,16 @@ /* Enumerate loaded modules */ struct list_head*i; struct module *mod; - unsigned long refcount = 0; + unsigned long refcount; + int cpu; mutex_lock(module_mutex); list_for_each(i, modules) { mod = list_entry(i, struct module, list); + refcount = 0; #ifdef CONFIG_MODULE_UNLOAD - refcount = local_read(mod-ref[0].count); + for_each_online_cpu(cpu) + refcount += local_read(mod-ref[cpu].count); #endif //CONFIG_MODULE_UNLOAD Still wrong: module_get on cpu X, cpu X hot unplugged. There is module_refcount() for you. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
* Alexey Dobriyan ([EMAIL PROTECTED]) wrote: On Thu, May 10, 2007 at 09:12:41AM -0400, Mathieu Desnoyers wrote: Linux Kernel Markers - Architecture Independant Code fix 2 Fix trivial SMP bug in list_modules. --- linux-2.6-lttng.orig/kernel/module.c2007-05-10 08:51:02.0 -0400 +++ linux-2.6-lttng/kernel/module.c 2007-05-10 08:51:06.0 -0400 @@ -2657,13 +2657,16 @@ /* Enumerate loaded modules */ struct list_head*i; struct module *mod; - unsigned long refcount = 0; + unsigned long refcount; + int cpu; mutex_lock(module_mutex); list_for_each(i, modules) { mod = list_entry(i, struct module, list); + refcount = 0; #ifdef CONFIG_MODULE_UNLOAD - refcount = local_read(mod-ref[0].count); + for_each_online_cpu(cpu) + refcount += local_read(mod-ref[cpu].count); #endif //CONFIG_MODULE_UNLOAD Still wrong: module_get on cpu X, cpu X hot unplugged. There is module_refcount() for you. Ok, fixing. thanks. -- Mathieu Desnoyers Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
On Wed, May 09, 2007 at 09:55:57PM -0400, Mathieu Desnoyers wrote: > --- /dev/null > +++ linux-2.6-lttng/include/linux/marker.h > @@ -0,0 +1,124 @@ > +#ifdef __KERNEL__ Just don't add this file to include/linux/Kbuild and remove __KERNEL__ ifdef. > --- linux-2.6-lttng.orig/include/linux/module.h > +++ linux-2.6-lttng/include/linux/module.h > @@ -356,6 +356,9 @@ > /* The command line arguments (may be mangled). People like > keeping pointers to this stuff */ > char *args; > + > + const struct __mark_marker *markers; > + unsigned int num_markers; #ifdef CONFIG_MARKERS, please. > --- linux-2.6-lttng.orig/kernel/module.c > +++ linux-2.6-lttng/kernel/module.c > @@ -1659,6 +1884,9 @@ > unsigned int unusedcrcindex; > unsigned int unusedgplindex; > unsigned int unusedgplcrcindex; > + unsigned int markersindex; > + unsigned int markersdataindex; > + unsigned int markersstringsindex; Bunch of underscores wouldn't hurt. > +void list_modules(void) > +{ > + /* Enumerate loaded modules */ > + struct list_head*i; > + struct module *mod; > + unsigned long refcount = 0; > + > + mutex_lock(_mutex); > + list_for_each(i, ) { > + mod = list_entry(i, struct module, list); > +#ifdef CONFIG_MODULE_UNLOAD > + refcount = local_read(>ref[0].count); ^ Buy second CPU, already. ;-) > +#endif //CONFIG_MODULE_UNLOAD > + trace_mark(list_module, "%s %d %lu", > + mod->name, mod->state, refcount); > + } > + mutex_unlock(_mutex); > +} - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 02/10] Linux Kernel Markers, architecture independent code.
[EMAIL PROTECTED]: marker exports must be EXPORT_SYMBOL_GPL] Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]> Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]> Signed-off-by: Andrew Morton <[EMAIL PROTECTED]> --- include/asm-generic/vmlinux.lds.h | 13 + include/linux/marker.h| 124 + include/linux/module.h|4 kernel/module.c | 273 ++ 4 files changed, 414 insertions(+) Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h === --- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h 2007-05-09 18:14:52.0 -0400 +++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h 2007-05-09 18:15:55.0 -0400 @@ -121,6 +121,19 @@ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ *(__ksymtab_strings)\ } \ + /* Kernel markers : pointers */ \ + .markers : AT(ADDR(.markers) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___markers) = .; \ + *(.markers) \ + VMLINUX_SYMBOL(__stop___markers) = .; \ + } \ + .markers.c : AT(ADDR(.markers.c) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___markers_c) = .;\ + *(.markers.c) \ + VMLINUX_SYMBOL(__stop___markers_c) = .; \ + } \ + __end_rodata = .; \ + . = ALIGN(4096);\ \ /* Built-in module parameters. */ \ __param : AT(ADDR(__param) - LOAD_OFFSET) { \ Index: linux-2.6-lttng/include/linux/marker.h === --- /dev/null 1970-01-01 00:00:00.0 + +++ linux-2.6-lttng/include/linux/marker.h 2007-05-09 18:15:55.0 -0400 @@ -0,0 +1,124 @@ +#ifndef _LINUX_MARKER_H +#define _LINUX_MARKER_H + +/* + * marker.h + * + * Code markup for dynamic and static tracing. + * + * See Documentation/marker.txt. + * + * (C) Copyright 2006 Mathieu Desnoyers <[EMAIL PROTECTED]> + * + * This file is released under the GPLv2. + * See the file COPYING for more details. + */ + +#ifdef __KERNEL__ + +struct __mark_marker_data; + +typedef void marker_probe_func(const struct __mark_marker_data *mdata, + const char *fmt, ...); + +struct __mark_marker_data { + const char *name; + const char *format; + const char *args; + int flags; + marker_probe_func *call; + void *pdata; +} __attribute__((packed)); + +struct __mark_marker { + struct __mark_marker_data *mdata; + void *enable; +} __attribute__((packed)); + +#ifdef CONFIG_MARKERS + +/* Marker flags : selects the mechanism used to connect the probes to the + * markers and what can be executed within the probes. This is primarily + * used at reentrancy-unfriendly sites. */ +#define MF_OPTIMIZED (1 << 0)/* Use optimized markers */ +#define MF_LOCKDEP (1 << 1)/* Can call lockdep */ +#define MF_PRINTK (1 << 2)/* vprintk can be called in the probe */ +#define _MF_NR 3 /* Number of marker flags */ + +/* Generic marker flavor always available */ +#define trace_mark_generic(flags, name, format, args...) \ + do { \ + static const char __mstrtab_name_##name[] \ + __attribute__((section("__markers_strings"))) \ + = #name; \ + static const char __mstrtab_format_##name[] \ + __attribute__((section("__markers_strings"))) \ + = format; \ + static const char __mstrtab_args_##name[] \ + __attribute__((section("__markers_strings"))) \ + = #args; \ + static struct __mark_marker_data __mark_data_##name \ + __attribute__((section("__markers_data"))) = \ + { __mstrtab_name_##name, __mstrtab_format_##name, \ + __mstrtab_args_##name, \ + (flags) & ~MF_OPTIMIZED, __mark_empty_function, NULL }; \ + static char __marker_enable_##name = 0; \ + static const struct __mark_marker __mark_##name \ + __attribute__((section("__markers"))) = \ + { &__mark_data_##name, &__marker_enable_##name } ; \ + asm
[patch 02/10] Linux Kernel Markers, architecture independent code.
[EMAIL PROTECTED]: marker exports must be EXPORT_SYMBOL_GPL] Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED] Signed-off-by: Adrian Bunk [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] --- include/asm-generic/vmlinux.lds.h | 13 + include/linux/marker.h| 124 + include/linux/module.h|4 kernel/module.c | 273 ++ 4 files changed, 414 insertions(+) Index: linux-2.6-lttng/include/asm-generic/vmlinux.lds.h === --- linux-2.6-lttng.orig/include/asm-generic/vmlinux.lds.h 2007-05-09 18:14:52.0 -0400 +++ linux-2.6-lttng/include/asm-generic/vmlinux.lds.h 2007-05-09 18:15:55.0 -0400 @@ -121,6 +121,19 @@ __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ *(__ksymtab_strings)\ } \ + /* Kernel markers : pointers */ \ + .markers : AT(ADDR(.markers) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___markers) = .; \ + *(.markers) \ + VMLINUX_SYMBOL(__stop___markers) = .; \ + } \ + .markers.c : AT(ADDR(.markers.c) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__start___markers_c) = .;\ + *(.markers.c) \ + VMLINUX_SYMBOL(__stop___markers_c) = .; \ + } \ + __end_rodata = .; \ + . = ALIGN(4096);\ \ /* Built-in module parameters. */ \ __param : AT(ADDR(__param) - LOAD_OFFSET) { \ Index: linux-2.6-lttng/include/linux/marker.h === --- /dev/null 1970-01-01 00:00:00.0 + +++ linux-2.6-lttng/include/linux/marker.h 2007-05-09 18:15:55.0 -0400 @@ -0,0 +1,124 @@ +#ifndef _LINUX_MARKER_H +#define _LINUX_MARKER_H + +/* + * marker.h + * + * Code markup for dynamic and static tracing. + * + * See Documentation/marker.txt. + * + * (C) Copyright 2006 Mathieu Desnoyers [EMAIL PROTECTED] + * + * This file is released under the GPLv2. + * See the file COPYING for more details. + */ + +#ifdef __KERNEL__ + +struct __mark_marker_data; + +typedef void marker_probe_func(const struct __mark_marker_data *mdata, + const char *fmt, ...); + +struct __mark_marker_data { + const char *name; + const char *format; + const char *args; + int flags; + marker_probe_func *call; + void *pdata; +} __attribute__((packed)); + +struct __mark_marker { + struct __mark_marker_data *mdata; + void *enable; +} __attribute__((packed)); + +#ifdef CONFIG_MARKERS + +/* Marker flags : selects the mechanism used to connect the probes to the + * markers and what can be executed within the probes. This is primarily + * used at reentrancy-unfriendly sites. */ +#define MF_OPTIMIZED (1 0)/* Use optimized markers */ +#define MF_LOCKDEP (1 1)/* Can call lockdep */ +#define MF_PRINTK (1 2)/* vprintk can be called in the probe */ +#define _MF_NR 3 /* Number of marker flags */ + +/* Generic marker flavor always available */ +#define trace_mark_generic(flags, name, format, args...) \ + do { \ + static const char __mstrtab_name_##name[] \ + __attribute__((section(__markers_strings))) \ + = #name; \ + static const char __mstrtab_format_##name[] \ + __attribute__((section(__markers_strings))) \ + = format; \ + static const char __mstrtab_args_##name[] \ + __attribute__((section(__markers_strings))) \ + = #args; \ + static struct __mark_marker_data __mark_data_##name \ + __attribute__((section(__markers_data))) = \ + { __mstrtab_name_##name, __mstrtab_format_##name, \ + __mstrtab_args_##name, \ + (flags) ~MF_OPTIMIZED, __mark_empty_function, NULL }; \ + static char __marker_enable_##name = 0; \ + static const struct __mark_marker __mark_##name \ + __attribute__((section(__markers))) = \ + { __mark_data_##name, __marker_enable_##name } ; \ + asm volatile ( : : i
Re: [patch 02/10] Linux Kernel Markers, architecture independent code.
On Wed, May 09, 2007 at 09:55:57PM -0400, Mathieu Desnoyers wrote: --- /dev/null +++ linux-2.6-lttng/include/linux/marker.h @@ -0,0 +1,124 @@ +#ifdef __KERNEL__ Just don't add this file to include/linux/Kbuild and remove __KERNEL__ ifdef. --- linux-2.6-lttng.orig/include/linux/module.h +++ linux-2.6-lttng/include/linux/module.h @@ -356,6 +356,9 @@ /* The command line arguments (may be mangled). People like keeping pointers to this stuff */ char *args; + + const struct __mark_marker *markers; + unsigned int num_markers; #ifdef CONFIG_MARKERS, please. --- linux-2.6-lttng.orig/kernel/module.c +++ linux-2.6-lttng/kernel/module.c @@ -1659,6 +1884,9 @@ unsigned int unusedcrcindex; unsigned int unusedgplindex; unsigned int unusedgplcrcindex; + unsigned int markersindex; + unsigned int markersdataindex; + unsigned int markersstringsindex; Bunch of underscores wouldn't hurt. +void list_modules(void) +{ + /* Enumerate loaded modules */ + struct list_head*i; + struct module *mod; + unsigned long refcount = 0; + + mutex_lock(module_mutex); + list_for_each(i, modules) { + mod = list_entry(i, struct module, list); +#ifdef CONFIG_MODULE_UNLOAD + refcount = local_read(mod-ref[0].count); ^ Buy second CPU, already. ;-) +#endif //CONFIG_MODULE_UNLOAD + trace_mark(list_module, %s %d %lu, + mod-name, mod-state, refcount); + } + mutex_unlock(module_mutex); +} - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/