diff options
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
-rw-r--r-- | drivers/oprofile/buffer_sync.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index 21fd249b6e0b..908202afbae9 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -329,9 +329,10 @@ static void add_ibs_begin(int cpu, int code, struct mm_struct *mm) | |||
329 | int i, count; | 329 | int i, count; |
330 | unsigned long cookie = 0; | 330 | unsigned long cookie = 0; |
331 | off_t offset; | 331 | off_t offset; |
332 | struct op_entry entry; | ||
332 | struct op_sample *sample; | 333 | struct op_sample *sample; |
333 | 334 | ||
334 | sample = op_cpu_buffer_read_entry(cpu); | 335 | sample = op_cpu_buffer_read_entry(&entry, cpu); |
335 | if (!sample) | 336 | if (!sample) |
336 | return; | 337 | return; |
337 | pc = sample->eip; | 338 | pc = sample->eip; |
@@ -370,7 +371,7 @@ static void add_ibs_begin(int cpu, int code, struct mm_struct *mm) | |||
370 | count = IBS_OP_CODE_SIZE; /*IBS OP is 5 int64s*/ | 371 | count = IBS_OP_CODE_SIZE; /*IBS OP is 5 int64s*/ |
371 | 372 | ||
372 | for (i = 0; i < count; i++) { | 373 | for (i = 0; i < count; i++) { |
373 | sample = op_cpu_buffer_read_entry(cpu); | 374 | sample = op_cpu_buffer_read_entry(&entry, cpu); |
374 | if (!sample) | 375 | if (!sample) |
375 | return; | 376 | return; |
376 | add_event_entry(sample->eip); | 377 | add_event_entry(sample->eip); |
@@ -528,6 +529,8 @@ void sync_buffer(int cpu) | |||
528 | sync_buffer_state state = sb_buffer_start; | 529 | sync_buffer_state state = sb_buffer_start; |
529 | unsigned int i; | 530 | unsigned int i; |
530 | unsigned long available; | 531 | unsigned long available; |
532 | struct op_entry entry; | ||
533 | struct op_sample *sample; | ||
531 | 534 | ||
532 | mutex_lock(&buffer_mutex); | 535 | mutex_lock(&buffer_mutex); |
533 | 536 | ||
@@ -537,19 +540,19 @@ void sync_buffer(int cpu) | |||
537 | available = op_cpu_buffer_entries(cpu); | 540 | available = op_cpu_buffer_entries(cpu); |
538 | 541 | ||
539 | for (i = 0; i < available; ++i) { | 542 | for (i = 0; i < available; ++i) { |
540 | struct op_sample *s = op_cpu_buffer_read_entry(cpu); | 543 | sample = op_cpu_buffer_read_entry(&entry, cpu); |
541 | if (!s) | 544 | if (!sample) |
542 | break; | 545 | break; |
543 | 546 | ||
544 | if (is_code(s->eip)) { | 547 | if (is_code(sample->eip)) { |
545 | switch (s->event) { | 548 | switch (sample->event) { |
546 | case 0: | 549 | case 0: |
547 | case CPU_IS_KERNEL: | 550 | case CPU_IS_KERNEL: |
548 | /* kernel/userspace switch */ | 551 | /* kernel/userspace switch */ |
549 | in_kernel = s->event; | 552 | in_kernel = sample->event; |
550 | if (state == sb_buffer_start) | 553 | if (state == sb_buffer_start) |
551 | state = sb_sample_start; | 554 | state = sb_sample_start; |
552 | add_kernel_ctx_switch(s->event); | 555 | add_kernel_ctx_switch(sample->event); |
553 | break; | 556 | break; |
554 | case CPU_TRACE_BEGIN: | 557 | case CPU_TRACE_BEGIN: |
555 | state = sb_bt_start; | 558 | state = sb_bt_start; |
@@ -566,7 +569,7 @@ void sync_buffer(int cpu) | |||
566 | default: | 569 | default: |
567 | /* userspace context switch */ | 570 | /* userspace context switch */ |
568 | oldmm = mm; | 571 | oldmm = mm; |
569 | new = (struct task_struct *)s->event; | 572 | new = (struct task_struct *)sample->event; |
570 | release_mm(oldmm); | 573 | release_mm(oldmm); |
571 | mm = take_tasks_mm(new); | 574 | mm = take_tasks_mm(new); |
572 | if (mm != oldmm) | 575 | if (mm != oldmm) |
@@ -581,7 +584,7 @@ void sync_buffer(int cpu) | |||
581 | /* ignore sample */ | 584 | /* ignore sample */ |
582 | continue; | 585 | continue; |
583 | 586 | ||
584 | if (add_sample(mm, s, in_kernel)) | 587 | if (add_sample(mm, sample, in_kernel)) |
585 | continue; | 588 | continue; |
586 | 589 | ||
587 | /* ignore backtraces if failed to add a sample */ | 590 | /* ignore backtraces if failed to add a sample */ |