Re: [PATCH 5/6] x86-64: Omit frame pointers on vread_tsc

From: Ingo Molnar
Date: Tue Mar 29 2011 - 02:24:32 EST



* Andy Lutomirski <luto@xxxxxxx> wrote:

> vread_tsc is short and hot, and it's userspace code so the usual
> reasons to keep frame pointers around don't apply.
>
> Signed-off-by: Andy Lutomirski <luto@xxxxxxx>
> ---
>
> It might be nicer to move vread_tsc into a separate file and change
> the options directly.
>
> arch/x86/kernel/tsc.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
> index a159fba..1aea4a6 100644
> --- a/arch/x86/kernel/tsc.c
> +++ b/arch/x86/kernel/tsc.c
> @@ -764,6 +764,8 @@ static cycle_t read_tsc(struct clocksource *cs)
> }
>
> #ifdef CONFIG_X86_64
> +#pragma GCC push_options
> +#pragma GCC optimize ("omit-frame-pointer")
> static cycle_t __vsyscall_fn vread_tsc(void)
> {
> cycle_t ret;
> @@ -807,6 +809,7 @@ static cycle_t __vsyscall_fn vread_tsc(void)
> asm volatile ("");
> return last;
> }
> +#pragma GCC pop_options
> #endif

The cleaner option would be to put the __vsyscall functions into a new .c file
and build it with framepointers off in the Makefile, which can be done via:

CFLAGS_vtsc.o := -fno-omit-frame-pointer

or so.

We could also consider putting this function into a .S too. Not sure it works
out in a maintainable fashion though.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/