Skip to contentSkip to conversation

Early boot timestamp

PATCH Superseded Pavel Tatashin 2 participants 2 messages Jun 12, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Early boot timestamp

Changelog:
v1 - v2:
- Early boot timestamps are now available on all 64-bit sparc processors
- New hot-patched get_tick() function.

This patch set:
- enables early boot timestamps on SPARC,
- adds offset so we count time from zero, the same as it is done on other platforms
- improves the performance by inling, hot patching, and combining loads into the same cacheline. (and few other optimizations).

So, the final performance of sched_clock() is faster than now: the fewer number of loads, and all of them are coming from the same cacheline. Loads can run while we are reading tick value, and we do not do function call.

Current sched_clock():
sethi %hi(0xb9b400), %g1
ldx [ %g1 + 0x250 ], %g1
ldx [ %g1 ], %g1
call %g1
nop
sethi %hi(0xb9b400), %g1
ldx [ %g1 + 0x300 ], %g1

mulx  %o0, %g1, %g1
rett  %i7 + 8
srlx  %g1, 0xa, %o0

Final sched_clock():
sethi %hi(0xb9b400), %g1
ldx [ %g1 + 0x2c8 ], %g2
ldx [ %g1 + 0x2c0 ], %g1
b 42f638 <sched_clock+0x44>
rd %asr24, %i0
...

sllx  %i0, 1, %i0
srlx  %i0, 1, %i0
mulx  %i0, %g1, %i0
srlx  %i0, 0xa, %i0
rett  %i7 + 8

sub %o0, %g2, %o0

Pavel Tatashin (8):
sparc64: remove trailing white spaces
sparc64: access tick function from variable
sparc64: show time stamps from zero
sparc64: optimize loads in clock_sched()
sparc64: improve modularity tick options
sparc64: initialize time early
sparc64: add hot-patched and inlined get_tick()
sparc64: optimize functions that access tick

 arch/sparc/include/asm/setup.h    |    2 +-
 arch/sparc/include/asm/timer_64.h |   67 ++++++++++++++++
 arch/sparc/kernel/kernel.h        |    3 +
 arch/sparc/kernel/setup_64.c      |    7 +-
 arch/sparc/kernel/time_64.c       |  155 ++++++++++++++++++++++++-------------
 arch/sparc/kernel/vmlinux.lds.S   |    5 +
 6 files changed, 181 insertions(+), 58 deletions(-)
#1 lore raw

From: Pavel Tatashin <[email protected]>
Date: Mon, 12 Jun 2017 12:48:19 -0400

Quoted 5 lines

Changelog:
v1 - v2:
- Early boot timestamps are now available on all 64-bit sparc processors
- New hot-patched get_tick() function.

Other than the two pieces of feedback I gave you, these changes look great.

Please fix those up, retest, and repost the series and I'll apply it.

Thanks!