Skip to content

arm+arm64: vdso unification to lib/vdso/

Mark Salyzyn linux-arm-kernel lkml 5 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest12 patches 0 repliesNew
  2. v412 patches 8 repliesSuperseded
  3. v312 patches 12 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v210 patches2 repliesSuperseded
v13 patches2 repliesSuperseded

Changes in v5 from the cover letter

- fixes and changes inspired by compiling with clang. Makefile and portability issues identified. clang build produced a bad arm64 vdso binary until proper compile flags were provided.
- arm compile issue, replace erroneous tk->raw_time.shift with tk->tkr_raw.shift.
- changes inspired by compat architectural portability, minimize include files in vgettimeofday.c that notoriously include unnecessary architectural cruft and defer them to vdso compiler.h. Problematic direct and indirectly included files are asm/arch_timer.h, asm/processor.h, asm/sysreg.h, linux/jiffies.h, linux/hrtimer.h and linux/time.h.
- do not use timespec_add_ns as not accessible via uapi/linux/time.h.
- strip out unused definitions in asm-offsets.c.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12arm: vdso: rename vdso_datapage variablesarch/arm/include/asm/vdso_datapage.h arch/arm/kernel/vdso.c arch/arm/vdso/vgettimeofday.c+45 -390 replies
2/12arm: vdso: add include file defining __get_datapage()arch/arm/vdso/datapage.h arch/arm/vdso/vgettimeofday.c+73 -510 replies
3/12arm: vdso: inline assembler operations to compiler.harch/arm/vdso/compiler.h arch/arm/vdso/vgettimeofday.c+96 -820 replies
4/12arm: vdso: do calculations outside reader loopsarch/arm/include/asm/vdso_datapage.h arch/arm/vdso/compiler.h arch/arm/vdso/vgettimeofday.c+76 -330 replies
5/12arm: vdso: Add support for CLOCK_MONOTONIC_RAWarch/arm/include/asm/vdso_datapage.h arch/arm/kernel/vdso.c arch/arm/vdso/vgettimeofday.c+60 -00 replies
6/12arm: vdso: add support for clock_getresarch/arm/kernel/vdso.c arch/arm/vdso/compiler.h arch/arm/vdso/vdso.lds.S +1 more+26 -00 replies
7/12arm: vdso: disable profilingarch/arm/vdso/Makefile+4 -10 replies
8/12arm: vdso: Add ARCH_CLOCK_FIXED_MASKarch/arm/vdso/vgettimeofday.c+18 -00 replies
9/12arm: vdso: move vgettimeofday.c to lib/vdso/arch/arm/vdso/compiler.h arch/arm/vdso/vgettimeofday.c lib/vdso/compiler.h +2 more+397 -3420 replies
10/12arm64: vdso: replace gettimeofday.S with global vgettimeofday.Carch/arm64/include/asm/vdso_datapage.h arch/arm64/kernel/asm-offsets.c arch/arm64/kernel/vdso.c +5 more+175 -3720 replies
11/12lib: vdso: Add support for CLOCK_BOOTTIMEarch/arm/include/asm/vdso_datapage.h arch/arm/kernel/vdso.c arch/arm64/include/asm/vdso_datapage.h +2 more+59 -00 replies
12/12lib: vdso: do not expose gettimeofday, if no arch supported timerlib/vdso/vgettimeofday.c+20 -320 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 00/12] arm+arm64: vdso unification to lib/vdso/

Take an effort to recode the arm64 vdso code from assembler to C previously submitted by Andrew Pinski <[email protected]>, rework it for use in both arm and arm64, overlapping any optimizations for each architecture. But instead of landing it in arm64, land the result into lib/vdso and unify both implementations to simplify future maintenance. This will act as the basis for implementing arm64 vdso32 in the future.

apinski at cavium.com made the following claims in the original patch:

This allows the compiler to optimize the divide by 1000 and remove the other divides.

On ThunderX, gettimeofday improves by 32%. On ThunderX 2, gettimeofday improves by 18%.

Note I noticed a bug in the old implementation of __kernel_clock_getres; it was checking only the lower 32bits of the pointer; this would work for most cases but could fail in a few.

Cc James Morse <[email protected]>
Cc Russell King <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dmitry Safonov <[email protected]>
Cc John Stultz <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Laura Abbott <[email protected]>
Cc Kees Cook <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Andy Gross <[email protected]>
Cc Kevin Brodsky <[email protected]>
Cc Andrew Pinski <[email protected]>
Cc linux-kernel at vger.kernel.org
Cc linux-arm-kernel at lists.infradead.org

v2:
- split first CL into 7 pieces, there were cosmetic adjustments.
- make sure profiling is turned off.
- kept quiet_cmd_vdsoas.

v3:
- changed are a result of private email review comments
- rebase
- move arch/arm/vdso/vgettimeofday.c to lib/vdso/vgettimeofday.c
- adjust vgettimeofday.c to be a better global candidate, switch to using ARCH_PROVIDES_TIMER and __arch_counter_get() as more generic.
- do not expose gettimeofday if arch does not support user space timer

v4:
- update commit messages to reflect reasoning here.
- switch to arch_vdso_read_counter as common API.
- split out ARCH_CLOCK_FIXED_MASK.
- Use GENMASK_ULL macro for ARCH_CLOCK_FIXED_MASK.
- dropping forced inline patch and side effects.
- replace all typeof()s with the appropriate types vdso_wtm_clock_nsec_t, vdso_xtime_clock_sec, vdso_raw_time_sec_t, long (tv_nsec) and __kernel_time_t (tv_sec).
- clock_getres implementation, use clock instead of clock_id to match usage elsewhere and remove an inconsistency.
- simplify arm64 implementation of arch_vdso_read_counter, use read_sysreg.

v5:
- fixes and changes inspired by compiling with clang. Makefile and portability issues identified. clang build produced a bad arm64 vdso binary until proper compile flags were provided.
- arm compile issue, replace erroneous tk->raw_time.shift with tk->tkr_raw.shift.
- changes inspired by compat architectural portability, minimize include files in vgettimeofday.c that notoriously include unnecessary architectural cruft and defer them to vdso compiler.h. Problematic direct and indirectly included files are asm/arch_timer.h, asm/processor.h, asm/sysreg.h, linux/jiffies.h, linux/hrtimer.h and linux/time.h.
- do not use timespec_add_ns as not accessible via uapi/linux/time.h.
- strip out unused definitions in asm-offsets.c.