mbox series

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

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

Message

Petri Savolainen April 24, 2017, 10:49 a.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.

v2:
  * Use ODP_PRINT instead of printf
  * Removed couple of time.hw.reserved set to zero. One remains since otherwise
    GCC suspects usage of unintialized variable (false warning).
  * Fixed install of new arch/x86/cpu_flag files


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/Makefile.inc                              |   4 +-
 platform/linux-generic/Makefile.am                 |   5 +
 platform/linux-generic/arch/arm/odp_cpu_arch.c     |  16 +
 .../linux-generic/arch/arm/odp_sysinfo_parse.c     |   4 +
 platform/linux-generic/arch/default/odp_cpu_arch.c |  16 +
 .../linux-generic/arch/default/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/mips64/odp_cpu_arch.c  |  16 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  |   4 +
 platform/linux-generic/arch/powerpc/odp_cpu_arch.c |  16 +
 .../linux-generic/arch/powerpc/odp_sysinfo_parse.c |   4 +
 platform/linux-generic/arch/x86/cpu_flags.c        | 368 +++++++++++++++++++++
 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           |  30 ++
 platform/linux-generic/odp_time.c                  | 300 +++++++++++++----
 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
 28 files changed, 938 insertions(+), 97 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 24, 2017, 3:39 p.m. UTC | #1
For this series:

Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>

On Mon, Apr 24, 2017 at 5:49 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.

>

> v2:

>   * Use ODP_PRINT instead of printf

>   * Removed couple of time.hw.reserved set to zero. One remains since

> otherwise

>     GCC suspects usage of unintialized variable (false warning).

>   * Fixed install of new arch/x86/cpu_flag files

>

>

> 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/Makefile.inc                              |   4 +-

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

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

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

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

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

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

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

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

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

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

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

>  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           |  30 ++

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

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

>  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

>  28 files changed, 938 insertions(+), 97 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

>

>