aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/buffer_sync.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
-rw-r--r--drivers/oprofile/buffer_sync.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 37681700b61a..b55cd23ffdef 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -41,7 +41,6 @@ static cpumask_t marked_cpus = CPU_MASK_NONE;
41static DEFINE_SPINLOCK(task_mortuary); 41static DEFINE_SPINLOCK(task_mortuary);
42static void process_task_mortuary(void); 42static void process_task_mortuary(void);
43 43
44
45/* Take ownership of the task struct and place it on the 44/* Take ownership of the task struct and place it on the
46 * list for processing. Only after two full buffer syncs 45 * list for processing. Only after two full buffer syncs
47 * does the task eventually get freed, because by then 46 * does the task eventually get freed, because by then
@@ -341,7 +340,7 @@ static void add_trace_begin(void)
341 * Add IBS fetch and op entries to event buffer 340 * Add IBS fetch and op entries to event buffer
342 */ 341 */
343static void add_ibs_begin(struct oprofile_cpu_buffer *cpu_buf, int code, 342static void add_ibs_begin(struct oprofile_cpu_buffer *cpu_buf, int code,
344 int in_kernel, struct mm_struct *mm) 343 struct mm_struct *mm)
345{ 344{
346 unsigned long rip; 345 unsigned long rip;
347 int i, count; 346 int i, count;
@@ -565,9 +564,11 @@ void sync_buffer(int cpu)
565 struct task_struct *new; 564 struct task_struct *new;
566 unsigned long cookie = 0; 565 unsigned long cookie = 0;
567 int in_kernel = 1; 566 int in_kernel = 1;
568 unsigned int i;
569 sync_buffer_state state = sb_buffer_start; 567 sync_buffer_state state = sb_buffer_start;
568#ifndef CONFIG_OPROFILE_IBS
569 unsigned int i;
570 unsigned long available; 570 unsigned long available;
571#endif
571 572
572 mutex_lock(&buffer_mutex); 573 mutex_lock(&buffer_mutex);
573 574
@@ -575,9 +576,13 @@ void sync_buffer(int cpu)
575 576
576 /* Remember, only we can modify tail_pos */ 577 /* Remember, only we can modify tail_pos */
577 578
579#ifndef CONFIG_OPROFILE_IBS
578 available = get_slots(cpu_buf); 580 available = get_slots(cpu_buf);
579 581
580 for (i = 0; i < available; ++i) { 582 for (i = 0; i < available; ++i) {
583#else
584 while (get_slots(cpu_buf)) {
585#endif
581 struct op_sample *s = &cpu_buf->buffer[cpu_buf->tail_pos]; 586 struct op_sample *s = &cpu_buf->buffer[cpu_buf->tail_pos];
582 587
583 if (is_code(s->eip)) { 588 if (is_code(s->eip)) {
@@ -593,12 +598,10 @@ void sync_buffer(int cpu)
593#ifdef CONFIG_OPROFILE_IBS 598#ifdef CONFIG_OPROFILE_IBS
594 } else if (s->event == IBS_FETCH_BEGIN) { 599 } else if (s->event == IBS_FETCH_BEGIN) {
595 state = sb_bt_start; 600 state = sb_bt_start;
596 add_ibs_begin(cpu_buf, 601 add_ibs_begin(cpu_buf, IBS_FETCH_CODE, mm);
597 IBS_FETCH_CODE, in_kernel, mm);
598 } else if (s->event == IBS_OP_BEGIN) { 602 } else if (s->event == IBS_OP_BEGIN) {
599 state = sb_bt_start; 603 state = sb_bt_start;
600 add_ibs_begin(cpu_buf, 604 add_ibs_begin(cpu_buf, IBS_OP_CODE, mm);
601 IBS_OP_CODE, in_kernel, mm);
602#endif 605#endif
603 } else { 606 } else {
604 struct mm_struct *oldmm = mm; 607 struct mm_struct *oldmm = mm;