2020-12-20 18:21:20

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH] powerpc/time: Force inlining of get_tb()

Force inlining of get_tb() in order to avoid getting
following function in vdso32, leading to suboptimal
performance in clock_gettime()

00000688 <.get_tb>:
688: 7c 6d 42 a6 mftbu r3
68c: 7c 8c 42 a6 mftb r4
690: 7d 2d 42 a6 mftbu r9
694: 7c 03 48 40 cmplw r3,r9
698: 40 e2 ff f0 bne+ 688 <.get_tb>
69c: 4e 80 00 20 blr

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/include/asm/vdso/timebase.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/vdso/timebase.h b/arch/powerpc/include/asm/vdso/timebase.h
index b558b07959ce..881f655caa0a 100644
--- a/arch/powerpc/include/asm/vdso/timebase.h
+++ b/arch/powerpc/include/asm/vdso/timebase.h
@@ -49,7 +49,7 @@ static inline unsigned long get_tbl(void)
return mftb();
}

-static inline u64 get_tb(void)
+static __always_inline u64 get_tb(void)
{
unsigned int tbhi, tblo, tbhi2;

--
2.25.0


2020-12-22 13:14:08

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH] powerpc/time: Force inlining of get_tb()

On Sun, 20 Dec 2020 18:18:26 +0000 (UTC), Christophe Leroy wrote:
> Force inlining of get_tb() in order to avoid getting
> following function in vdso32, leading to suboptimal
> performance in clock_gettime()
>
> 00000688 <.get_tb>:
> 688: 7c 6d 42 a6 mftbu r3
> 68c: 7c 8c 42 a6 mftb r4
> 690: 7d 2d 42 a6 mftbu r9
> 694: 7c 03 48 40 cmplw r3,r9
> 698: 40 e2 ff f0 bne+ 688 <.get_tb>
> 69c: 4e 80 00 20 blr

Applied to powerpc/fixes.

[1/1] powerpc/time: Force inlining of get_tb()
https://git.kernel.org/powerpc/c/0faa22f09caadc11af2aa7570870ebd2ac5b8170

cheers