• Thomas Richter's avatar
    perf test: Fix failure of 'evsel-tp-sched' test on s390 · aa8c73c8
    Thomas Richter authored
    [ Upstream commit 03d30971 ]
    
    Commit 489338a7 ("perf tests evsel-tp-sched: Fix bitwise operator")
    causes test case 14 "Parse sched tracepoints fields" to fail on s390.
    
    This test succeeds on x86.
    
    In fact this test now fails on all architectures with type char treated
    as type unsigned char.
    
    The root cause is the signed-ness of character arrays in the tracepoints
    sched_switch for structure members prev_comm and next_comm.
    
    On s390 the output of:
    
     [root@m35lp76 perf]# cat /sys/kernel/debug/tracing/events/sched/sched_switch/format
     name: sched_switch
     ID: 287
     format:
       field:unsigned short common_type; offset:0; size:2;	signed:0;
       ...
       field:char prev_comm[16]; offset:8; size:16;	signed:0;
       ...
       field:char next_comm[16]; offset:40; size:16; signed:0;
    
    reveals the character arrays prev_comm and next_comm are per
    default unsigned char and have values in the range of 0..255.
    
    On x86 both fields are signed as this output shows:
     [root@f29]# cat /sys/kernel/debug/tracing/events/sched/sched_switch/format
     name: sched_switch
     ID: 287
     format:
       field:unsigned short common_type; offset:0; size:2;	signed:0;
       ...
       field:char prev_comm[16]; offset:8; size:16;	signed:1;
       ...
       field:char next_comm[16]; offset:40; size:16; signed:1;
    
    and the character arrays prev_comm and next_comm are per default signed
    char and have values in the range of -1..127.  The implementation of
    type char is architecture specific.
    
    Since the character arrays in both tracepoints sched_switch and
    sched_wakeup should contain ascii characters, simply omit the check for
    signedness in the test case.
    
    Output before:
    
      [root@m35lp76 perf]# ./perf test -F 14
      14: Parse sched tracepoints fields                        :
      --- start ---
      sched:sched_switch: "prev_comm" signedness(0) is wrong, should be 1
      sched:sched_switch: "next_comm" signedness(0) is wrong, should be 1
      sched:sched_wakeup: "comm" signedness(0) is wrong, should be 1
      ---- end ----
      14: Parse sched tracepoints fields                        : FAILED!
      [root@m35lp76 perf]#
    
    Output after:
    
      [root@m35lp76 perf]# ./perf test -Fv 14
      14: Parse sched tracepoints fields                        :
      --- start ---
      ---- end ----
      Parse sched tracepoints fields: Ok
      [root@m35lp76 perf]#
    
    Fixes: 489338a7 ("perf tests evsel-tp-sched: Fix bitwise operator")
    Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
    Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Link: http://lkml.kernel.org/r/20190219153639.31267-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    aa8c73c8
Name
Last commit
Last update
..
attr Loading commit data...
shell Loading commit data...
.gitignore Loading commit data...
Build Loading commit data...
attr.c Loading commit data...
attr.py Loading commit data...
backward-ring-buffer.c Loading commit data...
bitmap.c Loading commit data...
bp_account.c Loading commit data...
bp_signal.c Loading commit data...
bp_signal_overflow.c Loading commit data...
bpf-script-example.c Loading commit data...
bpf-script-test-kbuild.c Loading commit data...
bpf-script-test-prologue.c Loading commit data...
bpf-script-test-relocation.c Loading commit data...
bpf.c Loading commit data...
builtin-test.c Loading commit data...
clang.c Loading commit data...
code-reading.c Loading commit data...
cpumap.c Loading commit data...
dso-data.c Loading commit data...
dwarf-unwind.c Loading commit data...
event-times.c Loading commit data...
event_update.c Loading commit data...
evsel-roundtrip-name.c Loading commit data...
evsel-tp-sched.c Loading commit data...
expr.c Loading commit data...
fdarray.c Loading commit data...
hists_common.c Loading commit data...
hists_common.h Loading commit data...
hists_cumulate.c Loading commit data...
hists_filter.c Loading commit data...
hists_link.c Loading commit data...
hists_output.c Loading commit data...
is_printable_array.c Loading commit data...
keep-tracking.c Loading commit data...
kmod-path.c Loading commit data...
llvm.c Loading commit data...
llvm.h Loading commit data...
make Loading commit data...
mem.c Loading commit data...
mem2node.c Loading commit data...
mmap-basic.c Loading commit data...
mmap-thread-lookup.c Loading commit data...
openat-syscall-all-cpus.c Loading commit data...
openat-syscall-tp-fields.c Loading commit data...
openat-syscall.c Loading commit data...
parse-events.c Loading commit data...
parse-no-sample-id-all.c Loading commit data...
perf-hooks.c Loading commit data...
perf-record.c Loading commit data...
perf-targz-src-pkg Loading commit data...
pmu.c Loading commit data...
python-use.c Loading commit data...
sample-parsing.c Loading commit data...
sdt.c Loading commit data...
stat.c Loading commit data...
sw-clock.c Loading commit data...
switch-tracking.c Loading commit data...
task-exit.c Loading commit data...
tests.h Loading commit data...
thread-map.c Loading commit data...
thread-mg-share.c Loading commit data...
topology.c Loading commit data...
unit_number__scnprintf.c Loading commit data...
vmlinux-kallsyms.c Loading commit data...
wp.c Loading commit data...