irq test
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 9 Nov 2006 17:37:02 +0000 (17:37 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 9 Nov 2006 17:37:02 +0000 (17:37 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2247 04897980-b3bd-0310-b5e0-8ef037075253

tests/kernel/Makefile
tests/kernel/ltt-facility-id-tests.h
tests/kernel/ltt-facility-loader-tests.c
tests/kernel/ltt-facility-loader-tests.h
tests/kernel/ltt-facility-tests.h
tests/kernel/test-cmpxchg-nolock.c

index b928b684dea0c8806a605b102a020aa67cf11e80..3cba56ad6be88d58ac58628c1f7e8b3fa9307f1e 100644 (file)
@@ -1,15 +1,15 @@
 ifneq ($(KERNELRELEASE),)
 ifneq ($(CONFIG_LTT),)
-#      obj-m += ltt-facility-loader-tests.o
+       obj-m += ltt-facility-loader-tests.o
 #      obj-m += test-time-probe.o 
-#      obj-m += test-time-probe2.o 
+       obj-m += test-time-probe2.o 
 #      obj-m += test-instrument-size-small.o
 #      obj-m += test-instrument-size-med.o
 #      obj-m += test-instrument-size-big.o
 #      obj-m += test-printk-effect.o
 endif
-#      obj-m += test-cmpxchg.o
-#      obj-m += test-cmpxchg-nolock.o
+       obj-m += test-cmpxchg.o
+       obj-m += test-cmpxchg-nolock.o
 #      obj-m += test-spinlock.o
 #      obj-m += test-inc.o
 #      obj-m += test-inc-nolock.o
@@ -21,6 +21,7 @@ endif
        #obj-m += test-debugfs.o
        obj-m += test-mark.o
        obj-m += probe.o
+       obj-m += test-irqloop.o
        #obj-m += marker-loader.o
        #obj-m += test-linuxtrace.o
 
index ba1074423f38ee599dfec1e8f62c80dee373de71..651b06c4d48928c22084dc62a05d8ef0b91b1040 100644 (file)
@@ -6,7 +6,7 @@
 
 /****  facility handle  ****/
 
-extern ltt_facility_t ltt_facility_tests_2F06D8DB;
+extern ltt_facility_t ltt_facility_tests_CA7F1536;
 extern ltt_facility_t ltt_facility_tests;
 
 
@@ -14,8 +14,6 @@ extern ltt_facility_t ltt_facility_tests;
 
 enum tests_event {
        event_tests_write_4bytes,
-       event_tests_write_string,
-       event_tests_write_struct,
        facility_tests_num_events
 };
 
index 3a232c7f953773df6ec44a614278242f2ac99255..218d623a207162f9d539c6c48d9631dad7a1ffac 100644 (file)
@@ -51,7 +51,7 @@ static void __exit facility_exit(void)
        int err;
 
        err = ltt_facility_unregister(LTT_FACILITY_SYMBOL);
-       if(err != 0)
+       if (err != 0)
                printk(KERN_ERR "LTT : Error in unregistering facility.\n");
 
 }
index bf161480fc627e7d730d114b3327c24dce98aaa2..a70e7c3d7eda11aa0b31f76e4b5b8c500b84eac5 100644 (file)
@@ -7,13 +7,13 @@
 #include "ltt-facility-id-tests.h"
 
 ltt_facility_t ltt_facility_tests;
-ltt_facility_t ltt_facility_tests_2F06D8DB;
+ltt_facility_t ltt_facility_tests_CA7F1536;
 
-#define LTT_FACILITY_SYMBOL                                                    ltt_facility_tests
-#define LTT_FACILITY_CHECKSUM_SYMBOL           ltt_facility_tests_2F06D8DB
-#define LTT_FACILITY_CHECKSUM                                          0x2F06D8DB
-#define LTT_FACILITY_NAME                                                              "tests"
-#define LTT_FACILITY_NUM_EVENTS                                        facility_tests_num_events
+#define LTT_FACILITY_SYMBOL            ltt_facility_tests
+#define LTT_FACILITY_CHECKSUM_SYMBOL   ltt_facility_tests_CA7F1536
+#define LTT_FACILITY_CHECKSUM          0xCA7F1536
+#define LTT_FACILITY_NAME              "tests"
+#define LTT_FACILITY_NUM_EVENTS        facility_tests_num_events
 
 #endif //CONFIG_LTT
 
index a0aa42e1b31f6dcebed9b53c3d02ae2d8626a274..f28b4238b4e553e47c559d7ff0b573c7779f29b1 100644 (file)
@@ -1,9 +1,12 @@
 #ifndef _LTT_FACILITY_TESTS_H_
 #define _LTT_FACILITY_TESTS_H_
 
+
 #include <linux/types.h>
 #include "ltt-facility-id-tests.h"
-#include <linux/ltt-core.h>
+#include <ltt/ltt-tracer.h>
+
+#define ltt_get_index_from_facility_tests ltt_get_index_from_facility
 
 /* Named types */
 
 
 /* Event write_4bytes logging function */
 static inline void trace_tests_write_4bytes(
-               int lttng_param_data)
-#if (!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
-{
-}
-#else
+               unsigned int lttng_param_value)
 {
        unsigned int index;
        struct ltt_channel_struct *channel;
        struct ltt_trace_struct *trace;
-       struct rchan_buf *relayfs_buf;
-       void *buffer = NULL;
+       void *transport_data;
+       char *buffer = NULL;
        size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
        size_t *to_base = &real_to_base;
        size_t real_to = 0;
@@ -31,329 +30,23 @@ static inline void trace_tests_write_4bytes(
        size_t reserve_size;
        size_t slot_size;
        size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-       u64 tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(ltt_traces.num_active_traces == 0) return;
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = &lttng_param_data;
-       align = sizeof(int);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(int);
-
-       reserve_size = *to_base + *to + *len;
-       preempt_disable();
-       ltt_nesting[smp_processor_id()]++;
-       index = ltt_get_index_from_facility(ltt_facility_tests_2F06D8DB,
-                                               event_tests_write_4bytes);
-
-       list_for_each_entry_rcu(trace, &ltt_traces.head, list) {
-               if(!trace->active) continue;
-
-               channel = ltt_get_channel_from_index(trace, index);
-               relayfs_buf = channel->rchan->buf[smp_processor_id()];
-
-               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, relayfs_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) continue; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, channel, buffer,
-                       ltt_facility_tests_2F06D8DB, event_tests_write_4bytes,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = &lttng_param_data;
-               align = sizeof(int);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(int);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(relayfs_buf, buffer, slot_size);
-
-       }
-
-       ltt_nesting[smp_processor_id()]--;
-       preempt_enable_no_resched();
-}
-#endif //(!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
-
-
-/* Event write_string structures */
-static inline void lttng_write_string_tests_write_string_data(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               const char * obj)
-{
-       size_t size;
-       size_t align;
-
-       /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
-                       memcpy(buffer+*to_base+*to, *from, *len);
-       }
-       *to += *len;
-       *len = 0;
-
-       align = sizeof(char);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, obj, size);
-       *to += size;
-
-       /* Realign the *to_base on arch size, set *to to 0 */
-       *to += ltt_align(*to, sizeof(void *));
-       *to_base = *to_base+*to;
-       *to = 0;
-
-       /* Put source *from just after the C string */
-       *from += size;
-}
-
-
-/* Event write_string logging function */
-static inline void trace_tests_write_string(
-               const char * lttng_param_data)
-#if (!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_channel_struct *channel;
-       struct ltt_trace_struct *trace;
-       struct rchan_buf *relayfs_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
+       const char *real_from;
+       const char **from = &real_from;
        u64 tsc;
        size_t before_hdr_pad, after_hdr_pad, header_size;
 
