userspace markers initial code
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 3 Feb 2008 16:07:08 +0000 (16:07 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 3 Feb 2008 16:07:08 +0000 (16:07 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2810 04897980-b3bd-0310-b5e0-8ef037075253

genevent/genevent.c
markers-userspace/Makefile [new file with mode: 0644]
markers-userspace/elf_i386.x [new file with mode: 0644]
markers-userspace/kernel-api.h [new file with mode: 0644]
markers-userspace/marker-lib.c [new file with mode: 0644]
markers-userspace/marker.h [new file with mode: 0644]
markers-userspace/testprog.c [new file with mode: 0644]
scripts/git-diff
scripts/lttng-6-split-script.sh
tests/kernel/Makefile

index 799be7be3fa1192c2fa982d3b15e348faa915cfe..fd7b2b73900e73f9f088ebb8ab9fab5f3f2acca6 100644 (file)
@@ -1475,8 +1475,6 @@ int print_event_logging_function(char *basename, facility_t *fac,
                print_tabs(1, fd);
        }
        fprintf(fd, "u64 tsc;\n");
-       print_tabs(1, fd);
-       fprintf(fd, "size_t before_hdr_pad, after_hdr_pad, header_size;\n");
        fprintf(fd, "\n");
        
        if(!event->force) {
@@ -1579,9 +1577,7 @@ int print_event_logging_function(char *basename, facility_t *fac,
        print_tabs(2, fd);
        fprintf(fd, "buffer = ltt_reserve_slot(trace, channel, &transport_data,\n");
        print_tabs(3, fd);
-       fprintf(fd, "reserve_size, &slot_size, &tsc,\n");
-       print_tabs(3, fd);
-       fprintf(fd, "&before_hdr_pad, &after_hdr_pad, &header_size);\n");
+       fprintf(fd, "reserve_size, &slot_size, &tsc);\n");
        /* If error, return */
        print_tabs(2, fd);
        fprintf(fd, "if (!buffer)\n");
@@ -1597,15 +1593,15 @@ int print_event_logging_function(char *basename, facility_t *fac,
        /* Write event header */
        if(strcmp("compact", fac->name) != 0) {
                print_tabs(2, fd);
-               fprintf(fd, "ltt_write_event_header(trace, channel, buffer,\n");
+               fprintf(fd, "buffer = ltt_write_event_header(trace, channel, buffer,\n");
                print_tabs(3, fd);
                fprintf(fd, "ltt_facility_%s_%X, event_%s_%s,\n", fac->name, fac->checksum,
                                                                                fac->name, event->name);
                print_tabs(3, fd);
-               fprintf(fd, "reserve_size, before_hdr_pad, tsc);\n");
+               fprintf(fd, "reserve_size, tsc);\n");
        } else {
                print_tabs(2, fd);
-               fprintf(fd, "ltt_write_compact_header(trace, channel, buffer,\n");
+               fprintf(fd, "buffer = ltt_write_compact_header(trace, channel, buffer,\n");
                print_tabs(3, fd);
                fprintf(fd, "ltt_facility_%s_%X, event_%s_%s,\n", fac->name, fac->checksum,
                                                                                fac->name, event->name);
@@ -1613,14 +1609,11 @@ int print_event_logging_function(char *basename, facility_t *fac,
                if(event->compact_data) {
                        assert(event->fields.position > 0);
                        field_t *field = (field_t*)(event->fields.array[0]);
-                       fprintf(fd, "reserve_size, before_hdr_pad, tsc, lttng_param_%s);\n",
+                       fprintf(fd, "reserve_size, tsc, lttng_param_%s);\n",
                                field->name);
                } else
-                       fprintf(fd, "reserve_size, before_hdr_pad, tsc, 0);\n");
+                       fprintf(fd, "reserve_size, tsc, 0);\n");
        }
-       print_tabs(2, fd);
-       fprintf(fd, "*to_base += before_hdr_pad + after_hdr_pad + header_size;\n");
-       fprintf(fd, "\n");
        
        /* write data. */
 
@@ -2024,8 +2017,6 @@ int print_event_logging_function_user_fast(char *basename, facility_t *fac,
        }
        fprintf(fd, "uint64_t tsc;\n");
        print_tabs(1, fd);
-       fprintf(fd, "size_t before_hdr_pad, after_hdr_pad, header_size;\n");
-       fprintf(fd, "\n");
        
        print_tabs(1, fd);
        fprintf(fd, "if (!trace) {\n");
@@ -2111,9 +2102,7 @@ int print_event_logging_function_user_fast(char *basename, facility_t *fac,
        print_tabs(2, fd);
        fprintf(fd, "buffer = ltt_reserve_slot(trace, ltt_buf,\n");
        print_tabs(3, fd);
-       fprintf(fd, "reserve_size, &slot_size, &tsc,\n");
-       print_tabs(3, fd);
-       fprintf(fd, "&before_hdr_pad, &after_hdr_pad, &header_size);\n");
+       fprintf(fd, "reserve_size, &slot_size, &tsc);\n");
        /* If error, return */
        print_tabs(2, fd);
        fprintf(fd, "if (!buffer)\n");
@@ -2128,15 +2117,12 @@ int print_event_logging_function_user_fast(char *basename, facility_t *fac,
 
        /* Write event header */
        print_tabs(2, fd);
-       fprintf(fd, "ltt_write_event_header(trace, ltt_buf, buffer,\n");
+       fprintf(fd, "buffer = ltt_write_event_header(trace, ltt_buf, buffer,\n");
        print_tabs(3, fd);
        fprintf(fd, "ltt_facility_%s_%X, event_%s_%s,\n", fac->name, fac->checksum,
                                                                        fac->name, event->name);
        print_tabs(3, fd);
-       fprintf(fd, "reserve_size, before_hdr_pad, tsc);\n");
-       print_tabs(2, fd);
-       fprintf(fd, "*to_base += before_hdr_pad + after_hdr_pad + header_size;\n");
-       fprintf(fd, "\n");
+       fprintf(fd, "reserve_size, tsc);\n");
        
        /* write data. */
 
@@ -2560,6 +2546,8 @@ int print_loader_header(facility_t *fac)
   fprintf(fd,"ltt_facility_t\tltt_facility_%s;\n", fac->name);
   fprintf(fd,"ltt_facility_t\tltt_facility_%s_%X;\n\n",
                        fac->name, fac->checksum);
+  fprintf(fd,"extern unsigned int ltt_get_channel_index_%s(u8 eID);\n\n",
+                       fac->name);
 
   fprintf(fd,"#define LTT_FACILITY_SYMBOL\t\tltt_facility_%s\n",
       fac->name);
@@ -2571,6 +2559,8 @@ int print_loader_header(facility_t *fac)
                        fac->name);
   fprintf(fd,"#define LTT_FACILITY_ALIGNMENT\t\t%u\n\n",
                        fac->align);
+  fprintf(fd,"#define LTT_FACILITY_SELECT\t\tltt_get_channel_index_%s\n\n",
+                       fac->name);
   fprintf(fd, "#endif //CONFIG_LTT\n\n");
   fprintf(fd, "#endif //_LTT_FACILITY_LOADER_%s_H_\n", fac->capname);
 
@@ -2717,6 +2707,7 @@ int print_loader_c(facility_t *fac)
   fprintf(fd, "\t.checksum = LTT_FACILITY_CHECKSUM,\n");
   fprintf(fd, "\t.symbol = SYMBOL_STRING(LTT_FACILITY_SYMBOL),\n");
   fprintf(fd, "\t.alignment = LTT_FACILITY_ALIGNMENT,\n");
+  fprintf(fd, "\t.select = LTT_FACILITY_SELECT,\n");
   fprintf(fd, "};\n");
   fprintf(fd, "\n");
   fprintf(fd, "static int __init facility_init(void)\n");
diff --git a/markers-userspace/Makefile b/markers-userspace/Makefile
new file mode 100644 (file)
index 0000000..1a32a8a
--- /dev/null
@@ -0,0 +1,18 @@
+
+CC=gcc
+
+all: testprog testprog.S
+
+marker-lib.o: marker-lib.c marker.h
+       $(CC) -O2 -DCONFIG_MARKERS -c -o $@ marker-lib.c
+
+testprog: testprog.c marker.h marker-lib.o
+       $(CC) -O2 -DCONFIG_MARKERS -o $@ testprog.c marker-lib.o
+
+testprog.S: testprog.c marker.h
+       $(CC) -O2 -DCONFIG_MARKERS -S -o $@ testprog.c
+
+.PHONY: clean
+
+clean:
+       rm -f testprog testprog.S
diff --git a/markers-userspace/elf_i386.x b/markers-userspace/elf_i386.x
new file mode 100644 (file)
index 0000000..d30dd55
--- /dev/null
@@ -0,0 +1,197 @@
+/* Default linker script, for normal executables */
+OUTPUT_FORMAT("elf32-i386", "elf32-i386",
+             "elf32-i386")
+OUTPUT_ARCH(i386)
+ENTRY(_start)
+SEARCH_DIR("/usr/i486-linux-gnu/lib32"); SEARCH_DIR("/usr/local/lib32"); SEARCH_DIR("/lib32"); SEARCH_DIR("/usr/lib32"); SEARCH_DIR("/usr/i486-linux-gnu/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
+  .interp         : { *(.interp) }
+  .note.gnu.build-id : { *(.note.gnu.build-id) }
+  .hash           : { *(.hash) }
+  .gnu.hash       : { *(.gnu.hash) }
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .gnu.version    : { *(.gnu.version) }
+  .gnu.version_d  : { *(.gnu.version_d) }
+  .gnu.version_r  : { *(.gnu.version_r) }
+  .rel.init       : { *(.rel.init) }
+  .rela.init      : { *(.rela.init) }
+  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
+  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
+  .rel.fini       : { *(.rel.fini) }
+  .rela.fini      : { *(.rela.fini) }
+  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
+  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
+  .rel.data.rel.ro   : { *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) }
+  .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
+  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
+  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
+  .rel.tdata     : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
+  .rela.tdata    : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
+  .rel.tbss      : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
+  .rela.tbss     : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
+  .rel.ctors      : { *(.rel.ctors) }
+  .rela.ctors     : { *(.rela.ctors) }
+  .rel.dtors      : { *(.rel.dtors) }
+  .rela.dtors     : { *(.rela.dtors) }
+  .rel.got        : { *(.rel.got) }
+  .rela.got       : { *(.rela.got) }
+  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
+  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
+  .rel.plt        : { *(.rel.plt) }
+  .rela.plt       : { *(.rela.plt) }
+  .init           :
+  {
+    KEEP (*(.init))
+  } =0x90909090
+  .plt            : { *(.plt) }
+  .text           :
+  {
+    *(.text .stub .text.* .gnu.linkonce.t.*)
+    KEEP (*(.text.*personality*))
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+  } =0x90909090
+  .fini           :
+  {
+    KEEP (*(.fini))
+  } =0x90909090
+  PROVIDE (__etext = .);
+  PROVIDE (_etext = .);
+  PROVIDE (etext = .);
+  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+  .rodata1        : { *(.rodata1) }
+  .eh_frame_hdr : { *(.eh_frame_hdr) }
+  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
+  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
+  /* Adjust the address for the data segment.  We want to adjust up to
+     the same address within the page on the next page up.  */
+  . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
+  /* Exception handling  */
+  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
+  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
+  /* Thread Local Storage sections  */
+  .tdata         : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+  .tbss                  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
+  .preinit_array     :
+  {
+    PROVIDE_HIDDEN (__preinit_array_start = .);
+    KEEP (*(.preinit_array))
+    PROVIDE_HIDDEN (__preinit_array_end = .);
+  }
+  .init_array     :
+  {
+     PROVIDE_HIDDEN (__init_array_start = .);
+     KEEP (*(SORT(.init_array.*)))
+     KEEP (*(.init_array))
+     PROVIDE_HIDDEN (__init_array_end = .);
+  }
+  .fini_array     :
+  {
+    PROVIDE_HIDDEN (__fini_array_start = .);
+    KEEP (*(.fini_array))
+    KEEP (*(SORT(.fini_array.*)))
+    PROVIDE_HIDDEN (__fini_array_end = .);
+  }
+  .ctors          :
+  {
+    /* gcc uses crtbegin.o to find the start of
+       the constructors, so we make sure it is
+       first.  Because this is a wildcard, it
+       doesn't matter if the user does not
+       actually link against crtbegin.o; the
+       linker won't look for a file to match a
+       wildcard.  The wildcard also means that it
+       doesn't matter which directory crtbegin.o
+       is in.  */
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*crtbegin?.o(.ctors))
+    /* We don't want to include the .ctor section from
+       the crtend.o file until after the sorted ctors.
+       The .ctor section from the crtend file contains the
+       end of ctors marker and it must be last */
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+  }
+  .dtors          :
+  {
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+  }
+  .jcr            : { KEEP (*(.jcr)) }
+  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
+  .dynamic        : { *(.dynamic) }
+  .got            : { *(.got) }
+  . = DATA_SEGMENT_RELRO_END (12, .);
+  .got.plt        : { *(.got.plt) }
+  .data           :
+  {
+    *(.data .data.* .gnu.linkonce.d.*)
+    KEEP (*(.gnu.linkonce.d.*personality*))
+    SORT(CONSTRUCTORS)
+  }
+  .data1          : { *(.data1) }
+  _edata = .; PROVIDE (edata = .);
+  __bss_start = .;
+  .bss            :
+  {
+   *(.dynbss)
+   *(.bss .bss.* .gnu.linkonce.b.*)
+   *(COMMON)
+   /* Align here to ensure that the .bss section occupies space up to
+      _end.  Align after .bss to ensure correct alignment even if the
+      .bss section disappears because there are no input sections.
+      FIXME: Why do we need it? When there is no .bss section, we don't
+      pad the .data section.  */
+   . = ALIGN(. != 0 ? 32 / 8 : 1);
+  }
+  . = ALIGN(32 / 8);
+  . = ALIGN(32 / 8);
+  _end = .; PROVIDE (end = .);
+  . = DATA_SEGMENT_END (.);
+  /* Stabs debugging sections.  */
+  .stab          0 : { *(.stab) }
+  .stabstr       0 : { *(.stabstr) }
+  .stab.excl     0 : { *(.stab.excl) }
+  .stab.exclstr  0 : { *(.stab.exclstr) }
+  .stab.index    0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment       0 : { *(.comment) }
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
+  /* DWARF 3 */
+  .debug_pubtypes 0 : { *(.debug_pubtypes) }
+  .debug_ranges   0 : { *(.debug_ranges) }
+  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
+}
diff --git a/markers-userspace/kernel-api.h b/markers-userspace/kernel-api.h
new file mode 100644 (file)
index 0000000..ccdc2dc
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Kernel API extracted from Linux kernel headers.
+ */
+
+#ifndef __KERNEL_API
+#define __KERNEL_API
+
+#define DECLARE_IMV(type, name) extern __typeof__(type) name##__imv
+#define DEFINE_IMV(type, name)  __typeof__(type) name##__imv
+
+#define likely(x)      __builtin_expect(!!(x), 1)
+#define unlikely(x)    __builtin_expect(!!(x), 0)
+
+/**
+ * imv_read - read immediate variable
+ * @name: immediate value name
+ *
+ * Reads the value of @name.
+ */
+#define imv_read(name)                 _imv_read(name)
+
+/**
+ * _imv_read - Read immediate value with standard memory load.
+ * @name: immediate value name
+ *
+ * Force a data read of the immediate value instead of the immediate value
+ * based mechanism. Useful for __init and __exit section data read.
+ */
+#define _imv_read(name)                (name##__imv)
+
+#endif
diff --git a/markers-userspace/marker-lib.c b/markers-userspace/marker-lib.c
new file mode 100644 (file)
index 0000000..da5bcaa
--- /dev/null
@@ -0,0 +1,34 @@
+
+#include "marker.h"
+
+/**
+ * __mark_empty_function - Empty probe callback
+ * @probe_private: probe private data
+ * @call_private: call site private data
+ * @fmt: format string
+ * @...: variable argument list
+ *
+ * Empty callback provided as a probe to the markers. By providing this to a
+ * disabled marker, we make sure the  execution flow is always valid even
+ * though the function pointer change and the marker enabling are two distinct
+ * operations that modifies the execution flow of preemptible code.
+ */
+void __mark_empty_function(void *probe_private, void *call_private,
+       const char *fmt, va_list *args)
+{
+}
+
+/*
+ * marker_probe_cb Callback that prepares the variable argument list for probes.
+ * @mdata: pointer of type struct marker
+ * @call_private: caller site private data
+ * @fmt: format string
+ * @...:  Variable argument list.
+ *
+ */
+void marker_probe_cb(const struct marker *mdata, void *call_private,
+       const char *fmt, ...)
+{
+
+
+}
diff --git a/markers-userspace/marker.h b/markers-userspace/marker.h
new file mode 100644 (file)
index 0000000..06192c8
--- /dev/null
@@ -0,0 +1,178 @@
+#ifndef _LINUX_MARKER_H
+#define _LINUX_MARKER_H
+
+/*
+ * Code markup for dynamic and static tracing.
+ *
+ * See Documentation/marker.txt.
+ *
+ * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * This file is released under the GPLv2.
+ * See the file COPYING for more details.
+ */
+
+//#include <linux/immediate.h>
+//#include <linux/types.h>
+
+#include "kernel-api.h"
+#include <stdint.h>
+#include <stdarg.h>
+
+struct module;
+struct marker;
+
+/**
+ * marker_probe_func - Type of a marker probe function
+ * @probe_private: probe private data
+ * @call_private: call site private data
+ * @fmt: format string
+ * @args: variable argument list pointer. Use a pointer to overcome C's
+ *        inability to pass this around as a pointer in a portable manner in
+ *        the callee otherwise.
+ *
+ * Type of marker probe functions. They receive the mdata and need to parse the
+ * format string to recover the variable argument list.
+ */
+typedef void marker_probe_func(void *probe_private, void *call_private,
+               const char *fmt, va_list *args);
+
+struct marker_probe_closure {
+       marker_probe_func *func;        /* Callback */
+       void *probe_private;            /* Private probe data */
+};
+
+struct marker {
+       const char *name;       /* Marker name */
+       const char *format;     /* Marker format string, describing the
+                                * variable argument list.
+                                */
+       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, ...);
+       struct marker_probe_closure single;
+       struct marker_probe_closure *multi;
+} __attribute__((aligned(8)));
+
+#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(generic, name, call_private, format, args...)     \
+       do {                                                            \
+               static const char __mstrtab_##name[]                    \
+               __attribute__((section("__markers_strings")))           \
+               = #name "\0" format;                                    \
+               static struct marker __mark_##name                      \
+               __attribute__((section("__markers"), aligned(8))) =     \
+               { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)],   \
+               0, 0, marker_probe_cb,                                  \
+               { __mark_empty_function, NULL}, NULL };                 \
+               __mark_check_format(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(generic, name, call_private, format, args...) \
+               __mark_check_format(format, ## args)
+static inline void marker_update_probe_range(struct marker *begin,
+       struct marker *end)
+{ }
+#endif /* CONFIG_MARKERS */
+
+/**
+ * trace_mark - Marker using code patching
+ * @name: marker name, not quoted.
+ * @format: format string
+ * @args...: variable argument list
+ *
+ * Places a marker using optimized code patching technique (imv_read())
+ * to be enabled.
+ */
+#define trace_mark(name, 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.
+ */
+#define MARK_NOARGS " "
+
+/* To be used for string format validity checking with gcc */
+static inline void __attribute__((format (printf, 1, 2)))
+__mark_check_format(const char *fmt, ...)
+{
+}
+
+extern marker_probe_func __mark_empty_function;
+
+extern void marker_probe_cb(const struct marker *mdata,
+       void *call_private, const char *fmt, ...);
+extern void marker_probe_cb_noarg(const struct marker *mdata,
+       void *call_private, const char *fmt, ...);
+
+/*
+ * Connect a probe to a marker.
+ * private data pointer must be a valid allocated memory address, or NULL.
+ */
+extern int marker_probe_register(const char *name, const char *format,
+                               marker_probe_func *probe, void *probe_private);
+
+/*
+ * Returns the private data given to marker_probe_register.
+ */
+extern int marker_probe_unregister(const char *name,
+       marker_probe_func *probe, void *probe_private);
+/*
+ * Unregister a marker by providing the registered private data.
+ */
+extern int marker_probe_unregister_private_data(marker_probe_func *probe,
+       void *probe_private);
+
+extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
+       int num);
+
+struct marker_iter {
+       struct module *module;
+       struct marker *marker;
+};
+
+extern void marker_iter_start(struct marker_iter *iter);
+extern void marker_iter_next(struct marker_iter *iter);
+extern void marker_iter_stop(struct marker_iter *iter);
+extern void marker_iter_reset(struct marker_iter *iter);
+extern int marker_get_iter_range(struct marker **marker, struct marker *begin,
+       struct marker *end);
+
+#endif
diff --git a/markers-userspace/testprog.c b/markers-userspace/testprog.c
new file mode 100644 (file)
index 0000000..037e1c1
--- /dev/null
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "marker.h"
+
+int main(int argc, char **argv)
+{
+       void *ptr;
+       unsigned long val;
+
+       trace_mark(test_marker, "ptr %p val %lu", ptr, val);
+       return 0;
+}
index 89ecb6faf06271cfa427405d950a2c38ef47af1e..5e7e14b613d682e21c25fdfe6efab82cff769e15 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-git-diff-tree -p -r v2.6.20 lttng-$1-for-v2.6.20 > ../patch-2.6.20-lttng-$1-all.diff
+git-diff-tree -p -r v2.6.21-rc6-mm1-2 lttng-$1-for-v2.6.21-rc6-mm1 > ../patch-2.6.21-rc6-mm1-lttng-$1-all.diff
index 223269f7974b4785fe3628becdc334071c02f1df..034fe749ba64e95953ec6230793d74e2c5a42d45 100755 (executable)
@@ -12,7 +12,7 @@ function wr () {
 
 
 PRENAME=patch
-NAME=-2.6.20-lttng-$1
+NAME=-2.6.21-rc6-mm1-lttng-$1
 ALL_NAME=${PRENAME}${NAME}-all.diff
 VALUE=1
 printf -v COUNT "%02d" ${VALUE}
@@ -607,8 +607,7 @@ FILE=../${PRENAME}${COUNT}${NAME}-timestamp.diff
 VALUE=$(( ${VALUE} + 1 ))
 printf -v COUNT "%02d" ${VALUE}
 
-IN="?_ltt_ltt-test-tsc.c
-?_include_asm-alpha_ltt.h
+IN="?_include_asm-alpha_ltt.h
 ?_include_asm-arm_ltt.h
 ?_include_asm-arm26_ltt.h
 ?_include_asm-cris_ltt.h
index 6c840fee538883e5488dad9709a1617adfa43ab5..7e01551c6393d131fa022994408a694c4979eff8 100644 (file)
@@ -12,9 +12,12 @@ ifneq ($(CONFIG_LTT),)
        #obj-m += ltt-probe-tests.o
        #obj-m += test-time-probe3.o
 endif
-       obj-m += test-slub.o
-       obj-m += test-slub2.o
-       obj-m += test-showval.o
+       obj-m += test-sys_call.o
+#      obj-m += test-bug.o
+       obj-m += test-mark-speed.o
+       #obj-m += test-slub.o
+       #obj-m += test-slub2.o
+       #obj-m += test-showval.o
        #obj-m += cond_call.o
        #obj-m += cond_call2.o
 #      obj-m += test-irq-latency.o
@@ -41,8 +44,8 @@ endif
        #obj-m += test-ser.o
 #      obj-m += test-cmpxchg.o
 #      obj-m += test-cmpxchg-nolock.o
-       obj-m += test-cmpxchg-nolock2.o
-       obj-m += test-cmpxchg8b.o
+       #obj-m += test-cmpxchg-nolock2.o
+       #obj-m += test-cmpxchg8b.o
 #      obj-m += test-spinlock.o
 #      obj-m += test-inc.o
 #      obj-m += test-inc-nolock.o
This page took 0.033588 seconds and 4 git commands to generate.