23 Apr, 2020

1 commit

  • Commit 2d4f27999b88 ("perf data: Add global path holder") missed path
    conversion in tests/topology.c, causing the "Session topology" testcase
    to "hang" (waits forever for input from stdin) when doing "ssh $VM perf
    test".

    Can be reproduced by running "cat | perf test topo", and crashed by
    replacing cat with true:

    $ true | perf test -v topo
    40: Session topology :
    --- start ---
    test child forked, pid 3638
    templ file: /tmp/perf-test-QPvAch
    incompatible file format
    incompatible file format (rerun with -v to learn more)
    free(): invalid pointer
    test child interrupted
    ---- end ----
    Session topology: FAILED!

    Committer testing:

    Reproduced the above result before the patch and after it is back
    working:

    # true | perf test -v topo
    41: Session topology :
    --- start ---
    test child forked, pid 19374
    templ file: /tmp/perf-test-YOTEQg
    CPU 0, core 0, socket 0
    CPU 1, core 1, socket 0
    CPU 2, core 2, socket 0
    CPU 3, core 3, socket 0
    CPU 4, core 0, socket 0
    CPU 5, core 1, socket 0
    CPU 6, core 2, socket 0
    CPU 7, core 3, socket 0
    test child finished with 0
    ---- end ----
    Session topology: Ok
    #

    Fixes: 2d4f27999b88 ("perf data: Add global path holder")
    Signed-off-by: Tommi Rantala
    Tested-by: Arnaldo Carvalho de Melo
    Acked-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Mamatha Inamdar
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Ravi Bangoria
    Link: http://lore.kernel.org/lkml/20200423115341.562782-1-tommi.t.rantala@nokia.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Tommi Rantala
     

21 Sep, 2019

1 commit

  • This patch is to return error code of perf_new_session function on
    failure instead of NULL.

    Test Results:

    Before Fix:

    $ perf c2c report -input
    failed to open nput: No such file or directory

    $ echo $?
    0
    $

    After Fix:

    $ perf c2c report -input
    failed to open nput: No such file or directory

    $ echo $?
    254
    $

    Committer notes:

    Fix 'perf tests topology' case, where we use that TEST_ASSERT_VAL(...,
    session), i.e. we need to pass zero in case of failure, which was the
    case before when NULL was returned by perf_session__new() for failure,
    but now we need to negate the result of IS_ERR(session) to respect that
    TEST_ASSERT_VAL) expectation of zero meaning failure.

    Reported-by: Nageswara R Sastry
    Signed-off-by: Mamatha Inamdar
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Nageswara R Sastry
    Acked-by: Ravi Bangoria
    Reviewed-by: Jiri Olsa
    Reviewed-by: Mukesh Ojha
    Cc: Adrian Hunter
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Greg Kroah-Hartman
    Cc: Jeremie Galarneau
    Cc: Kate Stewart
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Shawn Landden
    Cc: Song Liu
    Cc: Thomas Gleixner
    Cc: Tzvetomir Stoyanov
    Link: http://lore.kernel.org/lkml/20190822071223.17892.45782.stgit@localhost.localdomain
    Signed-off-by: Arnaldo Carvalho de Melo

    Mamatha Inamdar
     

20 Sep, 2019

2 commits


30 Jul, 2019

3 commits

  • Moving the following functions from tools/perf:

    cpu_map__new()
    cpu_map__read()

    to libperf with the following names:

    perf_cpu_map__new()
    perf_cpu_map__read()

    Committer notes:

    Fixed up this one:

    tools/perf/arch/arm/util/cs-etm.c

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20190721112506.12306-44-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Moving the following functions:

    cpu_map__get()
    cpu_map__put()

    to libperf with following names:

    perf_cpu_map__get()
    perf_cpu_map__put()

    Committer notes:

    Added fixes for arm/arm64

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20190721112506.12306-31-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Rename struct cpu_map to struct perf_cpu_map, so it could be part of
    libperf.

    Committer notes:

    Added fixes for arm64, provided by Jiri.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: Alexey Budankov
    Cc: Andi Kleen
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20190721112506.12306-3-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

25 Jun, 2018

