1. 11 Nov, 2015 2 commits
    • Michael Petlan's avatar
      perf annotate: Support full source file paths for srcline fix · 4a4c03c1
      Michael Petlan authored
      The --full-paths option did not show the full source file paths in the 'perf
      annotate' tool, because the value of the option was not propagated into the
      related functions.
      
      With this patch the value of the --full-paths option is known to the function
      that composes the srcline string, so it prints the full path when necessary.
      
      Committer Note:
      
      This affects annotate when the --print-line option is used:
      
        # perf annotate -h 2>&1 | grep print-line
            -l, --print-line      print matching source lines (may be slow)
      
      Looking just at the lines that should be affected by this change:
      
      Before:
      
        # perf annotate --print-line --full-paths --stdio fput | grep '\.[ch]:[0-9]\+'
           94.44 atomic64_64.h:114
            5.56 file_table.c:265
         file_table.c:265    5.56 :	  ffffffff81219a00:       callq  ffffffff81769360 <__fentry__>
         atomic64_64.h:114   94.44 :	  ffffffff81219a05:       lock decq 0x38(%rdi)
      
      After:
      
        # perf annotate --print-line --full-paths --stdio fput | grep '\.[ch]:[0-9]\+'
           94.44 /home/git/linux/arch/x86/include/asm/atomic64_64.h:114
            5.56 /home/git/linux/fs/file_table.c:265
         /home/git/linux/fs/file_table.c:265    5.56 :	  ffffffff81219a00:       callq  ffffffff81769360 <__fentry__>
         /home/git/linux/arch/x86/include/asm/atomic64_64.h:114   94.44 :	  ffffffff81219a05:       lock decq 0x38(%rdi)
        #
      Signed-off-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://permalink.gmane.org/gmane.linux.kernel.perf.user/2365Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4a4c03c1
    • Yunlong Song's avatar
      perf test: Add llvm-src-base.c and llvm-src-kbuild.c to .gitignore · 3d07b3be
      Yunlong Song authored
      Commit b31de018 ("perf test: Enhance the
      LLVM test: update basic BPF test program") dynamically creates file
      llvm-src-base.c during the perf building.
      
      Similarly, the commit 7af3f3d5 ("perf
      test: Enhance the LLVM tests: add kbuild test") dynamically creates file
      llvm-src-kbuild.c during the perf building. Add them to .gitignore.
      Signed-off-by: default avatarYunlong Song <yunlong.song@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: b31de018 ("perf test: Enhance the LLVM test: update basic BPF test program")
      Fixes: 7af3f3d5 ("perf test: Enhance the LLVM tests: add kbuild test")
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d07b3be
  2. 09 Nov, 2015 2 commits
  3. 08 Nov, 2015 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-2' of... · bad9bc2d
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      Fixes:
      
        - libbpf error reporting improvements, using a strerror interface to
          more precisely tell the user about problems with the provided
          scriptlet, be it in C or as a ready made object file (Wang Nan)
      
        - Do not be case sensitive when searching for matching 'perf test'
          entries (Arnaldo Carvalho de Melo)
      
        - Inform the user about objdump failures in 'perf annotate' (Andi Kleen)
      
      Infrastructure changes:
      
        - Improve the LLVM 'perf test' entry, introduce a new ones for
          BPF and kbuild tests to check the environment used by clang to
          compile .c scriptlets (Wang Nan)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      bad9bc2d
  4. 06 Nov, 2015 10 commits
    • Arnaldo Carvalho de Melo's avatar
      perf test: Do not be case sensitive when searching for matching tests · 345c99a3
      Arnaldo Carvalho de Melo authored
      Before:
      
        # perf test llvm
        # perf test LLVM
        35: Test LLVM searching and compiling                        : Ok
        #
      
      After
      
        # perf test llvm
        35: Test LLVM searching and compiling                        : Ok
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-c1u05npqbf6epse17ovfejoj@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      345c99a3
    • Wang Nan's avatar
      perf test: Add 'perf test BPF' · ba1fae43
      Wang Nan authored
      This patch adds BPF testcase for testing BPF event filtering.
      
      By utilizing the result of 'perf test LLVM', this patch compiles the
      eBPF sample program then test its ability. The BPF script in 'perf test
      LLVM' lets only 50% samples generated by epoll_pwait() to be captured.
      This patch runs that system call for 111 times, so the result should
      contain 56 samples.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446817783-86722-8-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ba1fae43
    • Wang Nan's avatar
      perf test: Enhance the LLVM tests: add kbuild test · 7af3f3d5
      Wang Nan authored
      This patch adds a kbuild testcase to check whether kernel headers can be
      correctly found.
      
      For example:
        # mv /lib/modules/4.3.0-rc5{,.bak}
        # perf test LLVM
      
          38: Test LLVM searching and compiling                        : Skip
      
        # perf test -v LLVM
        ...
        <stdin>:11:10: fatal error: 'uapi/linux/fs.h' file not found
        #include <uapi/linux/fs.h>
                ^
        1 error generated.
        ERROR:	unable to compile -
        Hint:	Check error message shown above.
        Hint:	You can also pre-compile it into .o using:
           		 clang -target bpf -O2 -c -
      	 with proper -I and -D options.
        Failed to compile test case: 'Test kbuild searching'
        test child finished with -2
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446817783-86722-7-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7af3f3d5
    • Wang Nan's avatar
      perf test: Enhance the LLVM test: update basic BPF test program · b31de018
      Wang Nan authored
      This patch replaces the original toy BPF program with the previously
      introduced bpf-script-example.c. Dynamically embeddeding it into
      'llvm-src-base.c'.
      
      The newly introduced BPF program attaches a BPF program to
      'sys_epoll_pwait()'. perf itself never use that syscall, so further test
      can verify their result with it. The program would generate 1 sample in
      every 2 calls of epoll_pwait() system call.
      
      Since the resulting BPF object is useful per se for further tests,
      test_llvm__fetch_bpf_obj() is introduced for creating BPF objects from
      source. The LLVM test was rewritten to use it.
      
      Committer note:
      
      Running it:
      
        [root@zoo wb]# perf test -v LLVM
        35: Test LLVM searching and compiling                        :
        --- start ---
        test child forked, pid 17740
        Kernel build dir is set to /lib/modules/4.3.0-rc1+/build
        set env: KBUILD_DIR=/lib/modules/4.3.0-rc1+/build
        unset env: KBUILD_OPTS
        include option is set to  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include -I/home/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -I/home/git/linux/include -Iinclude -I/home/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/home/git/linux/include/uapi -Iinclude/generated/uapi -include /home/git/linux/include/linux/kconfig.h
        set env: NR_CPUS=4
        set env: LINUX_VERSION_CODE=0x40300
        set env: CLANG_EXEC=/usr/libexec/icecc/bin/clang
        set env: CLANG_OPTIONS=-xc
        set env: KERNEL_INC_OPTIONS= -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include -I/home/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -I/home/git/linux/include -Iinclude -I/home/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/home/git/linux/include/uapi -Iinclude/generated/uapi -include /home/git/linux/include/linux/kconfig.h
        set env: WORKING_DIR=/lib/modules/4.3.0-rc1+/build
        set env: CLANG_SOURCE=-
        llvm compiling command template: echo '/*
         * bpf-script-example.c
         * Test basic LLVM building
         */
        #ifndef LINUX_VERSION_CODE
        # error Need LINUX_VERSION_CODE
        # error Example: for 4.2 kernel, put 'clang-opt="-DLINUX_VERSION_CODE=0x40200" into llvm section of ~/.perfconfig'
        #endif
        #define BPF_ANY 0
        #define BPF_MAP_TYPE_ARRAY 2
        #define BPF_FUNC_map_lookup_elem 1
        #define BPF_FUNC_map_update_elem 2
      
        static void *(*bpf_map_lookup_elem)(void *map, void *key) =
      	  (void *) BPF_FUNC_map_lookup_elem;
        static void *(*bpf_map_update_elem)(void *map, void *key, void *value, int flags) =
      	  (void *) BPF_FUNC_map_update_elem;
      
        struct bpf_map_def {
      	  unsigned int type;
      	  unsigned int key_size;
      	  unsigned int value_size;
      	  unsigned int max_entries;
        };
      
        #define SEC(NAME) __attribute__((section(NAME), used))
        struct bpf_map_def SEC("maps") flip_table = {
      	  .type = BPF_MAP_TYPE_ARRAY,
      	  .key_size = sizeof(int),
      	  .value_size = sizeof(int),
      	  .max_entries = 1,
        };
      
        SEC("func=sys_epoll_pwait")
        int bpf_func__sys_epoll_pwait(void *ctx)
        {
      	  int ind =0;
      	  int *flag = bpf_map_lookup_elem(&flip_table, &ind);
      	  int new_flag;
      	  if (!flag)
      		  return 0;
      	  /* flip flag and store back */
      	  new_flag = !*flag;
      	  bpf_map_update_elem(&flip_table, &ind, &new_flag, BPF_ANY);
      	  return new_flag;
        }
        char _license[] SEC("license") = "GPL";
        int _version SEC("version") = LINUX_VERSION_CODE;
        ' | $CLANG_EXEC -D__KERNEL__ -D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
        test child finished with 0
        ---- end ----
        Test LLVM searching and compiling: Ok
        [root@zoo wb]#
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446817783-86722-6-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b31de018
    • Wang Nan's avatar
      perf bpf: Improve BPF related error messages · d3e0ce39
      Wang Nan authored
      A series of bpf loader related error codes were introduced to help error
      reporting. Functions were improved to return these new error codes.
      
      Functions which return pointers were adjusted to encode error codes into
      return value using the ERR_PTR() interface.
      
      bpf_loader_strerror() was improved to convert these error messages to
      strings. It checks the error codes and calls libbpf_strerror() and
      strerror_r() accordingly, so caller don't need to consider checking the
      range of the error code.
      
      In bpf__strerror_load(), print kernel version of running kernel and the
      object's 'version' section to notify user how to fix his/her program.
      
      v1 -> v2:
       Use macro for error code.
      
       Fetch error message based on array index, eliminate for-loop.
      
       Print version strings.
      
      Before:
      
        # perf record -e ./test_kversion_nomatch_program.o sleep 1
        event syntax error: './test_kversion_nomatch_program.o'
                             \___ Failed to load program: Validate your program and check 'license'/'version' sections in your object
        SKIP
      
        After:
      
        # perf record -e ./test_kversion_nomatch_program.o ls
        event syntax error: './test_kversion_nomatch_program.o'
                             \___ 'version' (4.4.0) doesn't match running kernel (4.3.0)
        SKIP
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446818289-87444-1-git-send-email-wangnan0@huawei.com
      [ Add 'static inline' to bpf__strerror_prepare_load() when LIBBPF is disabled ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d3e0ce39
    • Wang Nan's avatar
      perf tools: Make fetch_kernel_version() publicly available · 07bc5c69
      Wang Nan authored
      There are 2 places in llvm-utils.c which find kernel version information
      through uname. This patch extracts the uname related code into a
      fetch_kernel_version() function and puts it into util.h so it can be
      reused.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446818135-87310-1-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      07bc5c69
    • Wang Nan's avatar
      bpf tools: Add new API bpf_object__get_kversion() · 45825d8a
      Wang Nan authored
      bpf_object__get_kversion() can be used to fetch value of object's
      'version' section. Following patch will use it for error reporting.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446817783-86722-3-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      45825d8a
    • Wang Nan's avatar
      bpf tools: Improve libbpf error reporting · 6371ca3b
      Wang Nan authored
      In this patch, a series of libbpf specific error numbers and
      libbpf_strerror() are introduced to help reporting errors.
      
      Functions are updated to pass correct the error number through the
      CHECK_ERR() macro.
      
      All users of bpf_object__open{_buffer}() and bpf_program__title() in
      perf are modified accordingly. In addition, due to the error codes
      changing, bpf__strerror_load() is also modified to use them.
      
      bpf__strerror_head() is also changed accordingly so it can parse libbpf
      errors. bpf_loader_strerror() is introduced for that purpose, and will
      be improved by the following patch.
      
      load_program() is improved not to dump log buffer if it is empty. log
      buffer is also used to deduce whether the error was caused by an invalid
      program or other problem.
      
      v1 -> v2:
      
       - Using macro for error code.
      
       - Fetch error message based on array index, eliminate for-loop.
      
       - Use log buffer to detect the reason of failure. 3 new error code
         are introduced to replace LIBBPF_ERRNO__LOAD.
      
      In v1:
      
        # perf record -e ./test_ill_program.o ls
        event syntax error: './test_ill_program.o'
                             \___ Failed to load program: Validate your program and check 'license'/'version' sections in your object
        SKIP
      
        # perf record -e ./test_kversion_nomatch_program.o ls
        event syntax error: './test_kversion_nomatch_program.o'
                             \___ Failed to load program: Validate your program and check 'license'/'version' sections in your object
        SKIP
      
        # perf record -e ./test_big_program.o ls
        event syntax error: './test_big_program.o'
                             \___ Failed to load program: Validate your program and check 'license'/'version' sections in your object
        SKIP
      
        In v2:
      
        # perf record -e ./test_ill_program.o ls
        event syntax error: './test_ill_program.o'
                             \___ Kernel verifier blocks program loading
        SKIP
      
        # perf record -e ./test_kversion_nomatch_program.o
        event syntax error: './test_kversion_nomatch_program.o'
                             \___ Incorrect kernel version
        SKIP
        (Will be further improved by following patches)
      
        # perf record -e ./test_big_program.o
        event syntax error: './test_big_program.o'
                             \___ Program too big
        SKIP
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446817783-86722-2-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6371ca3b
    • Masami Hiramatsu's avatar
      perf probe: Cleanup find_perf_probe_point_from_map to reduce redundancy · 0a62f686
      Masami Hiramatsu authored
      In find_perf_probe_point_from_map(), the 'ret' variable is initialized
      with -ENOENT but overwritten by the return code of
      kernel_get_symbol_address_by_name(), and after that it is re-initialized
      with -ENOENT again.
      
      Setting ret=-ENOENT twice looks a bit redundant. This avoids the
      overwriting and just returns -ENOENT if some error happens to simplify
      the code.
      Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/n/tip-ufp1zgbktzmttcputozneomd@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0a62f686
    • Andi Kleen's avatar
      perf annotate: Inform the user about objdump failures in --stdio · 62ec9b3f
      Andi Kleen authored
      When the browser fails to annotate it is difficult for users to find out
      what went wrong.
      
      Add some errors for objdump failures that are displayed in the UI.
      
      Note it would be even better to handle these errors smarter, like
      falling back to the binary when the debug info is somehow corrupted. But
      for now just giving a better error is an improvement.
      
      Committer note:
      
      This works for --stdio, where errors just scroll by the screen:
      
        # perf annotate --stdio intel_idle
        Failure running objdump  --start-address=0xffffffff81418290 --stop-address=0xffffffff814183ae -l -d --no-show-raw -S -C /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1 2>/dev/null|grep -v /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1|expand
         Percent |      Source code & Disassembly of vmlinux for cycles:pp
        ------------------------------------------------------------------
      
      And with that one can use that command line to try to find out more about what
      happened instead of getting a blank screen, an improvement.
      
      We need tho to improve this further to get it to work with other UIs, like
      --tui and --gtk, where it continues showing a blank screen, no messages, as
      the pr_err() used is enough just for --stdio.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1446779167-18949-1-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      62ec9b3f
  5. 05 Nov, 2015 9 commits
  6. 04 Nov, 2015 16 commits
    • Andi Kleen's avatar
      perf stat: Use common printout function to avoid duplicated code · eedfcb4b
      Andi Kleen authored
      Instead of every caller deciding whether to call abs or nsec printout
      do it all in a single central function. No functional changes.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/1446515428-7450-3-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      eedfcb4b
    • Andi Kleen's avatar
      perf stat: Move sw clock metrics printout to stat-shadow · 4579ecc8
      Andi Kleen authored
      The sw clock metrics printing was missed in the earlier move to
      stat-shadow of all the other metric printouts. Move it too.
      
      v2: Fix metrics printing in this version to make bisect safe.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/1446515428-7450-2-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4579ecc8
    • Linus Torvalds's avatar
      Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 66ef3493
      Linus Torvalds authored
      Pull x86 platform changes from Ingo Molnar:
       "Misc updates to the Intel MID and SGI UV platforms"
      
      * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/intel-mid: Make intel_mid_ops static
        arch/x86/intel-mid: Use kmemdup rather than duplicating its implementation
        x86/platform/uv: Implement simple dump failover if kdump fails
        x86/platform/uv: Insert per_cpu accessor function on uv_hub_nmi
      66ef3493
    • Linus Torvalds's avatar
      Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 639ab3eb
      Linus Torvalds authored
      Pull x86 mm changes from Ingo Molnar:
       "The main changes are: continued PAT work by Toshi Kani, plus a new
        boot time warning about insecure RWX kernel mappings, by Stephen
        Smalley.
      
        The new CONFIG_DEBUG_WX=y warning is marked default-y if
        CONFIG_DEBUG_RODATA=y is already eanbled, as a special exception, as
        these bugs are hard to notice and this check already found several
        live bugs"
      
      * 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Warn on W^X mappings
        x86/mm: Fix no-change case in try_preserve_large_page()
        x86/mm: Fix __split_large_page() to handle large PAT bit
        x86/mm: Fix try_preserve_large_page() to handle large PAT bit
        x86/mm: Fix gup_huge_p?d() to handle large PAT bit
        x86/mm: Fix slow_virt_to_phys() to handle large PAT bit
        x86/mm: Fix page table dump to show PAT bit
        x86/asm: Add pud_pgprot() and pmd_pgprot()
        x86/asm: Fix pud/pmd interfaces to handle large PAT bit
        x86/asm: Add pud/pmd mask interfaces to handle large PAT bit
        x86/asm: Move PUD_PAGE macros to page_types.h
        x86/vdso32: Define PGTABLE_LEVELS to 32bit VDSO
      639ab3eb
    • Linus Torvalds's avatar
      Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4302d506
      Linus Torvalds authored
      Pull x86 sigcontext header cleanups from Ingo Molnar:
       "This series reorganizes and cleans up various aspects of the main
        sigcontext UAPI headers, such as unifying the data structures and
        updating/adding lots of comments to explain all the ABI details and
        quirks.  The headers can now also be built in user-space standalone"
      
      * 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/headers: Clean up too long lines
        x86/headers: Remove <asm/sigcontext.h> references on the kernel side
        x86/headers: Remove direct sigcontext32.h uses
        x86/headers: Convert sigcontext_ia32 uses to sigcontext_32
        x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32'
        x86/headers: Make sigcontext pointers bit independent
        x86/headers: Move the 'struct sigcontext' definitions into the UAPI header
        x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean
        x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32
        x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate
        x86/headers: Unify register type definitions between 32-bit compat and i386
        x86/headers: Use ABI types consistently in sigcontext*.h
        x86/headers: Separate out legacy user-space structure definitions
        x86/headers: Clean up and better document uapi/asm/sigcontext.h
        x86/headers: Clean up uapi/asm/sigcontext32.h
        x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
      4302d506
    • Linus Torvalds's avatar
      Merge branch 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ce4d72fa
      Linus Torvalds authored
      Pull x86 fpu changes from Ingo Molnar:
       "There are two main areas of changes:
      
         - Rework of the extended FPU state code to robustify the kernel's
           usage of cpuid provided xstate sizes - and related changes (Dave
           Hansen)"
      
         - math emulation enhancements: new modern FPU instructions support,
           with testcases, plus cleanups (Denys Vlasnko)"
      
      * 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
        x86/fpu: Fixup uninitialized feature_name warning
        x86/fpu/math-emu: Add support for FISTTP instructions
        x86/fpu/math-emu, selftests: Add test for FISTTP instructions
        x86/fpu/math-emu: Add support for FCMOVcc insns
        x86/fpu/math-emu: Add support for F[U]COMI[P] insns
        x86/fpu/math-emu: Remove define layer for undocumented opcodes
        x86/fpu/math-emu, selftests: Add tests for FCMOV and FCOMI insns
        x86/fpu/math-emu: Remove !NO_UNDOC_CODE
        x86/fpu: Check CPU-provided sizes against struct declarations
        x86/fpu: Check to ensure increasing-offset xstate offsets
        x86/fpu: Correct and check XSAVE xstate size calculations
        x86/fpu: Add C structures for AVX-512 state components
        x86/fpu: Rework YMM definition
        x86/fpu/mpx: Rework MPX 'xstate' types
        x86/fpu: Add xfeature_enabled() helper instead of test_bit()
        x86/fpu: Remove 'xfeature_nr'
        x86/fpu: Rework XSTATE_* macros to remove magic '2'
        x86/fpu: Rename XFEATURES_NR_MAX
        x86/fpu: Rename XSAVE macros
        x86/fpu: Remove partial LWP support definitions
        ...
      ce4d72fa
    • Linus Torvalds's avatar
      Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0f25f2c1
      Linus Torvalds authored
      Pull x86 kgdb fixlet from Ingo Molnar:
       "A single debugging related commit: compress the memory usage of a kgdb
        data structure"
      
      * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap
      0f25f2c1
    • Linus Torvalds's avatar
      Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f323c49b
      Linus Torvalds authored
      Pull x86 cpu changes from Ingo Molnar:
       "Two changes in this cycle: a Kconfig help text enhancement, and an AMD
        CLZERO instruction capability detection and enumeration"
      
      * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Add CLZERO detection
        x86/Kconfig/cpus: Fix/complete CPU type help texts
      f323c49b
    • Linus Torvalds's avatar
      Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 33d46f97
      Linus Torvalds authored
      Pull x86 cleanups from Ingo Molnar:
       "An early_printk cleanup plus deinlining enhancements"
      
      * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/early_printk: Set __iomem address space for IO
        x86/signal: Deinline get_sigframe, save 240 bytes
        x86: Deinline early_console_register, save 403 bytes
        x86/e820: Deinline e820_type_to_string, save 126 bytes
      33d46f97
    • Linus Torvalds's avatar
      Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 378e4e98
      Linus Torvalds authored
      Pull x86 boot cleanup from Ingo Molnar:
       "A single commit: remove an obsolete kcrash boot flag"
      
      * 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/kexec: Remove obsolete 'in_crash_kexec' flag
      378e4e98
    • Linus Torvalds's avatar
      Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a75a3f6f
      Linus Torvalds authored
      Pull x86 asm changes from Ingo Molnar:
       "The main change in this cycle is another step in the big x86 system
        call interface rework by Andy Lutomirski, which moves most of the low
        level x86 entry code from assembly to C, for all syscall entries
        except native 64-bit system calls:
      
          arch/x86/entry/entry_32.S        | 182 ++++------
          arch/x86/entry/entry_64_compat.S | 547 ++++++++-----------------------
          194 insertions(+), 535 deletions(-)
      
        ... our hope is that the final remaining step (converting native
        64-bit system calls) will be less painful as all the previous steps,
        given that most of the legacies and quirks are concentrated around
        native 32-bit and compat environments"
      
      * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (47 commits)
        x86/entry/32: Fix FS and GS restore in opportunistic SYSEXIT
        x86/entry/32: Fix entry_INT80_32() to expect interrupts to be on
        um/x86: Fix build after x86 syscall changes
        x86/asm: Remove the xyz_cfi macros from dwarf2.h
        selftests/x86: Style fixes for the 'unwind_vdso' test
        x86/entry/64/compat: Document sysenter_fix_flags's reason for existence
        x86/entry: Split and inline syscall_return_slowpath()
        x86/entry: Split and inline prepare_exit_to_usermode()
        x86/entry: Use pt_regs_to_thread_info() in syscall entry tracing
        x86/entry: Hide two syscall entry assertions behind CONFIG_DEBUG_ENTRY
        x86/entry: Micro-optimize compat fast syscall arg fetch
        x86/entry: Force inlining of 32-bit syscall code
        x86/entry: Make irqs_disabled checks in exit code depend on lockdep
        x86/entry: Remove unnecessary IRQ twiddling in fast 32-bit syscalls
        x86/asm: Remove thread_info.sysenter_return
        x86/entry/32: Re-implement SYSENTER using the new C path
        x86/entry/32: Switch INT80 to the new C syscall path
        x86/entry/32: Open-code return tracking from fork and kthreads
        x86/entry/compat: Implement opportunistic SYSRETL for compat syscalls
        x86/vdso/compat: Wire up SYSENTER and SYSCSALL for compat userspace
        ...
      a75a3f6f
    • Linus Torvalds's avatar
      Merge branch 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d2bea739
      Linus Torvalds authored
      Pull x86 apic changes from Ingo Molnar:
       "The main changes in this cycle were:
      
         - Numachip updates: new hardware support, fixes and cleanups.
           (Daniel J Blueman)
      
         - misc smaller cleanups and fixlets"
      
      * 'x86-apic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/io_apic: Make eoi_ioapic_pin() static
        x86/irq: Drop unlikely before IS_ERR_OR_NULL
        x86/x2apic: Make stub functions available even if !CONFIG_X86_LOCAL_APIC
        x86/apic: Deinline various functions
        x86/numachip: Fix timer build conflict
        x86/numachip: Introduce Numachip2 timer mechanisms
        x86/numachip: Add Numachip IPI optimisations
        x86/numachip: Add Numachip2 APIC support
        x86/numachip: Cleanup Numachip support
      d2bea739
    • Linus Torvalds's avatar
      Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 53528695
      Linus Torvalds authored
      Pull scheduler changes from Ingo Molnar:
       "The main changes in this cycle were:
      
         - sched/fair load tracking fixes and cleanups (Byungchul Park)
      
         - Make load tracking frequency scale invariant (Dietmar Eggemann)
      
         - sched/deadline updates (Juri Lelli)
      
         - stop machine fixes, cleanups and enhancements for bugs triggered by
           CPU hotplug stress testing (Oleg Nesterov)
      
         - scheduler preemption code rework: remove PREEMPT_ACTIVE and related
           cleanups (Peter Zijlstra)
      
         - Rework the sched_info::run_delay code to fix races (Peter Zijlstra)
      
         - Optimize per entity utilization tracking (Peter Zijlstra)
      
         - ... misc other fixes, cleanups and smaller updates"
      
      * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (57 commits)
        sched: Don't scan all-offline ->cpus_allowed twice if !CONFIG_CPUSETS
        sched: Move cpu_active() tests from stop_two_cpus() into migrate_swap_stop()
        sched: Start stopper early
        stop_machine: Kill cpu_stop_threads->setup() and cpu_stop_unpark()
        stop_machine: Kill smp_hotplug_thread->pre_unpark, introduce stop_machine_unpark()
        stop_machine: Change cpu_stop_queue_two_works() to rely on stopper->enabled
        stop_machine: Introduce __cpu_stop_queue_work() and cpu_stop_queue_two_works()
        stop_machine: Ensure that a queued callback will be called before cpu_stop_park()
        sched/x86: Fix typo in __switch_to() comments
        sched/core: Remove a parameter in the migrate_task_rq() function
        sched/core: Drop unlikely behind BUG_ON()
        sched/core: Fix task and run queue sched_info::run_delay inconsistencies
        sched/numa: Fix task_tick_fair() from disabling numa_balancing
        sched/core: Add preempt_count invariant check
        sched/core: More notrace annotations
        sched/core: Kill PREEMPT_ACTIVE
        sched/core, sched/x86: Kill thread_info::saved_preempt_count
        sched/core: Simplify preempt_count tests
        sched/core: Robustify preemption leak checks
        sched/core: Stop setting PREEMPT_ACTIVE
        ...
      53528695
    • Linus Torvalds's avatar
      Merge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b831ef2c
      Linus Torvalds authored
      Pull RAS changes from Ingo Molnar:
       "The main system reliability related changes were from x86, but also
        some generic RAS changes:
      
         - AMD MCE error injection subsystem enhancements.  (Aravind
           Gopalakrishnan)
      
         - Fix MCE and CPU hotplug interaction bug.  (Ashok Raj)
      
         - kcrash bootup robustness fix.  (Baoquan He)
      
         - kcrash cleanups.  (Borislav Petkov)
      
         - x86 microcode driver rework: simplify it by unmodularizing it and
           other cleanups.  (Borislav Petkov)"
      
      * 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
        x86/mce: Add a default case to the switch in __mcheck_cpu_ancient_init()
        x86/mce: Add a Scalable MCA vendor flags bit
        MAINTAINERS: Unify the microcode driver section
        x86/microcode/intel: Move #ifdef DEBUG inside the function
        x86/microcode/amd: Remove maintainers from comments
        x86/microcode: Remove modularization leftovers
        x86/microcode: Merge the early microcode loader
        x86/microcode: Unmodularize the microcode driver
        x86/mce: Fix thermal throttling reporting after kexec
        kexec/crash: Say which char is the unrecognized
        x86/setup/crash: Check memblock_reserve() retval
        x86/setup/crash: Cleanup some more
        x86/setup/crash: Remove alignment variable
        x86/setup: Cleanup crashkernel reservation functions
        x86/amd_nb, EDAC: Rename amd_get_node_id()
        x86/setup: Do not reserve crashkernel high memory if low reservation failed
        x86/microcode/amd: Do not overwrite final patch levels
        x86/microcode/amd: Extract current patch level read to a function
        x86/ras/mce_amd_inj: Inject bank 4 errors on the NBC
        x86/ras/mce_amd_inj: Trigger deferred and thresholding errors interrupts
        ...
      b831ef2c
    • Linus Torvalds's avatar
      Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b02ac6b1
      Linus Torvalds authored
      Pull perf updates from Ingo Molnar:
       "Kernel side changes:
      
         - Improve accuracy of perf/sched clock on x86.  (Adrian Hunter)
      
         - Intel DS and BTS updates.  (Alexander Shishkin)
      
         - Intel cstate PMU support.  (Kan Liang)
      
         - Add group read support to perf_event_read().  (Peter Zijlstra)
      
         - Branch call hardware sampling support, implemented on x86 and
           PowerPC.  (Stephane Eranian)
      
         - Event groups transactional interface enhancements.  (Sukadev
           Bhattiprolu)
      
         - Enable proper x86/intel/uncore PMU support on multi-segment PCI
           systems.  (Taku Izumi)
      
         - ... misc fixes and cleanups.
      
        The perf tooling team was very busy again with 200+ commits, the full
        diff doesn't fit into lkml size limits.  Here's an (incomplete) list
        of the tooling highlights:
      
        New features:
      
         - Change the default event used in all tools (record/top): use the
           most precise "cycles" hw counter available, i.e. when the user
           doesn't specify any event, it will try using cycles:ppp, cycles:pp,
           etc and fall back transparently until it finds a working counter.
           (Arnaldo Carvalho de Melo)
      
         - Integration of perf with eBPF that, given an eBPF .c source file
           (or .o file built for the 'bpf' target with clang), will get it
           automatically built, validated and loaded into the kernel via the
           sys_bpf syscall, which can then be used and seen using 'perf trace'
           and other tools.
      
           (Wang Nan)
      
        Various user interface improvements:
      
         - Automatic pager invocation on long help output.  (Namhyung Kim)
      
         - Search for more options when passing args to -h, e.g.: (Arnaldo
           Carvalho de Melo)
      
              $ perf report -h interface
      
              Usage: perf report [<options>]
      
               --gtk    Use the GTK2 interface
               --stdio  Use the stdio interface
               --tui    Use the TUI interface
      
         - Show ordered command line options when -h is used or when an
           unknown option is specified.  (Arnaldo Carvalho de Melo)
      
         - If options are passed after -h, show just its descriptions, not all
           options.  (Arnaldo Carvalho de Melo)
      
         - Implement column based horizontal scrolling in the hists browser
           (top, report), making it possible to use the TUI for things like
           'perf mem report' where there are many more columns than can fit in
           a terminal.  (Arnaldo Carvalho de Melo)
      
         - Enhance the error reporting of tracepoint event parsing, e.g.:
      
             $ oldperf record -e sched:sched_switc usleep 1
             event syntax error: 'sched:sched_switc'
                                  \___ unknown tracepoint
             Run 'perf list' for a list of valid events
      
           Now we get the much nicer:
      
             $ perf record -e sched:sched_switc ls
             event syntax error: 'sched:sched_switc'
                                  \___ can't access trace events
      
             Error: No permissions to read /sys/kernel/debug/tracing/events/sched/sched_switc
             Hint:  Try 'sudo mount -o remount,mode=755 /sys/kernel/debug'
      
           And after we have those mount point permissions fixed:
      
             $ perf record -e sched:sched_switc ls
             event syntax error: 'sched:sched_switc'
                                  \___ unknown tracepoint
      
             Error: File /sys/kernel/debug/tracing/events/sched/sched_switc not found.
             Hint:  Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
      
           I.e.  basically now the event parsing routing uses the strerror_open()
           routines introduced by and used in 'perf trace' work.  (Jiri Olsa)
      
         - Fail properly when pattern matching fails to find a tracepoint,
           i.e. '-e non:existent' was being correctly handled, with a proper
           error message about that not being a valid event, but '-e
           non:existent*' wasn't, fix it.  (Jiri Olsa)
      
         - Do event name substring search as last resort in 'perf list'.
           (Arnaldo Carvalho de Melo)
      
           E.g.:
      
             # perf list clock
      
             List of pre-defined events (to be used in -e):
      
              cpu-clock                                          [Software event]
              task-clock                                         [Software event]
      
              uncore_cbox_0/clockticks/                          [Kernel PMU event]
              uncore_cbox_1/clockticks/                          [Kernel PMU event]
      
              kvm:kvm_pvclock_update                             [Tracepoint event]
              kvm:kvm_update_master_clock                        [Tracepoint event]
              power:clock_disable                                [Tracepoint event]
              power:clock_enable                                 [Tracepoint event]
              power:clock_set_rate                               [Tracepoint event]
              syscalls:sys_enter_clock_adjtime                   [Tracepoint event]
              syscalls:sys_enter_clock_getres                    [Tracepoint event]
              syscalls:sys_enter_clock_gettime                   [Tracepoint event]
              syscalls:sys_enter_clock_nanosleep                 [Tracepoint event]
              syscalls:sys_enter_clock_settime                   [Tracepoint event]
              syscalls:sys_exit_clock_adjtime                    [Tracepoint event]
              syscalls:sys_exit_clock_getres                     [Tracepoint event]
              syscalls:sys_exit_clock_gettime                    [Tracepoint event]
              syscalls:sys_exit_clock_nanosleep                  [Tracepoint event]
              syscalls:sys_exit_clock_settime                    [Tracepoint event]
      
        Intel PT hardware tracing enhancements:
      
         - Accept a zero --itrace period, meaning "as often as possible".  In
           the case of Intel PT that is the same as a period of 1 and a unit
           of 'instructions' (i.e.  --itrace=i1i).  (Adrian Hunter)
      
         - Harmonize itrace's synthesized callchains with the existing
           --max-stack tool option.  (Adrian Hunter)
      
         - Allow time to be displayed in nanoseconds in 'perf script'.
           (Adrian Hunter)
      
         - Fix potential infinite loop when handling Intel PT timestamps.
           (Adrian Hunter)
      
         - Slighly improve Intel PT debug logging.  (Adrian Hunter)
      
         - Warn when AUX data has been lost, just like when processing
           PERF_RECORD_LOST.  (Adrian Hunter)
      
         - Further document export-to-postgresql.py script.  (Adrian Hunter)
      
         - Add option to synthesize branch stack from auxtrace data.  (Adrian
           Hunter)
      
        Misc notable changes:
      
         - Switch the default callchain output mode to 'graph,0.5,caller', to
           make it look like the default for other tools, reducing the
           learning curve for people used to 'caller' based viewing.  (Arnaldo
           Carvalho de Melo)
      
         - various call chain usability enhancements.  (Namhyung Kim)
      
         - Introduce the 'P' event modifier, meaning 'max precision level,
           please', i.e.:
      
              $ perf record -e cycles:P usleep 1
      
           Is now similar to:
      
              $ perf record usleep 1
      
           Useful, for instance, when specifying multiple events.  (Jiri Olsa)
      
         - Add 'socket' sort entry, to sort by the processor socket in 'perf
           top' and 'perf report'.  (Kan Liang)
      
         - Introduce --socket-filter to 'perf report', for filtering by
           processor socket.  (Kan Liang)
      
         - Add new "Zoom into Processor Socket" operation in the perf hists
           browser, used in 'perf top' and 'perf report'.  (Kan Liang)
      
         - Allow probing on kmodules without DWARF.  (Masami Hiramatsu)
      
         - Fix 'perf probe -l' for probes added to kernel module functions.
           (Masami Hiramatsu)
      
         - Preparatory work for the 'perf stat record' feature that will allow
           generating perf.data files with counting data in addition to the
           sampling mode we have now (Jiri Olsa)
      
         - Update libtraceevent KVM plugin.  (Paolo Bonzini)
      
         - ... plus lots of other enhancements that I failed to list properly,
           by: Adrian Hunter, Alexander Shishkin, Andi Kleen, Andrzej Hajda,
           Arnaldo Carvalho de Melo, Dima Kogan, Don Zickus, Geliang Tang, He
           Kuang, Huaitong Han, Ingo Molnar, Jan Stancek, Jiri Olsa, Kan
           Liang, Kirill Tkhai, Masami Hiramatsu, Matt Fleming, Namhyung Kim,
           Paolo Bonzini, Peter Zijlstra, Rabin Vincent, Scott Wood, Stephane
           Eranian, Sukadev Bhattiprolu, Taku Izumi, Vaishali Thakkar, Wang
           Nan, Yang Shi and Yunlong Song"
      
      * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (260 commits)
        perf unwind: Pass symbol source to libunwind
        tools build: Fix libiberty feature detection
        perf tools: Compile scriptlets to BPF objects when passing '.c' to --event
        perf record: Add clang options for compiling BPF scripts
        perf bpf: Attach eBPF filter to perf event
        perf tools: Make sure fixdep is built before libbpf
        perf script: Enable printing of branch stack
        perf trace: Add cmd string table to decode sys_bpf first arg
        perf bpf: Collect perf_evsel in BPF object files
        perf tools: Load eBPF object into kernel
        perf tools: Create probe points for BPF programs
        perf tools: Enable passing bpf object file to --event
        perf ebpf: Add the libbpf glue
        perf tools: Make perf depend on libbpf
        perf symbols: Fix endless loop in dso__split_kallsyms_for_kcore
        perf tools: Enable pre-event inherit setting by config terms
        perf symbols: we can now read separate debug-info files based on a build ID
        perf symbols: Fix type error when reading a build-id
        perf tools: Search for more options when passing args to -h
        perf stat: Cache aggregated map entries in extra cpumap
        ...
      b02ac6b1
    • Linus Torvalds's avatar
      atomic: remove all traces of READ_ONCE_CTRL() and atomic*_read_ctrl() · 105ff3cb
      Linus Torvalds authored
      This seems to be a mis-reading of how alpha memory ordering works, and
      is not backed up by the alpha architecture manual.  The helper functions
      don't do anything special on any other architectures, and the arguments
      that support them being safe on other architectures also argue that they
      are safe on alpha.
      
      Basically, the "control dependency" is between a previous read and a
      subsequent write that is dependent on the value read.  Even if the
      subsequent write is actually done speculatively, there is no way that
      such a speculative write could be made visible to other cpu's until it
      has been committed, which requires validating the speculation.
      
      Note that most weakely ordered architectures (very much including alpha)
      do not guarantee any ordering relationship between two loads that depend
      on each other on a control dependency:
      
          read A
          if (val == 1)
              read B
      
      because the conditional may be predicted, and the "read B" may be
      speculatively moved up to before reading the value A.  So we require the
      user to insert a smp_rmb() between the two accesses to be correct:
      
          read A;
          if (A == 1)
              smp_rmb()
              read B
      
      Alpha is further special in that it can break that ordering even if the
      *address* of B depends on the read of A, because the cacheline that is
      read later may be stale unless you have a memory barrier in between the
      pointer read and the read of the value behind a pointer:
      
          read ptr
          read offset(ptr)
      
      whereas all other weakly ordered architectures guarantee that the data
      dependency (as opposed to just a control dependency) will order the two
      accesses.  As a result, alpha needs a "smp_read_barrier_depends()" in
      between those two reads for them to be ordered.
      
      The coontrol dependency that "READ_ONCE_CTRL()" and "atomic_read_ctrl()"
      had was a control dependency to a subsequent *write*, however, and
      nobody can finalize such a subsequent write without having actually done
      the read.  And were you to write such a value to a "stale" cacheline
      (the way the unordered reads came to be), that would seem to lose the
      write entirely.
      
      So the things that make alpha able to re-order reads even more
      aggressively than other weak architectures do not seem to be relevant
      for a subsequent write.  Alpha memory ordering may be strange, but
      there's no real indication that it is *that* strange.
      
      Also, the alpha architecture reference manual very explicitly talks
      about the definition of "Dependence Constraints" in section 5.6.1.7,
      where a preceding read dominates a subsequent write.
      
      Such a dependence constraint admittedly does not impose a BEFORE (alpha
      architecture term for globally visible ordering), but it does guarantee
      that there can be no "causal loop".  I don't see how you could avoid
      such a loop if another cpu could see the stored value and then impact
      the value of the first read.  Put another way: the read and the write
      could not be seen as being out of order wrt other cpus.
      
      So I do not see how these "x_ctrl()" functions can currently be necessary.
      
      I may have to eat my words at some point, but in the absense of clear
      proof that alpha actually needs this, or indeed even an explanation of
      how alpha could _possibly_ need it, I do not believe these functions are
      called for.
      
      And if it turns out that alpha really _does_ need a barrier for this
      case, that barrier still should not be "smp_read_barrier_depends()".
      We'd have to make up some new speciality barrier just for alpha, along
      with the documentation for why it really is necessary.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul E McKenney <paulmck@us.ibm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      105ff3cb