• Thomas Richter's avatar
    perf test: Fix error message for test case 71 on s390, where it is not supported · 5bb017d4
    Thomas Richter authored
    Test case 71 'Convert perf time to TSC' is not supported on s390.
    
    Subtest 71.1 is skipped with the correct message, but subtest 71.2 is
    not skipped and fails.
    
    The root cause is function evlist__open() called from
    test__perf_time_to_tsc().  evlist__open() returns -ENOENT because the
    event cycles:u is not supported by the selected PMU, for example
    platform s390 on z/VM or an x86_64 virtual machine.
    
    The PMU driver returns -ENOENT in this case. This error is leads to the
    failure.
    
    Fix this by returning TEST_SKIP on -ENOENT.
    
    Output before:
     71: Convert perf time to TSC:
     71.1: TSC support:             Skip (This architecture does not support)
     71.2: Perf time to TSC:        FAILED!
    
    Output after:
     71: Convert perf time to TSC:
     71.1: TSC support:             Skip (This architecture does not support)
     71.2: Perf time to TSC:        Skip (perf_read_tsc_conversion is not supported)
    
    This also happens on an x86_64 virtual machine:
       # uname -m
       x86_64
       $ ./perf test -F 71
        71: Convert perf time to TSC  :
        71.1: TSC support             : Ok
        71.2: Perf time to TSC        : FAILED!
       $
    
    Committer testing:
    
    Continues to work on x86_64:
    
      $ perf test 71
       71: Convert perf time to TSC    :
       71.1: TSC support               : Ok
       71.2: Perf time to TSC          : Ok
      $
    
    Fixes: 290fa68b ("perf test tsc: Fix error message when not supported")
    Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
    Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Chengdong Li <chengdongli@tencent.com>
    Cc: chengdongli@tencent.com
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Link: https://lore.kernel.org/r/20220420062921.1211825-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    5bb017d4
perf-time-to-tsc.c 5.47 KB