* [PATCH] x86: vget_cycles() __always_inline
@ 2008-04-26 23:39 Hugh Dickins
2008-04-28 15:24 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2008-04-26 23:39 UTC (permalink / raw)
To: Ingo Molnar; +Cc: linux-kernel
Mark vget_cycles() as __always_inline, so gcc is never tempted to make
the vsyscall vread_tsc() dive into kernel text, with resulting SIGSEGV.
This was a self-inflicted wound: I've not seen that happen with unhacked
sources; but for debug reasons I'd changed my x86/Makefile to compile
no-unit-at-a-time, and that in conjunction with OPTIMIZE_INLINING=y
ended up with vget_cycles() in kernel text. Perhaps it can happen
in other ways: safer to use __always_inline.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
include/asm-x86/tsc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 2.6.25-mm1/include/asm-x86/tsc.h 2008-04-18 12:18:34.000000000 +0100
+++ linux/include/asm-x86/tsc.h 2008-04-24 19:12:32.000000000 +0100
@@ -32,7 +32,7 @@ static inline cycles_t get_cycles(void)
return ret;
}
-static inline cycles_t vget_cycles(void)
+static __always_inline cycles_t vget_cycles(void)
{
/*
* We only do VDSOs on TSC capable CPUs, so this shouldnt
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] x86: vget_cycles() __always_inline
2008-04-26 23:39 [PATCH] x86: vget_cycles() __always_inline Hugh Dickins
@ 2008-04-28 15:24 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-04-28 15:24 UTC (permalink / raw)
To: Hugh Dickins; +Cc: linux-kernel
* Hugh Dickins <hugh@veritas.com> wrote:
> Mark vget_cycles() as __always_inline, so gcc is never tempted to make
> the vsyscall vread_tsc() dive into kernel text, with resulting
> SIGSEGV.
>
> This was a self-inflicted wound: I've not seen that happen with
> unhacked sources; but for debug reasons I'd changed my x86/Makefile to
> compile no-unit-at-a-time, and that in conjunction with
> OPTIMIZE_INLINING=y ended up with vget_cycles() in kernel text.
> Perhaps it can happen in other ways: safer to use __always_inline.
applied, thanks Hugh - i agree that this is worth fixing.
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-28 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-26 23:39 [PATCH] x86: vget_cycles() __always_inline Hugh Dickins
2008-04-28 15:24 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome