06 May, 2020

2 commits

  • hex2u64 is a helper that's out of place in kallsyms.h as not being
    kallsyms related. Move from kallsyms.h to the only user.

    Committer notes:

    Move it out of tools/lib/symbol/kallsyms.c as well, as we had to leave
    it there in the previous patch lest we break the build.

    Signed-off-by: Ian Rogers
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lore.kernel.org/lkml/20200501221315.54715-4-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     
  • 'perf record' will call kallsyms__parse 4 times during startup and
    process megabytes of data. This changes kallsyms__parse to use the io
    library rather than fgets to improve performance of the user code by
    over 8%.

    Before:

    Running 'internals/kallsyms-parse' benchmark:
    Average kallsyms__parse took: 103.988 ms (+- 0.203 ms)

    After:

    Running 'internals/kallsyms-parse' benchmark:
    Average kallsyms__parse took: 95.571 ms (+- 0.006 ms)

    For a workload like:

    $ perf record /bin/true
    Run under 'perf record -e cycles:u -g' the time goes from:
    Before
    30.10% 1.67% perf perf [.] kallsyms__parse
    After
    25.55% 20.04% perf perf [.] kallsyms__parse

    So a little under 5% of the start-up time is removed. A lot of what
    remains is on the kernel side, but caching kallsyms within perf would at
    least impact memory footprint.

    Committer notes:

    The internal/kallsyms-parse bench is run using:

    [root@five ~]# perf bench internals kallsyms-parse
    # Running 'internals/kallsyms-parse' benchmark:
    Average kallsyms__parse took: 80.381 ms (+- 0.115 ms)
    [root@five ~]#

    And this pre-existing test uses these routines to parse kallsyms and
    then compare with the info obtained from the matching ELF symtab:

    [root@five ~]# perf test vmlinux
    1: vmlinux symtab matches kallsyms : Ok
    [root@five ~]#

    Also we can't remove hex2u64() in this patch as this breaks the build:

    /usr/bin/ld: /tmp/build/perf/perf-in.o: in function `modules__parse':
    /home/acme/git/perf/tools/perf/util/symbol.c:607: undefined reference to `hex2u64'
    /usr/bin/ld: /home/acme/git/perf/tools/perf/util/symbol.c:607: undefined reference to `hex2u64'
    /usr/bin/ld: /tmp/build/perf/perf-in.o: in function `dso__load_perf_map':
    /home/acme/git/perf/tools/perf/util/symbol.c:1477: undefined reference to `hex2u64'
    /usr/bin/ld: /home/acme/git/perf/tools/perf/util/symbol.c:1483: undefined reference to `hex2u64'
    collect2: error: ld returned 1 exit status

    Leave it there, move it in the next patch.

    Signed-off-by: Ian Rogers
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Mark Rutland
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Cc: Thomas Gleixner
    Link: http://lore.kernel.org/lkml/20200501221315.54715-3-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ian Rogers
     

26 Jun, 2019

3 commits

  • We got the sane_ctype.h headers from git and kept using it so far, but
    since that code originally came from the kernel sources to the git
    sources, perhaps its better to just use the one in the kernel, so that
    we can leverage tools/perf/check_headers.sh to be notified when our copy
    gets out of sync, i.e. when fixes or goodies are added to the code we've
    copied.

    This will help with things like tools/lib/string.c where we want to have
    more things in common with the kernel, such as strim(), skip_spaces(),
    etc so as to go on removing the things that we have in tools/perf/util/
    and instead using the code in the kernel, indirectly and removing things
    like EXPORT_SYMBOL(), etc, getting notified when fixes and improvements
    are made to the original code.

    Hopefully this also should help with reducing the difference of code
    hosted in tools/ to the one in the kernel proper.

    Cc: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-7k9868l713wqtgo01xxygn12@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • It was just including a ../util.h that wasn't even there:

    $ cat tools/perf/util/include/linux/../util.h
    cat: tools/perf/util/include/linux/../util.h: No such file or directory
    $

    This would make kallsyms.h get util.h somehow and then files including
    it would get util.h defined stuff, a mess, fix it.

    Cc: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-wlzwken4psiat4zvfbvaoqiw@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Just removing more stuff from tools/perf/, this is mostly used in the
    kallsyms parsing and in places in perf where kallsyms is involved, so we
    get it for free there.

    With this we reduce a bit more util.h.

    Cc: Adrian Hunter
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-5mc1zg0jqdwgkn8c358kaba6@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

27 Apr, 2018

1 commit

  • Out of symbol_type__is_a(type, MAP__FUNCTION), which is the only variant
    used so far, useful in a kallsyms library and one more step in ditching
    the MAP__FUNCTION/VARIABLE split.

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

    Arnaldo Carvalho de Melo
     

17 Feb, 2018

1 commit

  • Adding check on failed attempt to parse the address and skip the line
    parsing early in that case.

    The address can be replaced with '(null)' string in case user don't have
    enough permissions, like:

    $ cat /proc/kallsyms
    (null) A irq_stack_union
    (null) A __per_cpu_start
    ...

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180215122635.24029-2-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     

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
     

20 Apr, 2017

1 commit


01 Oct, 2015

2 commits

  • Map 't', 'T' (text, local, global), 'w' and 'W' (weak text, local,
    global) as STT_FUNC, and the rest as STT_OBJECT

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

    Arnaldo Carvalho de Melo
     
  • It is about binding, not type, we have just a letter in kallsyms that
    should map both for the ELF type (STT_FUNC, etc) and to the ELF
    symbol binding (STB_WEAK, STB_GLOBAL, etc), so rename it now before
    introducing kallsyms2_elf_type()

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

    Arnaldo Carvalho de Melo
     

13 Dec, 2013

1 commit

  • Eventually this should be useful to other tools/ living utilities.

    For now don't try to build any .a, just trying the minimal approach of
    separating existing code into multiple .c files that can then be
    included wherever they are needed, using whatever build machinery
    already in place.

    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-pfa8i5zpf4bf9rcccryi0lt3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo