diff options
| -rw-r--r-- | kernel/trace/trace_syscalls.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 061156215721..ac0085777fbd 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
| @@ -566,6 +566,10 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) | |||
| 566 | if (!sys_data) | 566 | if (!sys_data) |
| 567 | return; | 567 | return; |
| 568 | 568 | ||
| 569 | head = this_cpu_ptr(sys_data->enter_event->perf_events); | ||
| 570 | if (hlist_empty(head)) | ||
| 571 | return; | ||
| 572 | |||
| 569 | /* get the size after alignment with the u32 buffer size field */ | 573 | /* get the size after alignment with the u32 buffer size field */ |
| 570 | size = sizeof(unsigned long) * sys_data->nb_args + sizeof(*rec); | 574 | size = sizeof(unsigned long) * sys_data->nb_args + sizeof(*rec); |
| 571 | size = ALIGN(size + sizeof(u32), sizeof(u64)); | 575 | size = ALIGN(size + sizeof(u32), sizeof(u64)); |
| @@ -583,8 +587,6 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) | |||
| 583 | rec->nr = syscall_nr; | 587 | rec->nr = syscall_nr; |
| 584 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, | 588 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, |
| 585 | (unsigned long *)&rec->args); | 589 | (unsigned long *)&rec->args); |
| 586 | |||
| 587 | head = this_cpu_ptr(sys_data->enter_event->perf_events); | ||
| 588 | perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); | 590 | perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); |
| 589 | } | 591 | } |
| 590 | 592 | ||
| @@ -642,6 +644,10 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) | |||
| 642 | if (!sys_data) | 644 | if (!sys_data) |
| 643 | return; | 645 | return; |
| 644 | 646 | ||
| 647 | head = this_cpu_ptr(sys_data->exit_event->perf_events); | ||
| 648 | if (hlist_empty(head)) | ||
| 649 | return; | ||
| 650 | |||
| 645 | /* We can probably do that at build time */ | 651 | /* We can probably do that at build time */ |
| 646 | size = ALIGN(sizeof(*rec) + sizeof(u32), sizeof(u64)); | 652 | size = ALIGN(sizeof(*rec) + sizeof(u32), sizeof(u64)); |
| 647 | size -= sizeof(u32); | 653 | size -= sizeof(u32); |
| @@ -661,8 +667,6 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) | |||
| 661 | 667 | ||
| 662 | rec->nr = syscall_nr; | 668 | rec->nr = syscall_nr; |
| 663 | rec->ret = syscall_get_return_value(current, regs); | 669 | rec->ret = syscall_get_return_value(current, regs); |
| 664 | |||
| 665 | head = this_cpu_ptr(sys_data->exit_event->perf_events); | ||
| 666 | perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); | 670 | perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); |
| 667 | } | 671 | } |
| 668 | 672 | ||
