Skip to content

x86/vdso: Cleanups, simmplifications and CLOCK_TAI support

Thomas Gleixner lkml virtualization 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/211 patches 2 repliesIn review
  2. v2 posting 1/20 of 11 patches 0 repliesSuperseded
  3. v111 patches 119 repliesSuperseded

Changes in v2 from the cover letter

- Fix the VCLOCK_MAX sanity check
- Remove the magic clock masking and extend the storage array

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11clocksource: Provide clocksource_arch_init()include/linux/clocksource.h kernel/time/Kconfig kernel/time/clocksource.c+11 -00 replies
1/11clocksource: Provide clocksource_arch_init()include/linux/clocksource.h kernel/time/Kconfig kernel/time/clocksource.c+11 -01 reply
2/11x86/time: Implement clocksource_arch_init()arch/x86/Kconfig arch/x86/kernel/time.c+17 -00 replies
2/11x86/time: Implement clocksource_arch_init()arch/x86/Kconfig arch/x86/kernel/time.c+17 -00 replies
3/11x86/vdso: Enforce 64bit clocksourcearch/x86/entry/vdso/vclock_gettime.c arch/x86/kernel/time.c+7 -10 replies
3/11x86/vdso: Enforce 64bit clocksourcearch/x86/entry/vdso/vclock_gettime.c arch/x86/kernel/time.c+7 -10 replies
4/11x86/vdso: Use unsigned int consistently for vsyscall_gtod_data::seqarch/x86/entry/vdso/vclock_gettime.c arch/x86/include/asm/vgtod.h+9 -90 replies
4/11x86/vdso: Use unsigned int consistently for vsyscall_gtod_data::seqarch/x86/entry/vdso/vclock_gettime.c arch/x86/include/asm/vgtod.h+9 -90 replies
5/11x86/vdso: Introduce and use vgtod_tsarch/x86/entry/vdso/vclock_gettime.c arch/x86/entry/vsyscall/vsyscall_gtod.c arch/x86/include/asm/vgtod.h+61 -500 replies
5/11x86/vdso: Introduce and use vgtod_tsarch/x86/entry/vdso/vclock_gettime.c arch/x86/entry/vsyscall/vsyscall_gtod.c arch/x86/include/asm/vgtod.h+61 -500 replies
6/11x86/vdso: Collapse high resolution functionsarch/x86/entry/vdso/vclock_gettime.c+7 -280 replies
6/11x86/vdso: Collapse high resolution functionsarch/x86/entry/vdso/vclock_gettime.c+7 -280 replies
7/11x86/vdso: Collapse coarse functionsarch/x86/entry/vdso/vclock_gettime.c+4 -160 replies
7/11x86/vdso: Collapse coarse functionsarch/x86/entry/vdso/vclock_gettime.c+4 -160 replies
8/11x86/vdso: Replace the clockid switch casearch/x86/entry/vdso/vclock_gettime.c+18 -200 replies
8/11x86/vdso: Replace the clockid switch casearch/x86/entry/vdso/vclock_gettime.c+18 -200 replies
9/11x86/vdso: Simplify the invalid vclock casearch/x86/entry/vdso/vclock_gettime.c+21 -600 replies
9/11x86/vdso: Simplify the invalid vclock casearch/x86/entry/vdso/vclock_gettime.c+21 -600 replies
10/11x86/vdso: Move cycle_last handling into the callerarch/x86/entry/vdso/vclock_gettime.c+7 -320 replies
10/11x86/vdso: Move cycle_last handling into the callerarch/x86/entry/vdso/vclock_gettime.c+7 -320 replies
11/11x66/vdso: Add CLOCK_TAI supportarch/x86/entry/vsyscall/vsyscall_gtod.c arch/x86/include/asm/vgtod.h+6 -20 replies
11/11x66/vdso: Add CLOCK_TAI supportarch/x86/entry/vsyscall/vsyscall_gtod.c arch/x86/include/asm/vgtod.h+6 -21 reply

Reviews trailers per patch

2 of 22 patches have a Reviewed-by or Acked-by.

PatchJohn StultzMatt Rickard
1/11A-b
1/11A-b
2/11
2/11
3/11
3/11
4/11
4/11
5/11
5/11
6/11
6/11
7/11
7/11
8/11
8/11
9/11
9/11
10/11
10/11
11/11T-b
11/11T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [patch V2 00/11] x86/vdso: Cleanups, simmplifications and CLOCK_TAI support

Matt attempted to add CLOCK_TAI support to the VDSO clock_gettime() implementation, which extended the clockid switch case and added yet another slightly different copy of the same code.

Especially the extended switch case is problematic as the compiler tends to generate a jump table which then requires to use retpolines. If jump tables are disabled it adds yet another conditional to the existing maze.

This series takes a different approach by consolidating the almost identical functions into one implementation for high resolution clocks and one for the coarse grained clock ids by storing the base data for each clock id in an array which is indexed by the clock id.

This completely eliminates the switch case and allows further simplifications of the code base, which at the end all together gain a few cycles performance or at least stay on par with todays code. The resulting performance depends heavily on the micro architecture and the compiler.

Changes vs. V1:

- Fix the VCLOCK_MAX sanity check
- Remove the magic clock masking and extend the storage array

Thanks,

tglx

8<-------------------

 arch/x86/Kconfig                        |    1 
 arch/x86/entry/vdso/vclock_gettime.c    |  199 ++++++++------------------------
 arch/x86/entry/vsyscall/vsyscall_gtod.c |   55 ++++----
 arch/x86/include/asm/vgtod.h            |   42 +++---
 arch/x86/kernel/time.c                  |   22 +++
 include/linux/clocksource.h             |    5 
 kernel/time/Kconfig                     |    4 
 kernel/time/clocksource.c               |    2 
 8 files changed, 140 insertions(+), 190 deletions(-)