1 commit

  • On s390 this test case fails because the socket identifiction numbers
    assigned to the CPU are higher than the CPU identification numbers.

    F/ix this by adding the platform architecture into the perf data header
    flag information. This helps identifiing the test platform and handles
    s390 specifics in process_cpu_topology().

    Before:

    [root@p23lp27 perf]# perf test -vvvvv -F 39
    39: Session topology :
    --- start ---
    templ file: /tmp/perf-test-iUv755
    socket_id number is too big.You may need to upgrade the perf tool.
    ---- end ----
    Session topology: Skip
    [root@p23lp27 perf]#

    After:

    [root@p23lp27 perf]# perf test -vvvvv -F 39
    39: Session topology :
    --- start ---
    templ file: /tmp/perf-test-8X8VTs
    CPU 0, core 0, socket 6
    CPU 1, core 1, socket 3
    ---- end ----
    Session topology: Ok
    [root@p23lp27 perf]#

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Fixes: c84974ed9fb6 ("perf test: Add entry to test cpu topology")
    Link: http://lkml.kernel.org/r/20180611073153.15592-2-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Richter
     

30 May, 2018

1 commit

  • The "perf test Session topology" entry fails with core dump on s390. The root
    cause is a NULL pointer dereference in function check_cpu_topology() line 76
    (or line 82 without -v).

    The session->header.env.cpu variable is NULL because on s390 function
    process_cpu_topology() returns with error:

    socket_id number is too big.
    You may need to upgrade the perf tool.

    and releases the env.cpu variable via zfree() and sets it to NULL.

    Here is the gdb output:
    (gdb) n
    76 pr_debug("CPU %d, core %d, socket %d\n", i,
    (gdb) n

    Program received signal SIGSEGV, Segmentation fault.
    0x00000000010f4d9e in check_cpu_topology (path=0x3ffffffd6c8
    "/tmp/perf-test-J6CHMa", map=0x14a1740) at tests/topology.c:76
    76 pr_debug("CPU %d, core %d, socket %d\n", i,
    (gdb)

    Make sure the env.cpu variable is not used when its NULL.
    Test for NULL pointer and return TEST_SKIP if so.

    Output before:

    [root@p23lp27 perf]# ./perf test -F 39
    39: Session topology :Segmentation fault (core dumped)
    [root@p23lp27 perf]#

    Output after:

    [root@p23lp27 perf]# ./perf test -vF 39
    39: Session topology :
    --- start ---
    templ file: /tmp/perf-test-Ajx59D
    socket_id number is too big.You may need to upgrade the perf tool.
    ---- end ----
    Session topology: Skip
    [root@p23lp27 perf]#

    Signed-off-by: Thomas Richter
    Cc: Heiko Carstens
    Cc: Hendrik Brueckner
    Cc: Martin Schwidefsky
    Link: http://lkml.kernel.org/r/20180528073657.11743-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Thomas Richter
     

07 Nov, 2017

1 commit

  • Conflicts:
    tools/perf/arch/arm/annotate/instructions.c
    tools/perf/arch/arm64/annotate/instructions.c
    tools/perf/arch/powerpc/annotate/instructions.c
    tools/perf/arch/s390/annotate/instructions.c
    tools/perf/arch/x86/tests/intel-cqm.c
    tools/perf/ui/tui/progress.c
    tools/perf/util/zlib.c

    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

31 Oct, 2017

2 commits

  • Add struct perf_data_file to represent a single file within a perf_data
    struct.

    Signed-off-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Changbin Du
    Cc: David Ahern
    Cc: Jin Yao
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-c3f9p4xzykr845ktqcek6p4t@git.kernel.org
    [ Fixup recent changes in 'perf script --per-event-dump' ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • Rename struct perf_data_file to perf_data, because we will add the
    possibility to have multiple files under perf.data, so the 'perf_data'
    name fits better.

    Signed-off-by: Jiri Olsa
    Cc: Andi Kleen
    Cc: Changbin Du
    Cc: David Ahern
    Cc: Jin Yao
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-39wn4d77phel3dgkzo3lyan0@git.kernel.org
    [ Fixup recent changes in 'perf script --per-event-dump' ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

11 Aug, 2017

1 commit

  • This way we'll be able to pass more test specific parameters without
    having to change this function signature.

    Will be used by the upcoming 'shell tests', shell scripts that will
    call perf tools and check if they work as expected, comparing its
    effects on the system (think 'perf probe foo') the output produced, etc.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Thomas Richter
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-wq250w7j1opbzyiynozuajbl@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

17 Feb, 2017

1 commit

  • There are 2 problems wrt. cpu_topology_map on systems with sparse CPUs:

    1. offline/absent CPUs will have their socket_id and core_id set to -1
    which triggers:
    "socket_id number is too big.You may need to upgrade the perf tool."

    2. size of cpu_topology_map (perf_env.cpu[]) is allocated based on
    _SC_NPROCESSORS_CONF, but can be indexed with CPU ids going above.
    Users of perf_env.cpu[] are using CPU id as index. This can lead
    to read beyond what was allocated:
    ==19991== Invalid read of size 4
    ==19991== at 0x490CEB: check_cpu_topology (topology.c:69)
    ==19991== by 0x490CEB: test_session_topology (topology.c:106)
    ...

    For example:
    _SC_NPROCESSORS_CONF == 16
    available: 2 nodes (0-1)
    node 0 cpus: 0 6 8 10 16 22 24 26
    node 0 size: 12004 MB
    node 0 free: 9470 MB
    node 1 cpus: 1 7 9 11 23 25 27
    node 1 size: 12093 MB
    node 1 free: 9406 MB
    node distances:
    node 0 1
    0: 10 20
    1: 20 10

    This patch changes HEADER_NRCPUS.nr_cpus_available from _SC_NPROCESSORS_CONF
    to max_present_cpu and updates any user of cpu_topology_map to iterate
    with nr_cpus_avail.

    As a consequence HEADER_CPU_TOPOLOGY core_id and socket_id lists get longer,
    but maintain compatibility with pre-patch state - index to cpu_topology_map is
    CPU id.

    perf test 36 -v
    36: Session topology :
    --- start ---
    test child forked, pid 22211
    templ file: /tmp/perf-test-gmdX5i
    CPU 0, core 0, socket 0
    CPU 1, core 0, socket 1
    CPU 6, core 10, socket 0
    CPU 7, core 10, socket 1
    CPU 8, core 1, socket 0
    CPU 9, core 1, socket 1
    CPU 10, core 9, socket 0
    CPU 11, core 9, socket 1
    CPU 16, core 0, socket 0
    CPU 22, core 10, socket 0
    CPU 23, core 10, socket 1
    CPU 24, core 1, socket 0
    CPU 25, core 1, socket 1
    CPU 26, core 9, socket 0
    CPU 27, core 9, socket 1
    test child finished with 0
    ---- end ----
    Session topology: Ok

    Signed-off-by: Jan Stancek
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/d7c05c6445fca74a8442c2c73cfffd349c52c44f.1487146877.git.jstancek@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Jan Stancek
     

20 Nov, 2015

1 commit

  • Some tests have sub-tests we want to run, so allow passing this.

    Wang tried to avoid having to touch all tests, but then, having the
    test.func in an anonymous union makes the build fail on older compilers,
    like the one in RHEL6, where:

    test a = {
    .func = foo,
    };

    fails.

    To fix it leave the func pointer in the main structure and pass the subtest
    index to all tests, end result function is the same, but we have just one
    function pointer, not two, with and without the subtest index as an argument.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

20 Oct, 2015

1 commit

  • Adding data arg to cpu_map__build_map callback, so we could pass data
    along to the callback. It'll be needed in following patches to retrieve
    topology info from perf.data.

    Signed-off-by: Jiri Olsa
    Tested-by: Kan Liang
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1444992092-17897-41-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

14 Sep, 2015

1 commit

  • This patch test cpu core_id and socket_id which are stored in perf_env.

    Commiter note:

    # perf test topo
    40: Test topology in session: Ok

    # perf test -v topo
    40: Test topology in session:
    --- start ---
    test child forked, pid 31767
    templ file: /tmp/perf-test-VTZ1PL
    CPU 0, core 0, socket 0
    CPU 1, core 1, socket 0
    CPU 2, core 0, socket 0
    CPU 3, core 1, socket 0
    test child finished with 0
    ---- end ----
    Test topology in session: Ok
    #

    Based-on-a-patch-by: Jiri Olsa
    Signed-off-by: Kan Liang
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Andi Kleen
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1441357111-64522-1-git-send-email-kan.liang@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Kan Liang