1. 08 8月, 2017 1 次提交
    • T
      bpf: fix selftest/bpf/test_pkt_md_access on s390x · f9ea3225
      Thomas Richter 提交于
      Commit 18f3d6be ("selftests/bpf: Add test cases to test narrower ctx field loads")
      introduced new eBPF test cases. One of them (test_pkt_md_access.c)
      fails on s390x. The BPF verifier error message is:
      
      [root@s8360046 bpf]# ./test_progs
      test_pkt_access:PASS:ipv4 349 nsec
      test_pkt_access:PASS:ipv6 212 nsec
      [....]
      libbpf: load bpf program failed: Permission denied
      libbpf: -- BEGIN DUMP LOG ---
      libbpf:
      0: (71) r2 = *(u8 *)(r1 +0)
      invalid bpf_context access off=0 size=1
      
      libbpf: -- END LOG --
      libbpf: failed to load program 'test1'
      libbpf: failed to load object './test_pkt_md_access.o'
      Summary: 29 PASSED, 1 FAILED
      [root@s8360046 bpf]#
      
      This is caused by a byte endianness issue. S390x is a big endian
      architecture.  Pointer access to the lowest byte or halfword of a
      four byte value need to add an offset.
      On little endian architectures this offset is not needed.
      
      Fix this and use the same approach as the originator used for other files
      (for example test_verifier.c) in his original commit.
      
      With this fix the test program test_progs succeeds on s390x:
      [root@s8360046 bpf]# ./test_progs
      test_pkt_access:PASS:ipv4 236 nsec
      test_pkt_access:PASS:ipv6 217 nsec
      test_xdp:PASS:ipv4 3624 nsec
      test_xdp:PASS:ipv6 1722 nsec
      test_l4lb:PASS:ipv4 926 nsec
      test_l4lb:PASS:ipv6 1322 nsec
      test_tcp_estats:PASS: 0 nsec
      test_bpf_obj_id:PASS:get-fd-by-notexist-prog-id 0 nsec
      test_bpf_obj_id:PASS:get-fd-by-notexist-map-id 0 nsec
      test_bpf_obj_id:PASS:get-prog-info(fd) 0 nsec
      test_bpf_obj_id:PASS:get-map-info(fd) 0 nsec
      test_bpf_obj_id:PASS:get-prog-info(fd) 0 nsec
      test_bpf_obj_id:PASS:get-map-info(fd) 0 nsec
      test_bpf_obj_id:PASS:get-prog-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-prog-info(next_id->fd) 0 nsec
      test_bpf_obj_id:PASS:get-prog-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-prog-info(next_id->fd) 0 nsec
      test_bpf_obj_id:PASS:check total prog id found by get_next_id 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:check get-map-info(next_id->fd) 0 nsec
      test_bpf_obj_id:PASS:get-map-fd(next_id) 0 nsec
      test_bpf_obj_id:PASS:check get-map-info(next_id->fd) 0 nsec
      test_bpf_obj_id:PASS:check total map id found by get_next_id 0 nsec
      test_pkt_md_access:PASS: 277 nsec
      Summary: 30 PASSED, 0 FAILED
      [root@s8360046 bpf]#
      
      Fixes: 18f3d6be ("selftests/bpf: Add test cases to test narrower ctx field loads")
      Signed-off-by: NThomas Richter <tmricht@linux.vnet.ibm.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f9ea3225
  2. 05 8月, 2017 2 次提交
    • D
      bpf: fix byte order test in test_verifier · 2c460621
      Daniel Borkmann 提交于
      We really must check with #if __BYTE_ORDER == XYZ instead of
      just presence of #ifdef __LITTLE_ENDIAN. I noticed that when
      actually running this on big endian machine, the latter test
      resolves to true for user space, same for #ifdef __BIG_ENDIAN.
      
      E.g., looking at endian.h from libc, both are also defined
      there, so we really must test this against __BYTE_ORDER instead
      for proper insns selection. For the kernel, such checks are
      fine though e.g. see 13da9e20 ("Revert "endian: #define
      __BYTE_ORDER"") and 415586c9 ("UAPI: fix endianness conditionals
      in M32R's asm/stat.h") for some more context, but not for
      user space. Lets also make sure to properly include endian.h.
      After that, suite passes for me:
      
      ./test_verifier: ELF 64-bit MSB executable, [...]
      
      Linux foo 4.13.0-rc3+ #4 SMP Fri Aug 4 06:59:30 EDT 2017 s390x s390x s390x GNU/Linux
      
      Before fix: Summary: 505 PASSED, 11 FAILED
      After  fix: Summary: 516 PASSED,  0 FAILED
      
      Fixes: 18f3d6be ("selftests/bpf: Add test cases to test narrower ctx field loads")
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NYonghong <yhs@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2c460621
    • D
      bpf, s390: fix build for libbpf and selftest suite · bad1926d
      Daniel Borkmann 提交于
      The BPF feature test as well as libbpf is missing the __NR_bpf
      define for s390 and currently refuses to compile (selftest suite
      depends on libbpf as well). Similar issue was fixed some time
      ago via b0c47807 ("bpf: Add sparc support to tools and
      samples."), just do the same and add definitions.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bad1926d
  3. 27 7月, 2017 3 次提交
  4. 25 7月, 2017 1 次提交
  5. 21 7月, 2017 4 次提交
  6. 15 7月, 2017 2 次提交
    • L
      kmod: throttle kmod thread limit · 6d7964a7
      Luis R. Rodriguez 提交于
      If we reach the limit of modprobe_limit threads running the next
      request_module() call will fail.  The original reason for adding a kill
      was to do away with possible issues with in old circumstances which would
      create a recursive series of request_module() calls.
      
      We can do better than just be super aggressive and reject calls once we've
      reached the limit by simply making pending callers wait until the
      threshold has been reduced, and then throttling them in, one by one.
      
      This throttling enables requests over the kmod concurrent limit to be
      processed once a pending request completes.  Only the first item queued up
      to wait is woken up.  The assumption here is once a task is woken it will
      have no other option to also kick the queue to check if there are more
      pending tasks -- regardless of whether or not it was successful.
      
      By throttling and processing only max kmod concurrent tasks we ensure we
      avoid unexpected fatal request_module() calls, and we keep memory
      consumption on module loading to a minimum.
      
      With x86_64 qemu, with 4 cores, 4 GiB of RAM it takes the following run
      time to run both tests:
      
      time ./kmod.sh -t 0008
      real    0m16.366s
      user    0m0.883s
      sys     0m8.916s
      
      time ./kmod.sh -t 0009
      real    0m50.803s
      user    0m0.791s
      sys     0m9.852s
      
      Link: http://lkml.kernel.org/r/20170628223155.26472-4-mcgrof@kernel.orgSigned-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Reviewed-by: NPetr Mladek <pmladek@suse.com>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6d7964a7
    • L
      kmod: add test driver to stress test the module loader · d9c6a72d
      Luis R. Rodriguez 提交于
      This adds a new stress test driver for kmod: the kernel module loader.
      The new stress test driver, test_kmod, is only enabled as a module right
      now.  It should be possible to load this as built-in and load tests
      early (refer to the force_init_test module parameter), however since a
      lot of test can get a system out of memory fast we leave this disabled
      for now.
      
      Using a system with 1024 MiB of RAM can *easily* get your kernel OOM
      fast with this test driver.
      
      The test_kmod driver exposes API knobs for us to fine tune simple
      request_module() and get_fs_type() calls.  Since these API calls only
      allow each one parameter a test driver for these is rather simple.
      Other factors that can help out test driver though are the number of
      calls we issue and knowing current limitations of each.  This exposes
      configuration as much as possible through userspace to be able to build
      tests directly from userspace.
      
      Since it allows multiple misc devices its will eventually (once we add a
      knob to let us create new devices at will) also be possible to perform
      more tests in parallel, provided you have enough memory.
      
      We only enable tests we know work as of right now.
      
      Demo screenshots:
      
       # tools/testing/selftests/kmod/kmod.sh
      kmod_test_0001_driver: OK! - loading kmod test
      kmod_test_0001_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND
      kmod_test_0001_fs: OK! - loading kmod test
      kmod_test_0001_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL
      kmod_test_0002_driver: OK! - loading kmod test
      kmod_test_0002_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND
      kmod_test_0002_fs: OK! - loading kmod test
      kmod_test_0002_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL
      kmod_test_0003: OK! - loading kmod test
      kmod_test_0003: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0004: OK! - loading kmod test
      kmod_test_0004: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0005: OK! - loading kmod test
      kmod_test_0005: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0006: OK! - loading kmod test
      kmod_test_0006: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0005: OK! - loading kmod test
      kmod_test_0005: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      kmod_test_0006: OK! - loading kmod test
      kmod_test_0006: OK! - Return value: 0 (SUCCESS), expected SUCCESS
      XXX: add test restult for 0007
      Test completed
      
      You can also request for specific tests:
      
       # tools/testing/selftests/kmod/kmod.sh -t 0001
      kmod_test_0001_driver: OK! - loading kmod test
      kmod_test_0001_driver: OK! - Return value: 256 (MODULE_NOT_FOUND), expected MODULE_NOT_FOUND
      kmod_test_0001_fs: OK! - loading kmod test
      kmod_test_0001_fs: OK! - Return value: -22 (-EINVAL), expected -EINVAL
      Test completed
      
      Lastly, the current available number of tests:
      
       # tools/testing/selftests/kmod/kmod.sh --help
      Usage: tools/testing/selftests/kmod/kmod.sh [ -t <4-number-digit> ]
      Valid tests: 0001-0009
      
      0001 - Simple test - 1 thread  for empty string
      0002 - Simple test - 1 thread  for modules/filesystems that do not exist
      0003 - Simple test - 1 thread  for get_fs_type() only
      0004 - Simple test - 2 threads for get_fs_type() only
      0005 - multithreaded tests with default setup - request_module() only
      0006 - multithreaded tests with default setup - get_fs_type() only
      0007 - multithreaded tests with default setup test request_module() and get_fs_type()
      0008 - multithreaded - push kmod_concurrent over max_modprobes for request_module()
      0009 - multithreaded - push kmod_concurrent over max_modprobes for get_fs_type()
      
      The following test cases currently fail, as such they are not currently
      enabled by default:
      
       # tools/testing/selftests/kmod/kmod.sh -t 0008
       # tools/testing/selftests/kmod/kmod.sh -t 0009
      
      To be sure to run them as intended please unload both of the modules:
      
        o test_module
        o xfs
      
      And ensure they are not loaded on your system prior to testing them.  If
      you use these paritions for your rootfs you can change the default test
      driver used for get_fs_type() by exporting it into your environment.  For
      example of other test defaults you can override refer to kmod.sh
      allow_user_defaults().
      
      Behind the scenes this is how we fine tune at a test case prior to
      hitting a trigger to run it:
      
      cat /sys/devices/virtual/misc/test_kmod0/config
      echo -n "2" > /sys/devices/virtual/misc/test_kmod0/config_test_case
      echo -n "ext4" > /sys/devices/virtual/misc/test_kmod0/config_test_fs
      echo -n "80" > /sys/devices/virtual/misc/test_kmod0/config_num_threads
      cat /sys/devices/virtual/misc/test_kmod0/config
      echo -n "1" > /sys/devices/virtual/misc/test_kmod0/config_num_threads
      
      Finally to trigger:
      
      echo -n "1" > /sys/devices/virtual/misc/test_kmod0/trigger_config
      
      The kmod.sh script uses the above constructs to build different test cases.
      
      A bit of interpretation of the current failures follows, first two
      premises:
      
      a) When request_module() is used userspace figures out an optimized
         version of module order for us.  Once it finds the modules it needs, as
         per depmod symbol dep map, it will finit_module() the respective
         modules which are needed for the original request_module() request.
      
      b) We have an optimization in place whereby if a kernel uses
         request_module() on a module already loaded we never bother userspace
         as the module already is loaded.  This is all handled by kernel/kmod.c.
      
      A few things to consider to help identify root causes of issues:
      
      0) kmod 19 has a broken heuristic for modules being assumed to be
         built-in to your kernel and will return 0 even though request_module()
         failed.  Upgrade to a newer version of kmod.
      
      1) A get_fs_type() call for "xfs" will request_module() for "fs-xfs",
         not for "xfs".  The optimization in kernel described in b) fails to
         catch if we have a lot of consecutive get_fs_type() calls.  The reason
         is the optimization in place does not look for aliases.  This means two
         consecutive get_fs_type() calls will bump kmod_concurrent, whereas
         request_module() will not.
      
      This one explanation why test case 0009 fails at least once for
      get_fs_type().
      
      2) If a module fails to load --- for whatever reason (kmod_concurrent
         limit reached, file not yet present due to rootfs switch, out of
         memory) we have a period of time during which module request for the
         same name either with request_module() or get_fs_type() will *also*
         fail to load even if the file for the module is ready.
      
      This explains why *multiple* NULLs are possible on test 0009.
      
      3) finit_module() consumes quite a bit of memory.
      
      4) Filesystems typically also have more dependent modules than other
         modules, its important to note though that even though a get_fs_type()
         call does not incur additional kmod_concurrent bumps, since userspace
         loads dependencies it finds it needs via finit_module_fd(), it *will*
         take much more memory to load a module with a lot of dependencies.
      
      Because of 3) and 4) we will easily run into out of memory failures with
      certain tests.  For instance test 0006 fails on qemu with 1024 MiB of RAM.
      It panics a box after reaping all userspace processes and still not
      having enough memory to reap.
      
      [arnd@arndb.de: add dependencies for test module]
        Link: http://lkml.kernel.org/r/20170630154834.3689272-1-arnd@arndb.de
      Link: http://lkml.kernel.org/r/20170628223155.26472-3-mcgrof@kernel.orgSigned-off-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Michal Marek <mmarek@suse.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d9c6a72d
  7. 13 7月, 2017 7 次提交
  8. 12 7月, 2017 2 次提交
    • A
      perf symbols: Accept zero as the kernel base address · 4b1303d0
      Arnaldo Carvalho de Melo 提交于
      Which is the case in S/390, where symbols were not being resolved
      because machine__get_kernel_start was only setting machine->kernel_start
      when the just successfully loaded kernel symtab had its map->start set
      to !0, when it was left at (1ULL << 63) assuming a partitioning of the
      address space for user/kernel, which is not the case in S/390 nor in
      Sparc.
      
      So just check if map__load() was successfull and set
      machine->kernel_start to zero, fixing kernel symbol resolution on S/390.
      
      Test performed by Thomas:
      
       ----
      
        I like this patch. I have done a new build and removed all my debug output to start
        from scratch. Without your patch I get this:
      
        # Samples: 4  of event 'cpu-clock'
        # Event count (approx.): 1000000
        #
        # Children      Self  Command  Shared Object     Symbol
        # ........  ........  .......  ................  ........................
            75.00%     0.00%  true     [unknown]         [k] 0x00000000004bedda
                    |
                    ---0x4bedda
                       |
                       |--50.00%--0x42693a
                       |          |
                       |           --25.00%--0x2a72e0
                       |                     0x2af0ca
                       |                     0x3d1003fe4c0
                       |
                        --25.00%--0x4272bc
                                  0x26fa84
      
        and with your patch (I just rebuilt the perf tool, nothing else and used the same
        perf.data file as input):
      
        # Samples: 4  of event 'cpu-clock'
        # Event count (approx.): 1000000
        #
        # Children      Self  Command  Shared Object               Symbol
        # ........  ........  .......  ..........................  ..................................
            75.00%     0.00%  true     [kernel.vmlinux]            [k] pgm_check_handler
                    |
                    ---pgm_check_handler
                       do_dat_exception
                       handle_mm_fault
                       __handle_mm_fault
                       filemap_map_pages
                       |
                       |--25.00%--rcu_read_lock_held
                       |          rcu_lockdep_current_cpu_online
                       |          0x3d1003ff4c0
                       |
                        --25.00%--lock_release
      
        Looks good to me....
       ----
      Reported-and-Tested-by: NThomas-Mich Richter <tmricht@linux.vnet.ibm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zvonko Kosic <zvonko.kosic@de.ibm.com>
      Link: http://lkml.kernel.org/n/tip-dk0n1uzmbe0tbthrpfqlx6bz@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4b1303d0
    • Y
      samples/bpf: fix a build issue · 53335022
      Yonghong Song 提交于
      With latest net-next:
      
      ====
      clang  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h  -Isamples/bpf \
          -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
          -Wno-compare-distinct-pointer-types \
          -Wno-gnu-variable-sized-type-not-at-end \
          -Wno-address-of-packed-member -Wno-tautological-compare \
          -Wno-unknown-warning-option \
          -O2 -emit-llvm -c samples/bpf/tcp_synrto_kern.c -o -| llc -march=bpf -filetype=obj -o samples/bpf/tcp_synrto_kern.o
      samples/bpf/tcp_synrto_kern.c:20:10: fatal error: 'bpf_endian.h' file not found
                ^~~~~~~~~~~~~~
      1 error generated.
      ====
      
      net has the same issue.
      
      Add support for ntohl and htonl in tools/testing/selftests/bpf/bpf_endian.h.
      Also move bpf_helpers.h from samples/bpf to selftests/bpf and change
      compiler include logic so that programs in samples/bpf can access the headers
      in selftests/bpf, but not the other way around.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NLawrence Brakmo <brakmo@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      53335022
  9. 11 7月, 2017 3 次提交
  10. 10 7月, 2017 2 次提交
  11. 09 7月, 2017 3 次提交
  12. 08 7月, 2017 1 次提交
    • J
      objtool: Fix sibling call detection logic · 4855022a
      Josh Poimboeuf 提交于
      With some configs, objtool reports the following warning:
      
        arch/x86/kernel/ftrace.o: warning: objtool: ftrace_modify_code_direct()+0x2d: sibling call from callable instruction with modified stack frame
      
      The instruction it's complaining about isn't actually a sibling call.
      It's just a normal jump to an address inside the function.  Objtool
      thought it was a sibling call because the instruction's jump_dest wasn't
      initialized because the function was supposed to be ignored due to its
      use of sync_core().
      
      Objtool ended up validating the function instead of ignoring it because
      it didn't properly recognize a sibling call to the function.  So fix the
      sibling call logic.  Also add a warning to catch ignored functions being
      validated so we'll get a more useful error message next time.
      Reported-by: NMike Galbraith <efault@gmx.de>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/96cc8ecbcdd8cb29ddd783817b4af918a6a171b0.1499437107.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      4855022a
  13. 06 7月, 2017 2 次提交
  14. 04 7月, 2017 2 次提交
    • J
      perf unwind: Do not fail due to missing unwind support · 1934adf7
      Jiri Olsa 提交于
      We currently fail the MMAP event processing if we don't have the MMAP
      event's specific arch unwind support compiled in.
      
      That's wrong and can lead to unresolved mmaps in report output for 32bit
      binaries on 64bit server, like in this example on x86_64 server:
      
        $ cat ex.c
        int main(int argc, char **argv)
        {
                while (1) {}
        }
        $ gcc -o ex -m32 ex.c
        $ perf record ./ex
        ^C[ perf record: Woken up 2 times to write data ]
        [ perf record: Captured and wrote 0.371 MB perf.data (9322 samples) ]
      
      Before:
        $ perf report --stdio
      
        SNIP
      
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ......................
        #
           100.00%  ex       [unknown]         [.] 0x00000000080483de
             0.00%  ex       [unknown]         [.] 0x00000000f76dba4f
             0.00%  ex       [unknown]         [.] 0x00000000f76e4c11
             0.00%  ex       [unknown]         [.] 0x00000000f76daa30
      
      After:
        $ perf report --stdio
      
        SNIP
      
        # Overhead  Command  Shared Object  Symbol
        # ........  .......  .............  ...............
        #
           100.00%  ex       ex             [.] main
             0.00%  ex       ld-2.24.so     [.] _dl_start
             0.00%  ex       ld-2.24.so     [.] do_lookup_x
             0.00%  ex       ld-2.24.so     [.] _start
      
      The fix is not to fail, just warn if there's not unwind support compiled
      in.
      Reported-by: NMichael Lyle <mlyle@lyle.org>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20170704131131.27508-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1934adf7
    • A
      perf evsel: Set attr.exclude_kernel when probing max attr.precise_ip · 97365e81
      Arnaldo Carvalho de Melo 提交于
      We should set attr.exclude_kernel when probing for attr.precise_ip
      level, otherwise !CAP_SYS_ADMIN users will not default to skidless
      samples in capable hardware.
      
      The increase in the paranoid level in commit 0161028b ("perf/core:
      Change the default paranoia level to 2") broke this, fix it by excluding
      kernel samples when probing.
      
      Before:
      
        $ perf record usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.018 MB perf.data (6 samples) ]
        $ perf evlist -v
        cycles:u: sample_freq: 4000, sample_type: IP|TID|TIME|PERIOD, exclude_kernel: 1
      
      After:
      
        $ perf record usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.018 MB perf.data (8 samples) ]
        $ perf evlist -v
        cycles:ppp: sample_freq: 4000, sample_type: IP|TID|TIME|PERIOD, exclude_kernel: 1, precise_ip: 3
                                                                                           ^^^^^^^^^^^^^
                                                                                           ^^^^^^^^^^^^^
                                                                                           ^^^^^^^^^^^^^
        $
      
      To further clarify: we always set .exclude_kernel when non !CAP_SYS_ADMIN
      users profile, its just on the attr.precise_ip probing that we weren't doing
      so, fix it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      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: 7f8d1ade ("perf tools: By default use the most precise "cycles" hw counter available")
      Link: http://lkml.kernel.org/n/tip-t2qttwhbnua62o5gt75cueml@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      97365e81
  15. 03 7月, 2017 2 次提交
  16. 02 7月, 2017 1 次提交
  17. 01 7月, 2017 2 次提交