lkml.org 
[lkml]   [2012]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv3] perf x86_64: Fix rsp register for system call fast path
On Wed, Oct 03, 2012 at 02:29:47PM +0200, Jiri Olsa wrote:
> +#ifdef CONFIG_X86_64
> +__weak void

Only annotate with __weak the default implementation you want to be
overriden. Here you want it to actually override the default __weak version.

> +arch_sample_regs_user_fixup(struct perf_regs_user *uregs, int kernel)
> +{
> + /*
> + * If the perf event was triggered within the kernel code
> + * path, then it was either syscall or interrupt. While
> + * interrupt stores almost all user registers, the syscall
> + * fast path does not. At this point we can at least set
> + * rsp register right, which is crucial for dwarf unwind.
> + *
> + * The syscall_get_nr function returns -1 (orig_ax) for
> + * interrupt, and positive value for syscall.
> + *
> + * We have two race windows in here:
> + *
> + * 1) Few instructions from syscall entry until old_rsp is
> + * set.
> + *
> + * 2) In syscall/interrupt path from entry until the orig_ax
> + * is set.
> + *
> + * Above described race windows are fractional opposed to
> + * the syscall fast path, so we get much better results
> + * fixing rsp this way.
> + */
> + if (kernel && (syscall_get_nr(current, uregs->regs) >= 0)) {
> + /* Make a copy and link it to regs pointer. */
> + memcpy(&uregs->regs_copy, uregs->regs, sizeof(*uregs->regs));
> + uregs->regs = &uregs->regs_copy;
> +
> + /* And fix the rsp. */
> + uregs->regs->sp = this_cpu_read(old_rsp);
> + }
> +}
> +#endif


\
 
 \ /
  Last update: 2012-10-03 15:21    [W:0.156 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site