-       if(ltt_traces.num_active_traces == 0) return;
+       if (ltt_traces.num_active_traces == 0)
+               return;
 
        /* For each field, calculate the field size. */
        /* size = *to_base + *to + *len */
        /* Assume that the padding for alignment starts at a
         * sizeof(void *) address. */
 
-       *from = lttng_param_data;
-       lttng_write_string_tests_write_string_data(buffer, to_base, to, from, len, lttng_param_data);
-
-       reserve_size = *to_base + *to + *len;
-       preempt_disable();
-       ltt_nesting[smp_processor_id()]++;
-       index = ltt_get_index_from_facility(ltt_facility_tests_2F06D8DB,
-                                               event_tests_write_string);
-
-       list_for_each_entry_rcu(trace, &ltt_traces.head, list) {
-               if(!trace->active) continue;
-
-               channel = ltt_get_channel_from_index(trace, index);
-               relayfs_buf = channel->rchan->buf[smp_processor_id()];
-
-               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, relayfs_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) continue; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, channel, buffer,
-                       ltt_facility_tests_2F06D8DB, event_tests_write_string,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = lttng_param_data;
-               lttng_write_string_tests_write_string_data(buffer, to_base, to, from, len, lttng_param_data);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(relayfs_buf, buffer, slot_size);
-
-       }
-
-       ltt_nesting[smp_processor_id()]--;
-       preempt_enable_no_resched();
-}
-#endif //(!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
-
-
-/* Event write_struct structures */
-typedef struct lttng_sequence_tests_write_struct_data2_data5 lttng_sequence_tests_write_struct_data2_data5;
-struct lttng_sequence_tests_write_struct_data2_data5 {
-       unsigned int len;
-       const int64_t *array;
-};
-
-struct lttng_tests_write_struct_data2 {
-       const char * data3;
-       int data4;
-       lttng_sequence_tests_write_struct_data2_data5 data5;
-       int data6;
-} LTT_ALIGN;
-
-static inline size_t lttng_get_alignment_sequence_tests_write_struct_data2_data5(
-               lttng_sequence_tests_write_struct_data2_data5 *obj)
-{
-       size_t align=0, localign;
-       localign = sizeof(unsigned int);
-       align = max(align, localign);
-
-       localign = sizeof(int64_t);
-       align = max(align, localign);
-
-       return align;
-}
-
-static inline size_t lttng_get_alignment_struct_tests_write_struct_data2(
-               struct lttng_tests_write_struct_data2 *obj)
-{
-       size_t align=0, localign;
-       localign = sizeof(char);
-       align = max(align, localign);
-
-       localign = sizeof(int);
-       align = max(align, localign);
-
-       localign = lttng_get_alignment_sequence_tests_write_struct_data2_data5(&obj->data5);
-       align = max(align, localign);
-
-       localign = sizeof(int);
-       align = max(align, localign);
-
-       return align;
-}
-
-static inline void lttng_write_string_tests_write_struct_data2_data3(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               const char * obj)
-{
-       size_t size;
-       size_t align;
-
-       /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
-                       memcpy(buffer+*to_base+*to, *from, *len);
-       }
-       *to += *len;
-       *len = 0;
-
-       align = sizeof(char);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, obj, size);
-       *to += size;
-
-       /* Realign the *to_base on arch size, set *to to 0 */
-       *to += ltt_align(*to, sizeof(void *));
-       *to_base = *to_base+*to;
-       *to = 0;
-
-       /* Put source *from just after the C string */
-       *from += size;
-}
-
-static inline void lttng_write_sequence_tests_write_struct_data2_data5(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               lttng_sequence_tests_write_struct_data2_data5 *obj)
-{
-       size_t align;
-
-       /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
-                       memcpy(buffer+*to_base+*to, *from, *len);
-       }
-       *to += *len;
-       *len = 0;
-
-       align = lttng_get_alignment_sequence_tests_write_struct_data2_data5(obj);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       /* Copy members */
+       *from = (const char*)&lttng_param_value;
        align = sizeof(unsigned int);
 
