1. 22 11月, 2018 1 次提交
    • A
      tools build feature: Check if eventfd() is available · 11c6cbe7
      Arnaldo Carvalho de Melo 提交于
      A new 'perf bench epoll' will use this, and to disable it for older
      systems, add a feature test for this API.
      
      This is just a simple program that if successfully compiled, means that
      the feature is present, at least at the library level, in a build that
      sets the output directory to /tmp/build/perf (using O=/tmp/build/perf),
      we end up with:
      
        $ ls -la /tmp/build/perf/feature/test-eventfd*
        -rwxrwxr-x. 1 acme acme 8176 Nov 21 15:58 /tmp/build/perf/feature/test-eventfd.bin
        -rw-rw-r--. 1 acme acme  588 Nov 21 15:58 /tmp/build/perf/feature/test-eventfd.d
        -rw-rw-r--. 1 acme acme    0 Nov 21 15:58 /tmp/build/perf/feature/test-eventfd.make.output
        $ ldd /tmp/build/perf/feature/test-eventfd.bin
      	  linux-vdso.so.1 (0x00007fff3bf3f000)
      	  libc.so.6 => /lib64/libc.so.6 (0x00007fa984061000)
      	  /lib64/ld-linux-x86-64.so.2 (0x00007fa984417000)
        $ grep eventfd -A 2 -B 2 /tmp/build/perf/FEATURE-DUMP
        feature-dwarf=1
        feature-dwarf_getlocations=1
        feature-eventfd=1
        feature-fortify-source=1
        feature-sync-compare-and-swap=1
        $
      
      The main thing here is that in the end we'll have -DHAVE_EVENTFD in
      CFLAGS, and then the 'perf bench' entry needing that API can be
      selectively pruned.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Davidlohr Bueso <dbueso@suse.de>
      Cc: Jason Baron <jbaron@akamai.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: https://lkml.kernel.org/n/tip-wkeldwob7dpx6jvtuzl8164k@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      11c6cbe7
  2. 20 11月, 2018 1 次提交
  3. 18 7月, 2018 2 次提交
  4. 14 7月, 2018 1 次提交
  5. 12 7月, 2018 4 次提交
  6. 10 4月, 2018 1 次提交
    • R
      Kbuild: fix # escaping in .cmd files for future Make · 9564a8cf
      Rasmus Villemoes 提交于
      I tried building using a freshly built Make (4.2.1-69-g8a731d1), but
      already the objtool build broke with
      
      orc_dump.c: In function ‘orc_dump’:
      orc_dump.c:106:2: error: ‘elf_getshnum’ is deprecated [-Werror=deprecated-declarations]
        if (elf_getshdrnum(elf, &nr_sections)) {
      
      Turns out that with that new Make, the backslash was not removed, so cpp
      didn't see a #include directive, grep found nothing, and
      -DLIBELF_USE_DEPRECATED was wrongly put in CFLAGS.
      
      Now, that new Make behaviour is documented in their NEWS file:
      
        * WARNING: Backward-incompatibility!
          Number signs (#) appearing inside a macro reference or function invocation
          no longer introduce comments and should not be escaped with backslashes:
          thus a call such as:
            foo := $(shell echo '#')
          is legal.  Previously the number sign needed to be escaped, for example:
            foo := $(shell echo '\#')
          Now this latter will resolve to "\#".  If you want to write makefiles
          portable to both versions, assign the number sign to a variable:
            C := \#
            foo := $(shell echo '$C')
          This was claimed to be fixed in 3.81, but wasn't, for some reason.
          To detect this change search for 'nocomment' in the .FEATURES variable.
      
      This also fixes up the two make-cmd instances to replace # with $(pound)
      rather than with \#. There might very well be other places that need
      similar fixup in preparation for whatever future Make release contains
      the above change, but at least this builds an x86_64 defconfig with the
      new make.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      9564a8cf
  7. 08 3月, 2018 3 次提交
  8. 25 1月, 2018 1 次提交
  9. 17 1月, 2018 1 次提交
    • J
      tools: bpftool: add -DPACKAGE when including bfd.h · 39b72ccd
      Jiong Wang 提交于
      bfd.h is requiring including of config.h except when PACKAGE or
      PACKAGE_VERSION are defined.
      
        /* PR 14072: Ensure that config.h is included first.  */
        #if !defined PACKAGE && !defined PACKAGE_VERSION
        #error config.h must be included before this header
        #endif
      
      This check has been introduced since May-2012. It doesn't show up in bfd.h
      on some Linux distribution, probably because distributions have remove it
      when building the package.
      
      However, sometimes the user might just build libfd from source code then
      link bpftool against it. For this case, bfd.h will be original that we need
      to define PACKAGE or PACKAGE_VERSION.
      Acked-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NJiong Wang <jiong.wang@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      39b72ccd
  10. 30 12月, 2017 1 次提交
  11. 05 12月, 2017 1 次提交
  12. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  13. 29 8月, 2017 1 次提交
  14. 05 8月, 2017 1 次提交
  15. 19 7月, 2017 1 次提交
  16. 06 6月, 2017 1 次提交
    • M
      kbuild: simplify silent build (-s) detection · 6f0fa58e
      Masahiro Yamada 提交于
      This allows to detect -s (--silent) option without checking GNU Make
      version.
      
      As commit e36aaea2 ("kbuild: Fix silent builds with make-4")
      pointed out, GNU Make 4.x changed the way/order it presents the
      command line options into MAKEFLAGS.
      
      In Make 3.8x, 's' is always the first in a group of short options.
      The group may be prefixed with '-' in some cases.
      
      In Make 4.x, 's' is always the last in a group of short options.
      
      As commit e6ac89fa ("kbuild: Correctly deal with make options
      which contain an 's'") addressed, we also need to deal with long
      options that contain 's', like --warn-undefined-variables.
      
      Test cases:
      
      [1] command line input:    make --silent
           -> MAKEFLAGS for Make 3.8x:    s
           -> MAKEFLAGS for Make 4.x :    s
      
      [2] command line input:    make -srR
           -> MAKEFLAGS for Make 3.8x:    sRr
           -> MAKEFLAGS for Make 4.x :    rRs
      
      [3] command line input:    make -s -rR --warn-undefined-variables
           -> MAKEFLAGS for Make 3.8x:    --warn-undefined-variables -sRr
           -> MAKEFLAGS for Make 4.x :    rRs --warn-undefined-variables
      
      My idea to cater to all the cases more easily is to filter out long
      options (--%), then search 's' with $(findstring ...).  This way will
      be more future-proof even if future versions of Make put 's' in the
      middle of the group.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      6f0fa58e
  17. 12 5月, 2017 1 次提交
  18. 04 5月, 2017 1 次提交
    • A
      tools build: Fixup sched_getcpu feature test · 1e6e7eae
      Arnaldo Carvalho de Melo 提交于
      We have tools/build/feature/test-all.c to speed up feature testing,
      doing all tests at once, but then all tests in this file should normally
      pass.
      
      That is not the case with the sched-getcpu one, that wasn't passing when
      included from test-all.c because it needs to have _GNU_SOURCE defined
      before including sched.h, but _GNU_SOURCE is defined by a header
      included from another feature test included earlier in test-all.d,
      test-libpython.c, resulting in:
      
        $ cat /tmp/build/perf/feature/test-all.make.output
        In file included from test-all.c:121:0:
        test-sched_getcpu.c:1:0: error: "_GNU_SOURCE" redefined [-Werror]
         #define _GNU_SOURCE
      
        In file included from /usr/include/python2.7/pyconfig.h:6:0,
                         from /usr/include/python2.7/Python.h:8,
                         from test-libpython.c:1,
                         from test-all.c:13:
        /usr/include/python2.7/pyconfig-64.h:1177:0: note: this is the location of the previous definition
         #define _GNU_SOURCE 1
      
        cc1: all warnings being treated as errors
      
      Which would trigger testing the tests individually, when that
      _GNU_SOURCE redefinition would not take place, and the whole process
      would continue, just slower... Fix it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 120010cb ("tools build: Add test for sched_getcpu()")
      Link: http://lkml.kernel.org/n/tip-3qp1it69xsc4w8gnuu1e9ayh@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1e6e7eae
  19. 23 4月, 2017 1 次提交
  20. 13 4月, 2017 1 次提交
  21. 12 4月, 2017 1 次提交
  22. 04 3月, 2017 2 次提交
  23. 18 2月, 2017 1 次提交
    • J
      perf build: Add special fixdep cleaning rule · 85e0d509
      Jiri Olsa 提交于
      Ingo reported following build failure:
      
      On Sat, Feb 11, 2017 at 12:12:34PM +0100, Ingo Molnar wrote:
      >
      > So I had this oldish 32-bit 15.10 Ubuntu installation around (fully updated), and
      > trying to build perf gave me:
      >
      > deimos:~/tip/tools/perf> make
      >   BUILD:   Doing 'make -j4' parallel build
      > make[3]: *** No rule to make target '/usr/include/x86_64-linux-gnu/sys/types.h', needed by 'fixdep.o'.  Stop.
      > Makefile:42: recipe for target 'fixdep-in.o' failed
      > make[2]: *** [fixdep-in.o] Error 2
      > /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
      > make[1]: *** [fixdep] Error 2
      > Makefile:68: recipe for target 'all' failed
      > make: *** [all] Error 2
      >
      > Now this got a bit better after I did a 'make mrproper' in the kernel tree:
      >
      > deimos:~/tip/tools/perf> make
      >   BUILD:   Doing 'make -j4' parallel build
      >   HOSTCC   fixdep.o
      > /home/mingo/tip/tools/build/fixdep: 1: /home/mingo/tip/tools/build/fixdep: Syntax error: "(" unexpected
      > /home/mingo/tip/tools/build/Makefile.build:101: recipe for target 'fixdep.o' failed
      > make[3]: *** [fixdep.o] Error 2
      > Makefile:42: recipe for target 'fixdep-in.o' failed
      > make[2]: *** [fixdep-in.o] Error 2
      > /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
      > make[1]: *** [fixdep] Error 2
      > Makefile:68: recipe for target 'all' failed
      > make: *** [all] Error 2
      >
      > After some digging it turns out that my 'fixdep' binary was 64-bit:
      >
      > deimos:~/tip/tools/perf> file /home/mingo/tip/tools/build/fixdep
      > /home/mingo/tip/tools/build/fixdep: ELF 64-bit LSB executable, x86-64, version 1
      > (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
      > 2.6.32, BuildID[sha1]=d527f736b57b5ba47210fbcb562a3b52867d21c1, not stripped
      >
      > But it did not get cleaned out by 'make clean'.
      >
      > Only after I did a 'make clean' in tools/ itself, did it get built properly.
      
      It shows we don't clean up properly the fixdep objects, so adding
      special rule for that.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Reported-by: NIngo Molnar <mingo@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1487340058-10496-2-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      85e0d509
  24. 27 1月, 2017 1 次提交
  25. 11 12月, 2016 1 次提交
  26. 07 12月, 2016 1 次提交
    • W
      perf build: Check LLVM version in feature check · a940cad3
      Wang Nan 提交于
      Cancel builtin llvm and clang support when LLVM version is less than
      3.9.0: following commits uses newer API.
      
      Since Clang/LLVM's API is not guaranteed to be stable, add a
      test-llvm-version.cpp feature checker, issue warning if LLVM found in
      compiling environment is not tested yet.
      
      Committer Notes:
      
      Testing it:
      
      Environment:
      
        $ cat /etc/fedora-release
        Fedora release 25 (Twenty Five)
        $ rpm -q llvm-devel clang-devel
        llvm-devel-3.8.0-1.fc25.x86_64
        clang-devel-3.8.0-2.fc25.x86_64
        $
      
      Before:
      
        $  make -k LIBCLANGLLVM=1 O=/tmp/build/perf -C tools/perf install-bin
        make: Entering directory '/home/acme/git/linux/tools/perf'
          BUILD:   Doing 'make -j4' parallel build
        Warning: tools/include/uapi/linux/bpf.h differs from kernel
        Warning: tools/arch/arm/include/uapi/asm/kvm.h differs from kernel
          INSTALL  GTK UI
          LINK     /tmp/build/perf/perf
        /tmp/build/perf/libperf.a(libperf-in.o): In function `perf::createCompilerInvocation(llvm::SmallVector<char const*, 16u>, llvm::StringRef&, clang::DiagnosticsEngine&)':
        /home/acme/git/linux/tools/perf/util/c++/clang.cpp:56: undefined reference to `clang::tooling::newInvocation(clang::DiagnosticsEngine*, llvm::SmallVector<char const*, 16u> const&)'
        /tmp/build/perf/libperf.a(libperf-in.o): In function `perf::getModuleFromSource(llvm::SmallVector<char const*, 16u>, llvm::StringRef, llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem>)':
        /home/acme/git/linux/tools/perf/util/c++/clang.cpp:68: undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, bool)'
        /home/acme/git/linux/tools/perf/util/c++/clang.cpp:69: undefined reference to `clang::CompilerInstance::createDiagnostics(clang::DiagnosticConsumer*, bool)'
        <SNIP>
      
      After:
      
        Makefile.config:807: No suitable libLLVM found, disabling builtin clang and llvm support. Please install llvm-dev(el) (>= 3.9.0)
      
      Updating the environment to a locally built LLVM 4.0 + clang 3.9 (forgot
      to git pull, duh) combo, all works as expected, it is properly detected
      and built into the resulting perf binary.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Reported-and-Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Joe Stringer <joe@ovn.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/20161206072230.7651-1-wangnan0@huawei.com
      [ Change the warning message a bit (add 'suitable' and 'builtin'), clarifying it, see committer notes above ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a940cad3
  27. 06 12月, 2016 6 次提交
  28. 14 11月, 2016 1 次提交