1. 03 8月, 2018 1 次提交
  2. 31 7月, 2018 1 次提交
    • Y
      tools/bpftool: fix a percpu_array map dump problem · 573b3aa6
      Yonghong Song 提交于
      I hit the following problem when I tried to use bpftool
      to dump a percpu array.
      
        $ sudo ./bpftool map show
        61: percpu_array  name stub  flags 0x0
                key 4B  value 4B  max_entries 1  memlock 4096B
        ...
        $ sudo ./bpftool map dump id 61
        bpftool: malloc.c:2406: sysmalloc: Assertion
        `(old_top == initial_top (av) && old_size == 0) || \
         ((unsigned long) (old_size) >= MINSIZE && \
         prev_inuse (old_top) && \
         ((unsigned long) old_end & (pagesize - 1)) == 0)'
        failed.
        Aborted
      
      Further debugging revealed that this is due to
      miscommunication between bpftool and kernel.
      For example, for the above percpu_array with value size of 4B.
      The map info returned to user space has value size of 4B.
      
      In bpftool, the values array for lookup is allocated like:
         info->value_size * get_possible_cpus() = 4 * get_possible_cpus()
      In kernel (kernel/bpf/syscall.c), the values array size is
      rounded up to multiple of 8.
         round_up(map->value_size, 8) * num_possible_cpus()
         = 8 * num_possible_cpus()
      So when kernel copies the values to user buffer, the kernel will
      overwrite beyond user buffer boundary.
      
      This patch fixed the issue by allocating and stepping through
      percpu map value array properly in bpftool.
      
      Fixes: 71bb428f ("tools: bpf: add bpftool")
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      573b3aa6
  3. 29 7月, 2018 1 次提交
    • T
      perf build: Build error in libbpf missing initialization · b611da43
      Thomas Richter 提交于
      In linux-next tree compiling the perf tool with additional make flags
      EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2" causes a compiler error.
      It is the warning 'variable may be used uninitialized' which is treated
      as error: I compile it using a FEDORA 28 installation, my gcc compiler
      version: gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20). The file that
      causes the error is tools/lib/bpf/libbpf.c.
      
        [root@p23lp27] # make V=1 EXTRA_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -O2"
        [...]
        Makefile.config:849: No openjdk development package found, please
           install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
        Warning: Kernel ABI header at 'tools/include/uapi/linux/if_link.h'
                differs from latest version at 'include/uapi/linux/if_link.h'
          CC       libbpf.o
        libbpf.c: In function ‘bpf_perf_event_read_simple’:
        libbpf.c:2342:6: error: ‘ret’ may be used uninitialized in this
        			function [-Werror=maybe-uninitialized]
          int ret;
              ^
        cc1: all warnings being treated as errors
        mv: cannot stat './.libbpf.o.tmp': No such file or directory
        /home6/tmricht/linux-next/tools/build/Makefile.build:96: recipe for target 'libbpf.o' failed
      Suggested-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      b611da43
  4. 27 7月, 2018 1 次提交
    • M
      bpf: btf: Use exact btf value_size match in map_check_btf() · 5f300e80
      Martin KaFai Lau 提交于
      The current map_check_btf() in BPF_MAP_TYPE_ARRAY rejects
      '> map->value_size' to ensure map_seq_show_elem() will not
      access things beyond an array element.
      
      Yonghong suggested that using '!=' is a more correct
      check.  The 8 bytes round_up on value_size is stored
      in array->elem_size.  Hence, using '!=' on map->value_size
      is a proper check.
      
      This patch also adds new tests to check the btf array
      key type and value type.  Two of these new tests verify
      the btf's value_size (the change in this patch).
      
      It also fixes two existing tests that wrongly encoded
      a btf's type size (pprint_test) and the value_type_id (in one
      of the raw_tests[]).  However, that do not affect these two
      BTF verification tests before or after this test changes.
      These two tests mainly failed at array creation time after
      this patch.
      
      Fixes: a26ca7c9 ("bpf: btf: Add pretty print support to the basic arraymap")
      Suggested-by: NYonghong Song <yhs@fb.com>
      Acked-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      5f300e80
  5. 25 7月, 2018 3 次提交
  6. 24 7月, 2018 1 次提交
  7. 20 7月, 2018 3 次提交
  8. 14 7月, 2018 1 次提交
  9. 13 7月, 2018 1 次提交
  10. 12 7月, 2018 4 次提交
    • L
      tools: build: Use HOSTLDFLAGS with fixdep · 8b247a92
      Laura Abbott 提交于
      The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS.
      Fix this.
      Signed-off-by: NLaura Abbott <labbott@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      8b247a92
    • L
      tools: build: Fixup host c flags · 6fdbd824
      Laura Abbott 提交于
      Commit 0c3b7e42 ("tools build: Add support for host programs format")
      introduced host_c_flags which referenced CHOSTFLAGS. The actual name of the
      variable is HOSTCFLAGS. Fix this up.
      
      Fixes: 0c3b7e42 ("tools build: Add support for host programs format")
      Signed-off-by: NLaura Abbott <labbott@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      6fdbd824
    • P
      tools build: fix # escaping in .cmd files for future Make · 9feeb638
      Paul Menzel 提交于
      In 2016 GNU Make made a backwards incompatible change to the way '#'
      characters were handled in Makefiles when used inside functions or
      macros:
      
      http://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57
      
      Due to this change, when attempting to run `make prepare' I get a
      spurious make syntax error:
      
          /home/earnest/linux/tools/objtool/.fixdep.o.cmd:1: *** missing separator.  Stop.
      
      When inspecting `.fixdep.o.cmd' it includes two lines which use
      unescaped comment characters at the top:
      
          \# cannot find fixdep (/home/earnest/linux/tools/objtool//fixdep)
          \# using basic dep data
      
      This is because `tools/build/Build.include' prints these '\#'
      characters:
      
          printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
          printf '\# using basic dep data\n\n' >> $(dot-target).cmd;           \
      
      This completes commit 9564a8cf ("Kbuild: fix # escaping in .cmd files
      for future Make").
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaul Menzel <pmenzel@molgen.mpg.de>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      9feeb638
    • D
      bpf: fix panic due to oob in bpf_prog_test_run_skb · 6e6fddc7
      Daniel Borkmann 提交于
      sykzaller triggered several panics similar to the below:
      
        [...]
        [  248.851531] BUG: KASAN: use-after-free in _copy_to_user+0x5c/0x90
        [  248.857656] Read of size 985 at addr ffff8808017ffff2 by task a.out/1425
        [...]
        [  248.865902] CPU: 1 PID: 1425 Comm: a.out Not tainted 4.18.0-rc4+ #13
        [  248.865903] Hardware name: Supermicro SYS-5039MS-H12TRF/X11SSE-F, BIOS 2.1a 03/08/2018
        [  248.865905] Call Trace:
        [  248.865910]  dump_stack+0xd6/0x185
        [  248.865911]  ? show_regs_print_info+0xb/0xb
        [  248.865913]  ? printk+0x9c/0xc3
        [  248.865915]  ? kmsg_dump_rewind_nolock+0xe4/0xe4
        [  248.865919]  print_address_description+0x6f/0x270
        [  248.865920]  kasan_report+0x25b/0x380
        [  248.865922]  ? _copy_to_user+0x5c/0x90
        [  248.865924]  check_memory_region+0x137/0x190
        [  248.865925]  kasan_check_read+0x11/0x20
        [  248.865927]  _copy_to_user+0x5c/0x90
        [  248.865930]  bpf_test_finish.isra.8+0x4f/0xc0
        [  248.865932]  bpf_prog_test_run_skb+0x6a0/0xba0
        [...]
      
      After scrubbing the BPF prog a bit from the noise, turns out it called
      bpf_skb_change_head() for the lwt_xmit prog with headroom of 2. Nothing
      wrong in that, however, this was run with repeat >> 0 in bpf_prog_test_run_skb()
      and the same skb thus keeps changing until the pskb_expand_head() called
      from skb_cow() keeps bailing out in atomic alloc context with -ENOMEM.
      So upon return we'll basically have 0 headroom left yet blindly do the
      __skb_push() of 14 bytes and keep copying data from there in bpf_test_finish()
      out of bounds. Fix to check if we have enough headroom and if pskb_expand_head()
      fails, bail out with error.
      
      Another bug independent of this fix (but related in triggering above) is
      that BPF_PROG_TEST_RUN should be reworked to reset the skb/xdp buffer to
      it's original state from input as otherwise repeating the same test in a
      loop won't work for benchmarking when underlying input buffer is getting
      changed by the prog each time and reused for the next run leading to
      unexpected results.
      
      Fixes: 1cf1cae9 ("bpf: introduce BPF_PROG_TEST_RUN command")
      Reported-by: syzbot+709412e651e55ed96498@syzkaller.appspotmail.com
      Reported-by: syzbot+54f39d6ab58f39720a55@syzkaller.appspotmail.com
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      6e6fddc7
  11. 11 7月, 2018 16 次提交
    • J
      perf tools: Use python-config --includes rather than --cflags · 32aa928a
      Jeremy Cline 提交于
      Builds started failing in Fedora on Python 3.7 with:
      
          `.gnu.debuglto_.debug_macro' referenced in section
          `.gnu.debuglto_.debug_macro' of
          util/scripting-engines/trace-event-python.o: defined in discarded
          section
      
      In Fedora, Python 3.7 added -flto to the list of --cflags and since it
      was only applied to util/scripting-engines/trace-event-python.c and
      scripts/python/Perf-Trace-Util/Context.c, linking failed.
      
      It's not the first time the addition of flags has broken builds: commit
      c6707fde ("perf tools: Fix up build in hardnened environments")
      appears to have fixed a similar problem. "python-config --includes"
      provides the proper -I flags and doesn't introduce additional CFLAGS.
      Signed-off-by: NJeremy Cline <jcline@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180710154612.6285-1-jcline@redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      32aa928a
    • J
      perf script python: Fix dict reference counting · db0ba84c
      Janne Huttunen 提交于
      The dictionaries are attached to the parameter tuple that steals the
      references and takes care of releasing them when appropriate.  The code
      should not decrement the reference counts explicitly.  E.g. if libpython
      has been built with reference debugging enabled, the superfluous DECREFs
      will trigger this error when running perf script:
      
        Fatal Python error: Objects/tupleobject.c:238 object at
        0x7f10f2041b40 has negative ref count -1
        Aborted (core dumped)
      
      If the reference debugging is not enabled, the superfluous DECREFs might
      cause the dict objects to be silently released while they are still in
      use. This may trigger various other assertions or just cause perf
      crashes and/or weird and unexpected data changes in the stored Python
      objects.
      Signed-off-by: NJanne Huttunen <janne.huttunen@nokia.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jaroslav Skarvada <jskarvad@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1531133990-17485-1-git-send-email-janne.huttunen@nokia.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      db0ba84c
    • J
      perf stat: Fix --interval_clear option · c818cc06
      Jiri Olsa 提交于
      Currently we display extra header line, like:
      
        # perf stat -I 1000 -a --interval-clear
        #           time             counts unit events
               insn per cycle branch-misses of all branches
             2.964917103        3855.349912      cpu-clock (msec)          #    3.855 CPUs utilized
             2.964917103             23,993      context-switches          #    0.006 M/sec
             2.964917103              1,301      cpu-migrations            #    0.329 K/sec
             ...
      
      Fixing the condition and getting proper:
      
        # perf stat -I 1000 -a --interval-clear
        #           time             counts unit events
             2.359048938        1432.492228      cpu-clock (msec)          #    1.432 CPUs utilized
             2.359048938              7,613      context-switches          #    0.002 M/sec
             2.359048938                419      cpu-migrations            #    0.133 K/sec
             ...
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Fixes: 9660e08e ("perf stat: Add --interval-clear option")
      Link: http://lkml.kernel.org/r/20180702134202.17745-2-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c818cc06
    • J
      perf tools: Fix compilation errors on gcc8 · a09603f8
      Jiri Olsa 提交于
      We are getting following warnings on gcc8 that break compilation:
      
        $ make
          CC       jvmti/jvmti_agent.o
        jvmti/jvmti_agent.c: In function ‘jvmti_open’:
        jvmti/jvmti_agent.c:252:35: error: ‘/jit-’ directive output may be truncated \
          writing 5 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
          snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid());
      
      There's no point in checking the result of snprintf call in
      jvmti_open, the following open call will fail in case the
      name is mangled or too long.
      
      Using tools/lib/ function scnprintf that touches the return value from
      the snprintf() calls and thus get rid of those warnings.
      
        $ make DEBUG=1
          CC       arch/x86/util/perf_regs.o
        arch/x86/util/perf_regs.c: In function ‘arch_sdt_arg_parse_op’:
        arch/x86/util/perf_regs.c:229:4: error: ‘strncpy’ output truncated before terminating nul
        copying 2 bytes from a string of the same length [-Werror=stringop-truncation]
          strncpy(prefix, "+0", 2);
          ^~~~~~~~~~~~~~~~~~~~~~~~
      
      Using scnprintf instead of the strncpy (which we know is safe in here)
      to get rid of that warning.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20180702134202.17745-1-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a09603f8
    • K
      perf test shell: Prevent temporary editor files from being considered test scripts · db8fec58
      Kim Phillips 提交于
      Allows a perf shell test developer to concurrently edit and run their
      test scripts, avoiding perf test attempts to execute their editor
      temporary files, such as seen here:
      
       $ sudo taskset -c 0 ./perf test -vvvvvvvv -F 63
       63: 0VIM 8.0                                              :
       --- start ---
       sh: 1: ./tests/shell/.record+probe_libc_inet_pton.sh.swp: Permission denied
       ---- end ----
       0VIM 8.0: FAILED!
      Signed-off-by: NKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20180629124658.15a506b41fc4539c08eb9426@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      db8fec58
    • K
      perf llvm-utils: Remove bashism from kernel include fetch script · f6432b9f
      Kim Phillips 提交于
      Like system(), popen() calls /bin/sh, which may/may not be bash.
      
      Script when run on dash and encounters the line, yields:
      
       exit: Illegal number: -1
      
      checkbashisms report on script content:
      
       possible bashism (exit|return with negative status code):
       exit -1
      
      Remove the bashism and use the more portable non-zero failure
      status code 1.
      Signed-off-by: NKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20180629124652.8d0af7e2281fd3fd8262cacc@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f6432b9f
    • K
      perf test shell: Make perf's inet_pton test more portable · 98c6c8a1
      Kim Phillips 提交于
      Debian based systems such as Ubuntu have dash as their default shell.
      Even if the normal or root user's shell is bash, certain scripts still
      call /bin/sh, which points to dash, so we fix this perf test by
      rewriting it in a more portable way.
      
      BEFORE:
      
       $ sudo perf test -v 64
       64: probe libc's inet_pton & backtrace it with ping       :
       --- start ---
       test child forked, pid 31942
       ./tests/shell/record+probe_libc_inet_pton.sh: 18: ./tests/shell/record+probe_libc_inet_pton.sh: expected[0]=ping[][0-9 \.:]+probe_libc:inet_pton: \([[:xdigit:]]+\): not found
       ./tests/shell/record+probe_libc_inet_pton.sh: 19: ./tests/shell/record+probe_libc_inet_pton.sh: expected[1]=.*inet_pton\+0x[[:xdigit:]]+[[:space:]]\(/lib/x86_64-linux-gnu/libc-2.27.so|inlined\)$: not found
       ./tests/shell/record+probe_libc_inet_pton.sh: 29: ./tests/shell/record+probe_libc_inet_pton.sh: expected[2]=getaddrinfo\+0x[[:xdigit:]]+[[:space:]]\(/lib/x86_64-linux-gnu/libc-2.27.so\)$: not found
       ./tests/shell/record+probe_libc_inet_pton.sh: 30: ./tests/shell/record+probe_libc_inet_pton.sh: expected[3]=.*\+0x[[:xdigit:]]+[[:space:]]\(.*/bin/ping.*\)$: not found
       ping 31963 [004] 83577.670613: probe_libc:inet_pton: (7fe15f87f4b0)
       ./tests/shell/record+probe_libc_inet_pton.sh: 39: ./tests/shell/record+probe_libc_inet_pton.sh: Bad substitution
       ./tests/shell/record+probe_libc_inet_pton.sh: 41: ./tests/shell/record+probe_libc_inet_pton.sh: Bad substitution
       test child finished with -2
       ---- end ----
       probe libc's inet_pton & backtrace it with ping: Skip
      
      AFTER:
      
       $ sudo perf test -v 64
       64: probe libc's inet_pton & backtrace it with ping       :
       --- start ---
       test child forked, pid 32277
       ping 32295 [001] 83679.690020: probe_libc:inet_pton: (7ff244f504b0)
       7ff244f504b0 __GI___inet_pton+0x0 (/lib/x86_64-linux-gnu/libc-2.27.so)
       7ff244f14ce4 getaddrinfo+0x124 (/lib/x86_64-linux-gnu/libc-2.27.so)
       556ac036b57d _init+0xb75 (/bin/ping)
       test child finished with 0
       ---- end ----
       probe libc's inet_pton & backtrace it with ping: Ok
      Signed-off-by: NKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20180629124643.2089b3ce59960eba34e87b27@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      98c6c8a1
    • K
      perf test shell: Replace '|&' with '2>&1 |' to work with more shells · 508ef3e7
      Kim Phillips 提交于
      Since we do not specify bash (and/or zsh) as a requirement, use the
      standard error redirection that is more widely supported.
      
      BEFORE:
      
       $ sudo perf test -v 62
       62: Check open filename arg using perf trace + vfs_getname:
       --- start ---
       test child forked, pid 27305
       ./tests/shell/trace+probe_vfs_getname.sh: 20: ./tests/shell/trace+probe_vfs_getname.sh: Syntax error: "&" unexpected
       test child finished with -2
       ---- end ----
       Check open filename arg using perf trace + vfs_getname: Skip
      
      AFTER:
      
       $ sudo perf test -v 62
       64: Check open filename arg using perf trace + vfs_getname               :
       --- start ---
       test child forked, pid 23008
       Added new event:
         probe:vfs_getname    (on getname_flags:72 with pathname=result->name:string)
      
       You can now use it in all perf tools, such as:
      
               perf record -e probe:vfs_getname -aR sleep 1
      
            0.361 ( 0.008 ms): touch/23032 openat(dfd: CWD, filename: /tmp/temporary_file.VEh0n, flags: CREAT|NOCTTY|NONBLOCK|WRONLY, mode: IRUGO|IWUGO) = 4
       test child finished with 0
       ---- end ----
       Check open filename arg using perf trace + vfs_getname: Ok
      
      Similar to commit 35435cd0, with the same title.
      Signed-off-by: NKim Phillips <kim.phillips@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sandipan Das <sandipan@linux.vnet.ibm.com>
      Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20180629124633.0a9f4bea54b8d2c28f265de2@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      508ef3e7
    • J
      perf scripts python: Add Python 3 support to EventClass.py · 12aa6c73
      Jeremy Cline 提交于
      Support both Python 2 and Python 3 in EventClass.py. ``print`` is now a
      function rather than a statement. This should have no functional change.
      Signed-off-by: NJeremy Cline <jeremy@jcline.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Herton Krzesinski <herton@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/0100016341a73aac-e0734bdc-dcab-4c61-8333-d8be97524aa0-000000@email.amazonses.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      12aa6c73
    • J
      perf scripts python: Add Python 3 support to sched-migration.py · 8c1c1ab2
      Jeremy Cline 提交于
      Support both Python 2 and Python 3 in the sched-migration.py script.
      This should have no functional change.
      Signed-off-by: NJeremy Cline <jeremy@jcline.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Herton Krzesinski <herton@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/0100016341a737a5-44ec436f-3440-4cac-a03f-ddfa589bf308-000000@email.amazonses.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8c1c1ab2
    • J
      perf scripts python: Add Python 3 support to Util.py · c45b168e
      Jeremy Cline 提交于
      Support both Python 2 and Python 3 in Util.py. The dict class no longer
      has a ``has_key`` method and print is now a function rather than a
      statement. This should have no functional change.
      Signed-off-by: NJeremy Cline <jeremy@jcline.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Herton Krzesinski <herton@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/0100016341a730c6-8db8b9b1-da2d-4ee3-96bf-47e0ae9796bd-000000@email.amazonses.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c45b168e
    • J
      perf scripts python: Add Python 3 support to SchedGui.py · 2ab89262
      Jeremy Cline 提交于
      Fix a single syntax error in SchedGui.py to support both Python 2 and
      Python 3. This should have no functional change.
      Signed-off-by: NJeremy Cline <jeremy@jcline.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Herton Krzesinski <herton@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/0100016341a72d26-75729663-fe55-4309-8c9b-302e065ed2f1-000000@email.amazonses.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2ab89262
    • J
      perf scripts python: Add Python 3 support to Core.py · 770d2f86
      Jeremy Cline 提交于
      Support both Python 2 and Python 3 in Core.py. This should have no
      functional change.
      Signed-off-by: NJeremy Cline <jeremy@jcline.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Herton Krzesinski <herton@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/0100016341a72ebe-e572899e-f445-4765-98f0-c314935727f9-000000@email.amazonses.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      770d2f86
    • J
      perf tools: Generate a Python script compatible with Python 2 and 3 · 877cc639
      Jeremy Cline 提交于
      When generating a Python script with "perf script -g python", produce
      one that is compatible with Python 2 and 3. The difference between the
      two generated scripts is:
      
        --- python2-perf-script.py	2018-05-08 15:35:00.865889705 -0400
        +++ python3-perf-script.py	2018-05-08 15:34:49.019789564 -0400
        @@ -7,6 +7,8 @@
         # be retrieved using Python functions of the form common_*(context).
         # See the perf-script-python Documentation for the list of available functions.
      
        +from __future__ import print_function
        +
         import os
         import sys
      
        @@ -18,10 +20,10 @@
      
         def trace_begin():
        -	print "in trace_begin"
        +	print("in trace_begin")
      
         def trace_end():
        -	print "in trace_end"
        +	print("in trace_end")
      
         def raw_syscalls__sys_enter(event_name, context, common_cpu,
         	common_secs, common_nsecs, common_pid, common_comm,
        @@ -29,26 +31,26 @@
         		print_header(event_name, common_cpu, common_secs, common_nsecs,
         			common_pid, common_comm)
      
        -		print "id=%d, args=%s" % \
        -		(id, args)
        +		print("id=%d, args=%s" % \
        +		(id, args))
      
        -		print 'Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}'
        +		print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
      
         		for node in common_callchain:
         			if 'sym' in node:
        -				print "\t[%x] %s" % (node['ip'], node['sym']['name'])
        +				print("\t[%x] %s" % (node['ip'], node['sym']['name']))
         			else:
        -				print "	[%x]" % (node['ip'])
        +				print("	[%x]" % (node['ip']))
      
        -		print "\n"
        +		print()
      
         def trace_unhandled(event_name, context, event_fields_dict, perf_sample_dict):
        -		print get_dict_as_string(event_fields_dict)
        -		print 'Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}'
        +		print(get_dict_as_string(event_fields_dict))
        +		print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
      
         def print_header(event_name, cpu, secs, nsecs, pid, comm):
        -	print "%-20s %5u %05u.%09u %8u %-20s " % \
        -	(event_name, cpu, secs, nsecs, pid, comm),
        +	print("%-20s %5u %05u.%09u %8u %-20s " % \
        +	(event_name, cpu, secs, nsecs, pid, comm), end="")
      
         def get_dict_as_string(a_dict, delimiter=' '):
         	return delimiter.join(['%s=%s'%(k,str(v))for k,v in sorted(a_dict.items())])
      Signed-off-by: NJeremy Cline <jeremy@jcline.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Herton Krzesinski <herton@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/0100016341a7278a-d178c724-2b0f-49ca-be93-80a7d51aaa0d-000000@email.amazonses.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      877cc639
    • M
      rseq/selftests: cleanup: Update comment above rseq_prepare_unload · 8a465801
      Mathieu Desnoyers 提交于
      rseq as it was merged does not have rseq_finish_*() in the user-space
      selftests anymore. Update the rseq_prepare_unload() helper comment to
      adapt to this reality.
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: linux-api@vger.kernel.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Link: https://lkml.kernel.org/r/20180709195155.7654-7-mathieu.desnoyers@efficios.com
      8a465801
    • M
      rseq: uapi: Declare rseq_cs field as union, update includes · ec9c82e0
      Mathieu Desnoyers 提交于
      Declaring the rseq_cs field as a union between __u64 and two __u32
      allows both 32-bit and 64-bit kernels to read the full __u64, and
      therefore validate that a 32-bit user-space cleared the upper 32
      bits, thus ensuring a consistent behavior between native 32-bit
      kernels and 32-bit compat tasks on 64-bit kernels.
      
      Check that the rseq_cs value read is < TASK_SIZE.
      
      The asm/byteorder.h header needs to be included by rseq.h, now
      that it is not using linux/types_32_64.h anymore.
      
      Considering that only __32 and __u64 types are declared in linux/rseq.h,
      the linux/types.h header should always be included for both kernel and
      user-space code: including stdint.h is just for u64 and u32, which are
      not used in this header at all.
      
      Use copy_from_user()/clear_user() to interact with a 64-bit field,
      because arm32 does not implement 64-bit __get_user, and ppc32 does not
      64-bit get_user. Considering that the rseq_cs pointer does not need to
      be loaded/stored with single-copy atomicity from the kernel anymore, we
      can simply use copy_from_user()/clear_user().
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: linux-api@vger.kernel.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Dave Watson <davejwatson@fb.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: "H . Peter Anvin" <hpa@zytor.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Chris Lameter <cl@linux.com>
      Cc: Ben Maurer <bmaurer@fb.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Link: https://lkml.kernel.org/r/20180709195155.7654-5-mathieu.desnoyers@efficios.com
      ec9c82e0
  12. 04 7月, 2018 1 次提交
    • D
      net/ipv6: Revert attempt to simplify route replace and append · 33bd5ac5
      David Ahern 提交于
      NetworkManager likes to manage linklocal prefix routes and does so with
      the NLM_F_APPEND flag, breaking attempts to simplify the IPv6 route
      code and by extension enable multipath routes with device only nexthops.
      
      Revert f34436a4 and these followup patches:
      6eba08c3 ("ipv6: Only emit append events for appended routes").
      ce45bded ("mlxsw: spectrum_router: Align with new route replace logic")
      53b562df ("mlxsw: spectrum_router: Allow appending to dev-only routes")
      
      Update the fib_tests cases to reflect the old behavior.
      
      Fixes: f34436a4 ("net/ipv6: Simplify route replace and appending into multipath route")
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      33bd5ac5
  13. 02 7月, 2018 1 次提交
    • J
      objtool: Support GCC 8 '-fnoreorder-functions' · 08b393d0
      Josh Poimboeuf 提交于
      Since the following commit:
      
        cd77849a ("objtool: Fix GCC 8 cold subfunction detection for aliased functions")
      
      ... if the kernel is built with EXTRA_CFLAGS='-fno-reorder-functions',
      objtool can get stuck in an infinite loop.
      
      That flag causes the new GCC 8 cold subfunctions to be placed in .text
      instead of .text.unlikely.  But it also has an unfortunate quirk: in the
      symbol table, the subfunction (e.g., nmi_panic.cold.7) is nested inside
      the parent (nmi_panic).
      
      That function overlap confuses objtool, and causes it to get into an
      infinite loop in next_insn_same_func().  Here's Allan's description of
      the loop:
      
        "Objtool iterates through the instructions in nmi_panic using
        next_insn_same_func. Once it reaches the end of nmi_panic at 0x534 it
        jumps to 0x528 as that's the start of nmi_panic.cold.7. However, since
        the instructions starting at 0x528 are still associated with nmi_panic
        objtool will get stuck in a loop, continually jumping back to 0x528
        after reaching 0x534."
      
      Fix it by shortening the length of the parent function so that the
      functions no longer overlap.
      Reported-and-analyzed-by: NAllan Xavier <allan.x.xavier@oracle.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Allan Xavier <allan.x.xavier@oracle.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.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/9e704c52bee651129b036be14feda317ae5606ae.1530136978.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      08b393d0
  14. 01 7月, 2018 1 次提交
  15. 29 6月, 2018 1 次提交
  16. 28 6月, 2018 1 次提交
  17. 27 6月, 2018 2 次提交