]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/oprofile/buffer_sync.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile
[linux-2.6-omap-h63xx.git] / drivers / oprofile / buffer_sync.c
index d969bb13a25281b875e9c4726d7a3fb51ff663ac..9da5a4b811337562dbcf708dcad927756264381d 100644 (file)
@@ -201,7 +201,7 @@ static inline unsigned long fast_get_dcookie(struct path *path)
 {
        unsigned long cookie;
 
-       if (path->dentry->d_cookie)
+       if (path->dentry->d_flags & DCACHE_COOKIE)
                return (unsigned long)path->dentry;
        get_dcookie(path, &cookie);
        return cookie;
@@ -316,31 +316,18 @@ static void add_trace_begin(void)
        add_event_entry(TRACE_BEGIN_CODE);
 }
 
-#ifdef CONFIG_OPROFILE_IBS
-
-#define IBS_FETCH_CODE_SIZE    2
-#define IBS_OP_CODE_SIZE       5
-
-/*
- * Add IBS fetch and op entries to event buffer
- */
-static void add_ibs_begin(int cpu, int code, struct mm_struct *mm)
+static void add_data(struct op_entry *entry, struct mm_struct *mm)
 {
-       unsigned long pc;
-       int i, count;
-       unsigned long cookie = 0;
+       unsigned long code, pc, val;
+       unsigned long cookie;
        off_t offset;
-       struct op_entry entry;
-       struct op_sample *sample;
 
-       sample = op_cpu_buffer_read_entry(&entry, cpu);
-       if (!sample)
+       if (!op_cpu_buffer_get_data(entry, &code))
+               return;
+       if (!op_cpu_buffer_get_data(entry, &pc))
+               return;
+       if (!op_cpu_buffer_get_size(entry))
                return;
-       pc = sample->eip;
-
-#ifdef __LP64__
-       pc += sample->event << 32;
-#endif
 
        if (mm) {
                cookie = lookup_dcookie(mm, pc, &offset);
@@ -362,28 +349,10 @@ static void add_ibs_begin(int cpu, int code, struct mm_struct *mm)
        add_event_entry(code);
        add_event_entry(offset);        /* Offset from Dcookie */
 
-       /* we send the Dcookie offset, but send the raw Linear Add also*/
-       add_event_entry(sample->eip);
-       add_event_entry(sample->event);
-
-       if (code == IBS_FETCH_CODE)
-               count = IBS_FETCH_CODE_SIZE;    /*IBS FETCH is 2 int64s*/
-       else
-               count = IBS_OP_CODE_SIZE;       /*IBS OP is 5 int64s*/
-
-       for (i = 0; i < count; i++) {
-               sample = op_cpu_buffer_read_entry(&entry, cpu);
-               if (!sample)
-                       return;
-               add_event_entry(sample->eip);
-               add_event_entry(sample->event);
-       }
-
-       return;
+       while (op_cpu_buffer_get_data(entry, &val))
+               add_event_entry(val);
 }
 
-#endif
-
 static inline void add_sample_entry(unsigned long offset, unsigned long event)
 {
        add_event_entry(offset);
@@ -524,6 +493,7 @@ void sync_buffer(int cpu)
 {
        struct mm_struct *mm = NULL;
        struct mm_struct *oldmm;
+       unsigned long val;
        struct task_struct *new;
        unsigned long cookie = 0;
        int in_kernel = 1;
@@ -559,22 +529,19 @@ void sync_buffer(int cpu)
                                        state = sb_sample_start;
                                add_kernel_ctx_switch(flags & IS_KERNEL);
                        }
-                       if (flags & USER_CTX_SWITCH) {
+                       if (flags & USER_CTX_SWITCH
+                           && op_cpu_buffer_get_data(&entry, &val)) {
                                /* userspace context switch */
+                               new = (struct task_struct *)val;
                                oldmm = mm;
-                               new = (struct task_struct *)sample->data[0];
                                release_mm(oldmm);
                                mm = take_tasks_mm(new);
                                if (mm != oldmm)
                                        cookie = get_exec_dcookie(mm);
                                add_user_ctx_switch(new, cookie);
                        }
-#ifdef CONFIG_OPROFILE_IBS
-                       if (flags & IBS_FETCH_BEGIN)
-                               add_ibs_begin(cpu, IBS_FETCH_CODE, mm);
-                       if (flags & IBS_OP_BEGIN)
-                               add_ibs_begin(cpu, IBS_OP_CODE, mm);
-#endif
+                       if (op_cpu_buffer_get_size(&entry))
+                               add_data(&entry, mm);
                        continue;
                }