-       if(*len == 0) {
+       if (*len == 0) {
                *to += ltt_align(*to, align); /* align output */
        } else {
                *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
@@ -361,191 +54,55 @@ static inline void lttng_write_sequence_tests_write_struct_data2_data5(
 
        *len += sizeof(unsigned int);
 
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, &obj->len, *len);
-       *to += *len;
-       *len = 0;
-
-       align = sizeof(int64_t);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(int64_t);
-
-       *len = obj->len * (*len);
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, obj->array, *len);
-       *to += *len;
-       *len = 0;
-
-
-       /* Realign the *to_base on arch size, set *to to 0 */
-       *to += ltt_align(*to, sizeof(void *));
-       *to_base = *to_base+*to;
-       *to = 0;
-
-       /* Put source *from just after the C sequence */
-       *from = obj+1;
-}
-
-static inline void lttng_write_struct_tests_write_struct_data2(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               struct lttng_tests_write_struct_data2 *obj)
-{
-       size_t align;
-
-       align = lttng_get_alignment_struct_tests_write_struct_data2(obj);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       lttng_write_string_tests_write_struct_data2_data3(buffer, to_base, to, from, len, obj->data3);
-
-       align = sizeof(int);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(int);
-
-       lttng_write_sequence_tests_write_struct_data2_data5(buffer, to_base, to, from, len, &obj->data5);
-       align = sizeof(int);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(int);
-
-}
-
-
-/* Event write_struct logging function */
-static inline void trace_tests_write_struct(
-               int lttng_param_data1,
-               struct lttng_tests_write_struct_data2 * lttng_param_data2)
-#if (!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_channel_struct *channel;
-       struct ltt_trace_struct *trace;
-       struct rchan_buf *relayfs_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-       u64 tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(ltt_traces.num_active_traces == 0) return;
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = &lttng_param_data1;
-       align = sizeof(int);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(int);
-
-       *from = lttng_param_data2;
-       lttng_write_struct_tests_write_struct_data2(buffer, to_base, to, from, len, lttng_param_data2);
        reserve_size = *to_base + *to + *len;
        preempt_disable();
        ltt_nesting[smp_processor_id()]++;
