mbox series

[API-NEXT,0/8] Use HW time counter

Message ID 20170421131134.27992-1-petri.savolainen@linaro.org
Headers show
Series Use HW time counter | expand

Message

Petri Savolainen April 21, 2017, 1:11 p.m. UTC
This patch set modifies time implementation to use TSC when running on a x86 
CPU that has invarint TSC CPU flag set. Otherwise, the same Linux system time 
is used as before. TSC is much more efficient both in performance and 
latency/jitter wise than Linux system call. This can be seen also with 
scheduler latency test which time stamps events with this API. All latency 
measurements (min, ave, max) improved significantly.

This is sent through api-next as cpu flags are printed through new system info 
print function for debugging purposes (to verify that invariant TSC flag is 
read correctly).

Patch 2/8 causes two checkpatch errors due to code copied from DPDK. Both 
the macro and the ifdef cannot be changed, so errors should be ignored.


Petri Savolainen (8):
  api: system: added system info print
  linux-gen: cpu_flags: added x86 cpu flag read functions
  linux-gen: system: implement system info print
  test: validation: add odp_sys_info_print test
  test: sched_latency: use sys_info_print
  test: validation: rename time test header file
  test: validation: add time accuracy test
  linux-gen: time: use hw time counter when available

 configure.ac                                       |   1 +
 include/odp/api/spec/system_info.h                 |   9 +
 platform/linux-generic/Makefile.am                 |   5 +
 platform/linux-generic/arch/arm/odp_cpu_arch.c     |  11 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c     |   4 +
 platform/linux-generic/arch/default/odp_cpu_arch.c |  11 +
 .../linux-generic/arch/default/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/mips64/odp_cpu_arch.c  |  11 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |   4 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  11 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/x86/cpu_flags.c        | 358 +++++++++++++++++++++
 platform/linux-generic/arch/x86/cpu_flags.h        |  20 ++
 platform/linux-generic/arch/x86/odp_cpu_arch.c     |  59 ++++
 .../linux-generic/arch/x86/odp_sysinfo_parse.c     |   6 +
 .../include/odp/api/plat/time_types.h              |  23 +-
 platform/linux-generic/include/odp_internal.h      |   1 +
 platform/linux-generic/include/odp_time_internal.h |  24 ++
 platform/linux-generic/odp_system_info.c           |  20 ++
 platform/linux-generic/odp_time.c                  | 303 +++++++++++++----
 test/common_plat/performance/odp_sched_latency.c   |  18 +-
 test/common_plat/validation/api/system/system.c    |   8 +
 test/common_plat/validation/api/system/system.h    |   1 +
 test/common_plat/validation/api/time/Makefile.am   |   2 +-
 test/common_plat/validation/api/time/time.c        |  74 ++++-
 test/common_plat/validation/api/time/time_main.c   |   2 +-
 .../validation/api/time/{time.h => time_test.h}    |   0
 27 files changed, 898 insertions(+), 96 deletions(-)
 create mode 100644 platform/linux-generic/arch/x86/cpu_flags.c
 create mode 100644 platform/linux-generic/arch/x86/cpu_flags.h
 create mode 100644 platform/linux-generic/include/odp_time_internal.h
 rename test/common_plat/validation/api/time/{time.h => time_test.h} (100%)

-- 
2.11.0

Comments

Bill Fischofer April 22, 2017, 12:46 p.m. UTC | #1
I've confirmed that once these missing files are added to
platform/Makefile.inc that this update passes the remaining CI checks.

On Fri, Apr 21, 2017 at 5:03 PM, Bill Fischofer <bill.fischofer@linaro.org>
wrote:

> make distcheck fails for this series:

>

>   CC       drv_spinlock.lo

>   CC       arch/x86/odp_cpu_arch.lo

>   CC       arch/x86/odp_sysinfo_parse.lo

> ../../../../platform/linux-generic/arch/x86/odp_sysinfo_parse.c:8:32:

