mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 04:36:49 +07:00
b33f491f5a
Time functions are directly implemented in assembly in arm64, and it is desirable to keep it this way for performance reasons (everything fits in registers, so that the stack is not used at all). However, the current implementation is quite difficult to read and understand (even considering it's assembly). Additionally, due to the structure of __kernel_clock_gettime, which heavily uses conditional branches to share code between the different clocks, it is difficult to support a new clock without making the branches even harder to follow. This commit completely refactors the structure of clock_gettime (and gettimeofday along the way) while keeping exactly the same algorithms. We no longer try to share code; instead, macros provide common operations. This new approach comes with a number of advantages: - In clock_gettime, clock implementations are no longer interspersed, making them much more readable. Additionally, macros only use registers passed as arguments or reserved with .req, this way it is easy to make sure that registers are properly allocated. To avoid a large number of branches in a given execution path, a jump table is used; a normal execution uses 3 unconditional branches. - __do_get_tspec has been replaced with 2 macros (get_ts_clock_mono, get_clock_shifted_nsec) and explicit loading of data from the vDSO page. Consequently, clock_gettime and gettimeofday are now leaf functions, and saving x30 (lr) is no longer necessary. - Variables protected by tb_seq_count are now loaded all at once, allowing to merge the seqcnt_read macro into seqcnt_check. - For CLOCK_REALTIME_COARSE, removed an unused load of the wall to monotonic timespec. - For CLOCK_MONOTONIC_COARSE, removed a few shift instructions. Obviously, the downside of sharing less code is an increase in code size. However since the vDSO has its own code page, this does not really matter, as long as the size of the DSO remains below 4 kB. For now this should be all right: Before After vdso.so size (B) 2776 3000 Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Reviewed-by: Dave Martin <dave.martin@arm.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> |
||
---|---|---|
.. | ||
vdso | ||
.gitignore | ||
acpi_parking_protocol.c | ||
acpi.c | ||
alternative.c | ||
arm64ksyms.c | ||
armv8_deprecated.c | ||
asm-offsets.c | ||
cacheinfo.c | ||
cpu_errata.c | ||
cpu_ops.c | ||
cpu-reset.h | ||
cpu-reset.S | ||
cpufeature.c | ||
cpuidle.c | ||
cpuinfo.c | ||
debug-monitors.c | ||
efi-entry.S | ||
efi.c | ||
entry32.S | ||
entry-fpsimd.S | ||
entry-ftrace.S | ||
entry.S | ||
fpsimd.c | ||
ftrace.c | ||
head.S | ||
hibernate-asm.S | ||
hibernate.c | ||
hw_breakpoint.c | ||
hyp-stub.S | ||
image.h | ||
insn.c | ||
io.c | ||
irq.c | ||
jump_label.c | ||
kaslr.c | ||
kgdb.c | ||
kuser32.S | ||
machine_kexec.c | ||
Makefile | ||
module-plts.c | ||
module.c | ||
module.lds | ||
paravirt.c | ||
pci.c | ||
perf_callchain.c | ||
perf_event.c | ||
perf_regs.c | ||
process.c | ||
psci.c | ||
ptrace.c | ||
relocate_kernel.S | ||
return_address.c | ||
setup.c | ||
signal32.c | ||
signal.c | ||
sleep.S | ||
smccc-call.S | ||
smp_spin_table.c | ||
smp.c | ||
stacktrace.c | ||
suspend.c | ||
sys32.c | ||
sys_compat.c | ||
sys.c | ||
time.c | ||
topology.c | ||
trace-events-emulation.h | ||
traps.c | ||
vdso.c | ||
vmlinux.lds.S |