-       index = ltt_get_index_from_facility(ltt_facility_tests_2F06D8DB,
-                                               event_tests_write_struct);
+       index = ltt_get_index_from_facility_tests(                                              event_tests_write_4bytes);
 
        list_for_each_entry_rcu(trace, &ltt_traces.head, list) {
-               if(!trace->active) continue;
+               if (!trace->active)
+                       continue;
 
                channel = ltt_get_channel_from_index(trace, index);
-               relayfs_buf = channel->rchan->buf[smp_processor_id()];
 
                slot_size = 0;
-               buffer = ltt_reserve_slot(trace, relayfs_buf,
+               buffer = ltt_reserve_slot(trace, channel, &transport_data,
                        reserve_size, &slot_size, &tsc,
                        &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) continue; /* buffer full */
+               if (!buffer)
+                       continue; /* buffer full */
 
                *to_base = *to = *len = 0;
 
                ltt_write_event_header(trace, channel, buffer,
-                       ltt_facility_tests_2F06D8DB, event_tests_write_struct,
+                       ltt_facility_tests_CA7F1536, event_tests_write_4bytes,
                        reserve_size, before_hdr_pad, tsc);
                *to_base += before_hdr_pad + after_hdr_pad + header_size;
 
-               *from = &lttng_param_data1;
-               align = sizeof(int);
+               *from = (const char*)&lttng_param_value;
+               align = sizeof(unsigned int);
 
-               if(*len == 0) {
+               if (*len == 0) {
                        *to += ltt_align(*to, align); /* align output */
                } else {
                        *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
                }
 
-               *len += sizeof(int);
+               *len += sizeof(unsigned int);
 
                /* Flush pending memcpy */
-               if(*len != 0) {
+               if (*len != 0) {
                        memcpy(buffer+*to_base+*to, *from, *len);
                        *to += *len;
                        *len = 0;
                }
 
-               *from = lttng_param_data2;
-               lttng_write_struct_tests_write_struct_data2(buffer, to_base, to, from, len, lttng_param_data2);
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(relayfs_buf, buffer, slot_size);
+               ltt_commit_slot(channel, &transport_data, buffer, slot_size);
 
        }
 
        ltt_nesting[smp_processor_id()]--;
        preempt_enable_no_resched();
 }
-#endif //(!defined(CONFIG_LTT) || !defined(CONFIG_LTT_FACILITY_TESTS))
-
 
 #endif //_LTT_FACILITY_TESTS_H_
index 5f3d798138751559c18b25c1de78807c35c68705..16711e5fc272368f71eecc81b19dd8577075d5d7 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 
-
+#if 0
 #define cmpxchg_up(ptr,o,n)\
        ((__typeof__(*(ptr)))__cmpxchg_up((ptr),(unsigned long)(o),\
                                        (unsigned long)(n),sizeof(*(ptr))))
@@ -40,7 +40,7 @@ static inline unsigned long __cmpxchg_up(volatile void *ptr, unsigned long old,
        }
        return old;
 }
-
+#endif //0
 
 #define NR_LOOPS 20000
 
This page took 0.034768 seconds and 4 git commands to generate.