diff options
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
| -rw-r--r-- | drivers/oprofile/buffer_sync.c | 53 |
1 files changed, 12 insertions, 41 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index f9031d31eeb..d692fdc1a21 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
| @@ -318,29 +318,18 @@ static void add_trace_begin(void) | |||
| 318 | 318 | ||
| 319 | #ifdef CONFIG_OPROFILE_IBS | 319 | #ifdef CONFIG_OPROFILE_IBS |
| 320 | 320 | ||
| 321 | #define IBS_FETCH_CODE_SIZE 2 | 321 | static void add_data(struct op_entry *entry, struct mm_struct *mm) |
| 322 | #define IBS_OP_CODE_SIZE 5 | ||
| 323 | |||
| 324 | /* | ||
| 325 | * Add IBS fetch and op entries to event buffer | ||
| 326 | */ | ||
| 327 | static void add_ibs_begin(int cpu, int code, struct mm_struct *mm) | ||
| 328 | { | 322 | { |
| 329 | unsigned long pc; | 323 | unsigned long code, pc, val; |
| 330 | int i, count; | 324 | unsigned long cookie; |
| 331 | unsigned long cookie = 0; | ||
| 332 | off_t offset; | 325 | off_t offset; |
| 333 | struct op_entry entry; | ||
| 334 | struct op_sample *sample; | ||
| 335 | 326 | ||
| 336 | sample = op_cpu_buffer_read_entry(&entry, cpu); | 327 | if (!op_cpu_buffer_get_data(entry, &code)) |
| 337 | if (!sample) | 328 | return; |
| 329 | if (!op_cpu_buffer_get_data(entry, &pc)) | ||
| 330 | return; | ||
| 331 | if (!op_cpu_buffer_get_size(entry)) | ||
| 338 | return; | 332 | return; |
| 339 | pc = sample->eip; | ||
| 340 | |||
| 341 | #ifdef __LP64__ | ||
| 342 | pc += sample->event << 32; | ||
| 343 | #endif | ||
| 344 | 333 | ||
| 345 | if (mm) { | 334 | if (mm) { |
| 346 | cookie = lookup_dcookie(mm, pc, &offset); | 335 | cookie = lookup_dcookie(mm, pc, &offset); |
| @@ -362,24 +351,8 @@ static void add_ibs_begin(int cpu, int code, struct mm_struct *mm) | |||
| 362 | add_event_entry(code); | 351 | add_event_entry(code); |
| 363 | add_event_entry(offset); /* Offset from Dcookie */ | 352 | add_event_entry(offset); /* Offset from Dcookie */ |
| 364 | 353 | ||
| 365 | /* we send the Dcookie offset, but send the raw Linear Add also*/ | 354 | while (op_cpu_buffer_get_data(entry, &val)) |
| 366 | add_event_entry(sample->eip); | 355 | add_event_entry(val); |
| 367 | add_event_entry(sample->event); | ||
| 368 | |||
| 369 | if (code == IBS_FETCH_CODE) | ||
| 370 | count = IBS_FETCH_CODE_SIZE; /*IBS FETCH is 2 int64s*/ | ||
| 371 | else | ||
| 372 | count = IBS_OP_CODE_SIZE; /*IBS OP is 5 int64s*/ | ||
| 373 | |||
| 374 | for (i = 0; i < count; i++) { | ||
| 375 | sample = op_cpu_buffer_read_entry(&entry, cpu); | ||
| 376 | if (!sample) | ||
| 377 | return; | ||
| 378 | add_event_entry(sample->eip); | ||
| 379 | add_event_entry(sample->event); | ||
| 380 | } | ||
| 381 | |||
| 382 | return; | ||
| 383 | } | 356 | } |
| 384 | 357 | ||
| 385 | #endif | 358 | #endif |
| @@ -572,10 +545,8 @@ void sync_buffer(int cpu) | |||
| 572 | add_user_ctx_switch(new, cookie); | 545 | add_user_ctx_switch(new, cookie); |
| 573 | } | 546 | } |
| 574 | #ifdef CONFIG_OPROFILE_IBS | 547 | #ifdef CONFIG_OPROFILE_IBS |
| 575 | if (flags & IBS_FETCH_BEGIN) | 548 | if (op_cpu_buffer_get_size(&entry)) |
| 576 | add_ibs_begin(cpu, IBS_FETCH_CODE, mm); | 549 | add_data(&entry, mm); |
| 577 | if (flags & IBS_OP_BEGIN) | ||
| 578 | add_ibs_begin(cpu, IBS_OP_CODE, mm); | ||
| 579 | #endif | 550 | #endif |
| 580 | continue; | 551 | continue; |
| 581 | } | 552 | } |