> fatal error: arch/x86/cpu_flags.h: No such file or directory

>  #include <arch/x86/cpu_flags.h>

>                                 ^

> compilation terminated.

>

>

> On Fri, Apr 21, 2017 at 8:11 AM, Petri Savolainen <

> petri.savolainen@linaro.org> wrote:

>

>> This patch set modifies time implementation to use TSC when running on a

>> x86

>> CPU that has invarint TSC CPU flag set. Otherwise, the same Linux system

>> time

>> is used as before. TSC is much more efficient both in performance and

>> latency/jitter wise than Linux system call. This can be seen also with

>> scheduler latency test which time stamps events with this API. All latency

>> measurements (min, ave, max) improved significantly.

>>

>> This is sent through api-next as cpu flags are printed through new system

>> info

>> print function for debugging purposes (to verify that invariant TSC flag

>> is

>> read correctly).

>>

>> Patch 2/8 causes two checkpatch errors due to code copied from DPDK. Both

>> the macro and the ifdef cannot be changed, so errors should be ignored.

>>

>>

>> Petri Savolainen (8):

>>   api: system: added system info print

>>   linux-gen: cpu_flags: added x86 cpu flag read functions

>>   linux-gen: system: implement system info print

>>   test: validation: add odp_sys_info_print test

>>   test: sched_latency: use sys_info_print

>>   test: validation: rename time test header file

>>   test: validation: add time accuracy test

>>   linux-gen: time: use hw time counter when available

>>

>>  configure.ac                                       |   1 +

>>  include/odp/api/spec/system_info.h                 |   9 +

>>  platform/linux-generic/Makefile.am                 |   5 +

>>  platform/linux-generic/arch/arm/odp_cpu_arch.c     |  11 +

>>  .../linux-generic/arch/arm/odp_sysinfo_parse.c     |   4 +

>>  platform/linux-generic/arch/default/odp_cpu_arch.c |  11 +

>>  .../linux-generic/arch/default/odp_sysinfo_parse.c |   4 +

>>  platform/linux-generic/arch/mips64/odp_cpu_arch.c  |  11 +

>>  .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |   4 +

>>  platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  11 +

>>  .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |   4 +

>>  platform/linux-generic/arch/x86/cpu_flags.c        | 358

>> +++++++++++++++++++++

>>  platform/linux-generic/arch/x86/cpu_flags.h        |  20 ++

>>  platform/linux-generic/arch/x86/odp_cpu_arch.c     |  59 ++++

>>  .../linux-generic/arch/x86/odp_sysinfo_parse.c     |   6 +

>>  .../include/odp/api/plat/time_types.h              |  23 +-

>>  platform/linux-generic/include/odp_internal.h      |   1 +

>>  platform/linux-generic/include/odp_time_internal.h |  24 ++

>>  platform/linux-generic/odp_system_info.c           |  20 ++

>>  platform/linux-generic/odp_time.c                  | 303

>> +++++++++++++----

>>  test/common_plat/performance/odp_sched_latency.c   |  18 +-

>>  test/common_plat/validation/api/system/system.c    |   8 +

>>  test/common_plat/validation/api/system/system.h    |   1 +

>>  test/common_plat/validation/api/time/Makefile.am   |   2 +-

>>  test/common_plat/validation/api/time/time.c        |  74 ++++-

>>  test/common_plat/validation/api/time/time_main.c   |   2 +-

>>  .../validation/api/time/{time.h => time_test.h}    |   0

>>  27 files changed, 898 insertions(+), 96 deletions(-)

>>  create mode 100644 platform/linux-generic/arch/x86/cpu_flags.c

>>  create mode 100644 platform/linux-generic/arch/x86/cpu_flags.h

>>  create mode 100644 platform/linux-generic/include/odp_time_internal.h

>>  rename test/common_plat/validation/api/time/{time.h => time_test.h}

>> (100%)

>>

>> --

>> 2.11.0

>>

>>

>