18 Oct, 2018

5 commits

  • commit 77f18153c080855e1c3fb520ca31a4e61530121d upstream.

    With gcc 8 we get new set of snprintf() warnings that breaks the
    compilation, one example:

    tests/mem.c: In function ‘check’:
    tests/mem.c:19:48: error: ‘%s’ directive output may be truncated writing \
    up to 99 bytes into a region of size 89 [-Werror=format-truncation=]
    snprintf(failure, sizeof failure, "unexpected %s", out);

    The gcc docs says:

    To avoid the warning either use a bigger buffer or handle the
    function's return value which indicates whether or not its output
    has been truncated.

    Given that all these warnings are harmless, because the code either
    properly fails due to uncomplete file path or we don't care for
    truncated output at all, I'm changing all those snprintf() calls to
    scnprintf(), which actually 'checks' for the snprint return value so the
    gcc stays silent.

    Signed-off-by: Jiri Olsa
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Sergey Senozhatsky
    Link: http://lkml.kernel.org/r/20180319082902.4518-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Ignat Korchagin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit d005efe18db0b4a123dd92ea8e77e27aee8f99fd upstream.

    With the "branches" export option, not all sample columns are exported.
    However the unwanted columns are not at the end of the tuple, as assumed
    by the code. Fix by taking the first 15 and last 3 values, instead of
    the first 18.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20180911114504.28516-3-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • commit 25e11700b54c7b6b5ebfc4361981dae12299557b upstream.

    Occasional export failures were found to be caused by truncating 64-bit
    pointers to 32-bits. Fix by explicitly setting types for all ctype
    arguments and results.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/20180911114504.28516-2-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     
  • [ Upstream commit 4d85af102a66ee6aeefa596f273169e77fb2b48e ]

    add CONFIG_MEMORY_HOTREMOVE=y in config
    without this config, /sys/devices/system/memory/memory*/removable
    always return 0, I endup getting an early skip during test

    Signed-off-by: Lei Yang
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lei Yang
     
  • [ Upstream commit 53cf59d6c0ad3edc4f4449098706a8f8986258b6 ]

    add config file

    Signed-off-by: Lei Yang
    Signed-off-by: Shuah Khan (Samsung OSG)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lei Yang
     

13 Oct, 2018

5 commits

  • commit 06c3f2aa9fc68e7f3fe3d83e7569d2a2801d9f99 upstream.

    So that it can be used more widely, like in the next patch, when it will
    be used to fix a bug in 'perf test' handling of dirent.d_type ==
    DT_UNKNOWN.

    Signed-off-by: Jiri Olsa
    Cc: David Ahern
    Cc: Michael Petlan
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20171206174535.25380-1-jolsa@kernel.org
    [ Split from a larger patch, removed needless includes in path.h ]
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Ignat Korchagin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit b7a313d84e853049062011d78cb04b6decd12f5c upstream.

    The gcc 8 compiler won't compile the python extension code with the
    following errors (one example):

    python.c:830:15: error: cast between incompatible function types from \
    ‘PyObject * (*)(struct pyrf_evsel *, PyObject *, PyObject *)’ \
    uct _object * (*)(struct pyrf_evsel *, struct _object *, struct _object *)’} to \
    ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _objeuct \
    _object *)’} [-Werror=cast-function-type]
    .ml_meth = (PyCFunction)pyrf_evsel__open,

    The problem with the PyMethodDef::ml_meth callback is that its type is
    determined based on the PyMethodDef::ml_flags value, which we set as
    METH_VARARGS | METH_KEYWORDS.

    That indicates that the callback is expecting an extra PyObject* arg, and is
    actually PyCFunctionWithKeywords type, but the base PyMethodDef::ml_meth type
    stays PyCFunction.

    Previous gccs did not find this, gcc8 now does. Fixing this by silencing this
    warning for python.c build.

    Commiter notes:

    Do not do that for CC=clang, as it breaks the build in some clang
    versions, like the ones in fedora up to fedora27:

    fedora:25:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
    fedora:26:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
    fedora:27:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
    #

    those have:

    clang version 3.9.1 (tags/RELEASE_391/final)

    The one in rawhide accepts that:

    clang version 6.0.0 (tags/RELEASE_600/final)

    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Sergey Senozhatsky
    Link: http://lkml.kernel.org/r/20180319082902.4518-2-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Ignat Korchagin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • commit 6810158d526e483868e519befff407b91e76b3db upstream.

    We were using a local buffer with an arbitrary size, that would have to
    get increased to avoid truncation as warned by gcc 8:

    util/annotate.c: In function 'symbol__disassemble':
    util/annotate.c:1488:4: error: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 3966 and 8086 [-Werror=format-truncation=]
    "%s %s%s --start-address=0x%016" PRIx64
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    util/annotate.c:1498:20:
    symfs_filename, symfs_filename);
    ~~~~~~~~~~~~~~
    util/annotate.c:1490:50: note: format string is defined here
    " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
    ^~
    In file included from /usr/include/stdio.h:861,
    from util/color.h:5,
    from util/sort.h:8,
    from util/annotate.c:14:
    /usr/include/bits/stdio2.h:67:10: note: '__builtin___snprintf_chk' output 116 or more bytes (assuming 8331) into a destination of size 8192
    return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    __bos (__s), __fmt, __va_arg_pack ());
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    So switch to asprintf, that will make sure enough space is available.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jin Yao
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: https://lkml.kernel.org/n/tip-qagoy2dmbjpc9gdnaj0r3mml@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Cc: Ignat Korchagin
    Signed-off-by: Greg Kroah-Hartman

    Arnaldo Carvalho de Melo
     
  • commit 02e425668f5c9deb42787d10001a3b605993ad15 upstream.

    When I added the missing memory outputs, I failed to update the
    index of the first argument (ebx) on 32-bit builds, which broke the
    fallbacks. Somehow I must have screwed up my testing or gotten
    lucky.

    Add another test to cover gettimeofday() as well.

    Signed-off-by: Andy Lutomirski
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Fixes: 715bd9d12f84 ("x86/vdso: Fix asm constraints on vDSO syscall fallbacks")
    Link: http://lkml.kernel.org/r/21bd45ab04b6d838278fa5bebfa9163eceffa13c.1538608971.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     
  • commit 7c03e7035ac1cf2a6165754e4f3a49c2f1977838 upstream.

    Now that the vDSO implementation of clock_gettime() is getting
    reworked, add a selftest for it. This tests that its output is
    consistent with the syscall version.

    This is marked for stable to serve as a test for commit

    715bd9d12f84 ("x86/vdso: Fix asm constraints on vDSO syscall fallbacks")

    Signed-off-by: Andy Lutomirski
    Signed-off-by: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: https://lkml.kernel.org/r/082399674de2619b2befd8c0dde49b260605b126.1538422295.git.luto@kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

10 Oct, 2018

9 commits

  • commit c2d68afba86d1ff01e7300c68bc16a9234dcd8e9 upstream.

    'error' variable is left uninitialized in case we see an unknown operation.
    As we don't immediately return and proceed to pwrite() we need to set it
    to something, HV_E_FAIL sounds good enough.

    Signed-off-by: Vitaly Kuznetsov
    Signed-off-by: K. Y. Srinivasan
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Vitaly Kuznetsov
     
  • [ Upstream commit fa694160cca6dbba17c57dc7efec5f93feaf8795 ]

    This makes sure that the SyS symbols are ignored for any powerpc system,
    not just the big endian ones.

    Reported-by: Naveen N. Rao
    Signed-off-by: Sandipan Das
    Reviewed-by: Kamalesh Babulal
    Acked-by: Naveen N. Rao
    Cc: Jiri Olsa
    Cc: Ravi Bangoria
    Fixes: fb6d59423115 ("perf probe ppc: Use the right prefix when ignoring SyS symbols on ppc")
    Link: http://lkml.kernel.org/r/20180828090848.1914-1-sandipan@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     
  • [ Upstream commit a72f64261359b7451f8478f2a2bf357b4e6c757f ]

    In the write to the output_fd in the error condition of
    record_saved_cmdline(), we are writing 8 bytes from a memory location on
    the stack that contains a primitive that is only 4 bytes in size.
    Change the primitive to 8 bytes in size to match the size of the write
    in order to avoid reading unknown memory from the stack.

    Signed-off-by: Chris Phlipot
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180829061954.18871-1-cphlipot0@gmail.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Chris Phlipot
     
  • [ Upstream commit fd8d2702791a970c751f8b526a17d8e725a05b46 ]

    If evsel is NULL, we should return NULL to avoid a NULL pointer
    dereference a bit later in the code.

    Signed-off-by: Hisao Tanabe
    Acked-by: Namhyung Kim
    Cc: Jiri Olsa
    Cc: Wang Nan
    Fixes: 03e0a7df3efd ("perf tools: Introduce bpf-output event")
    LPU-Reference: 20180824154556.23428-1-xtanabe@gmail.com
    Link: https://lkml.kernel.org/n/tip-e5plzjhx6595a5yjaf22jss3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hisao Tanabe
     
  • [ Upstream commit 7ab660f8baecfe26c1c267fa8e64d2073feae2bb ]

    debugfs_known_mountpoints[] is not used any more, so let's remove it.

    Link: http://lkml.kernel.org/r/1535102651-19418-1-git-send-email-n-horiguchi@ah.jp.nec.com
    Signed-off-by: Naoya Horiguchi
    Reviewed-by: Andrew Morton
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Naoya Horiguchi
     
  • [ Upstream commit 904506562e0856f2535d876407d087c9459d345b ]

    Currently we get the following compiler warning:

    slabinfo.c:854:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (s->object_size < min_objsize)
    ^

    due to the mismatch of signed/unsigned comparison. ->object_size and
    ->slab_size are never expected to be negative, so let's define them as
    unsigned int.

    [n-horiguchi@ah.jp.nec.com: convert everything - none of these can be negative]
    Link: http://lkml.kernel.org/r/20180826234947.GA9787@hori1.linux.bs1.fc.nec.co.jp
    Link: http://lkml.kernel.org/r/1535103134-20239-1-git-send-email-n-horiguchi@ah.jp.nec.com
    Signed-off-by: Naoya Horiguchi
    Reviewed-by: Andrew Morton
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Naoya Horiguchi
     
  • [ Upstream commit 617c66b9f236d20f11cecbb3f45e6d5675b2fae1 ]

    When filtering by guest, kvm_stat displays garbage when the guest is
    destroyed - see sample output below.
    We add code to remove the invalid paths from the providers, so at least
    no more garbage is displayed.
    Here's a sample output to illustrate:

    kvm statistics - pid 13986 (foo)

    Event Total %Total CurAvg/s
    diagnose_258 -2 0.0 0
    deliver_program_interruption -3 0.0 0
    diagnose_308 -4 0.0 0
    halt_poll_invalid -91 0.0 -6
    deliver_service_signal -244 0.0 -16
    halt_successful_poll -250 0.1 -17
    exit_pei -285 0.1 -19
    exit_external_request -312 0.1 -21
    diagnose_9c -328 0.1 -22
    userspace_handled -713 0.1 -47
    halt_attempted_poll -939 0.2 -62
    deliver_emergency_signal -3126 0.6 -208
    halt_wakeup -7199 1.5 -481
    exit_wait_state -7379 1.5 -493
    diagnose_500 -56499 11.5 -3757
    exit_null -85491 17.4 -5685
    diagnose_44 -133300 27.1 -8874
    exit_instruction -195898 39.8 -13037
    Total -492063

    Signed-off-by: Stefan Raspl
    Signed-off-by: Radim Krčmář
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Stefan Raspl
     
  • [ Upstream commit 58f33cfe73076b6497bada4f7b5bda961ed68083 ]

    Python3 returns a float for a regular division - switch to a division
    operator that returns an integer.
    Furthermore, filters return a generator object instead of the actual
    list - wrap result in yet another list, which makes it still work in
    both, Python2 and 3.

    Signed-off-by: Stefan Raspl
    Signed-off-by: Radim Krčmář
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Stefan Raspl
     
  • commit 46c2797826cc6d1ae36fcbd966e76f9fa1907eef upstream.

    Signed-off-by: Len Brown
    Cc: Alakesh Haloi
    Signed-off-by: Greg Kroah-Hartman

    Len Brown
     

26 Sep, 2018

7 commits

  • [ Upstream commit 1416270f4a1ae83ea84156ceba19a66a8f88be1f ]

    In the past we've warned when ADJ_OFFSET was in progress, usually
    caused by ntpd or some other time adjusting daemon running in non
    steady sate, which can cause the skew calculations to be
    incorrect.

    Thus, this patch checks to see if the clock was being adjusted
    when we fail so that we don't cause false negatives.

    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: Miroslav Lichvar
    Cc: Richard Cochran
    Cc: Prarit Bhargava
    Cc: Stephen Boyd
    Cc: Shuah Khan
    Cc: linux-kselftest@vger.kernel.org
    Suggested-by: Miroslav Lichvar
    Signed-off-by: John Stultz
    Signed-off-by: Greg Kroah-Hartman

    John Stultz
     
  • commit 86503bd35dec0ce363e9fdbf5299927422ed3899 upstream.

    Fix a bug in the key delete code - the num_records range
    from 0 to num_records-1.

    Signed-off-by: K. Y. Srinivasan
    Reported-by: David Binderman
    Cc:
    Reviewed-by: Michael Kelley
    Signed-off-by: Greg Kroah-Hartman

    K. Y. Srinivasan
     
  • [ Upstream commit c715fcfda5a08edabaa15508742be926b7ee51db ]

    For powerpc64, redundant entries in the callchain are filtered out by
    determining the state of the return address and the stack frame using
    DWARF debug information.

    For making these filtering decisions we must analyze the debug
    information for the location corresponding to the program counter value,
    i.e. the first entry in the callchain, and not the LR value; otherwise,
    perf may filter out either the second or the third entry in the
    callchain incorrectly.

    This can be observed on a powerpc64le system running Fedora 27 as shown
    below.

    Case 1 - Attaching a probe at inet_pton+0x8 (binary offset 0x15af28).
    Return address is still in LR and a new stack frame is not yet
    allocated. The LR value, i.e. the second entry, should not be
    filtered out.

    # objdump -d /usr/lib64/libc-2.26.so | less
    ...
    000000000010eb10 :
    ...
    10fa48: 78 bb e4 7e mr r4,r23
    10fa4c: 0a 00 60 38 li r3,10
    10fa50: d9 b4 04 48 bl 15af28
    10fa54: 00 00 00 60 nop
    10fa58: ac f4 ff 4b b 10ef04
    ...
    0000000000110450 :
    ...
    1105a8: 54 00 ff 38 addi r7,r31,84
    1105ac: 58 00 df 38 addi r6,r31,88
    1105b0: 69 e5 ff 4b bl 10eb18
    1105b4: 78 1b 71 7c mr r17,r3
    1105b8: 50 01 7f e8 ld r3,336(r31)
    ...
    000000000015af20 :
    15af20: 0b 00 4c 3c addis r2,r12,11
    15af24: e0 c1 42 38 addi r2,r2,-15904
    15af28: a6 02 08 7c mflr r0
    15af2c: f0 ff c1 fb std r30,-16(r1)
    15af30: f8 ff e1 fb std r31,-8(r1)
    ...

    # perf probe -x /usr/lib64/libc-2.26.so -a inet_pton+0x8
    # perf record -e probe_libc:inet_pton -g ping -6 -c 1 ::1
    # perf script

    Before:

    ping 4507 [002] 514985.546540: probe_libc:inet_pton: (7fffa7dbaf28)
    7fffa7dbaf28 __GI___inet_pton+0x8 (/usr/lib64/libc-2.26.so)
    7fffa7d705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    13fb52d70 _init+0xbfc (/usr/bin/ping)
    7fffa7c836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa7c83898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    After:

    ping 4507 [002] 514985.546540: probe_libc:inet_pton: (7fffa7dbaf28)
    7fffa7dbaf28 __GI___inet_pton+0x8 (/usr/lib64/libc-2.26.so)
    7fffa7d6fa54 gaih_inet.constprop.7+0xf44 (/usr/lib64/libc-2.26.so)
    7fffa7d705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    13fb52d70 _init+0xbfc (/usr/bin/ping)
    7fffa7c836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa7c83898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    Case 2 - Attaching a probe at _int_malloc+0x180 (binary offset 0x9cf10).
    Return address in still in LR and a new stack frame has already
    been allocated but not used. The caller's caller, i.e. the third
    entry, is invalid and should be filtered out and not the second
    one.

    # objdump -d /usr/lib64/libc-2.26.so | less
    ...
    000000000009cd90 :
    9cd90: 17 00 4c 3c addis r2,r12,23
    9cd94: 70 a3 42 38 addi r2,r2,-23696
    9cd98: 26 00 80 7d mfcr r12
    9cd9c: f8 ff e1 fb std r31,-8(r1)
    9cda0: 17 00 e4 3b addi r31,r4,23
    9cda4: d8 ff 61 fb std r27,-40(r1)
    9cda8: 78 23 9b 7c mr r27,r4
    9cdac: 1f 00 bf 2b cmpldi cr7,r31,31
    9cdb0: f0 ff c1 fb std r30,-16(r1)
    9cdb4: b0 ff c1 fa std r22,-80(r1)
    9cdb8: 78 1b 7e 7c mr r30,r3
    9cdbc: 08 00 81 91 stw r12,8(r1)
    9cdc0: 11 ff 21 f8 stdu r1,-240(r1)
    9cdc4: 4c 01 9d 41 bgt cr7,9cf10
    9cdc8: 20 00 a4 2b cmpldi cr7,r4,32
    ...
    9cf08: 00 00 00 60 nop
    9cf0c: 00 00 42 60 ori r2,r2,0
    9cf10: e4 06 ff 7b rldicr r31,r31,0,59
    9cf14: 40 f8 a4 7f cmpld cr7,r4,r31
    9cf18: 68 05 9d 41 bgt cr7,9d480
    ...
    000000000009e3c0 :
    ...
    9e420: 40 02 80 38 li r4,576
    9e424: 78 fb e3 7f mr r3,r31
    9e428: 71 e9 ff 4b bl 9cd98
    9e42c: 00 00 a3 2f cmpdi cr7,r3,0
    9e430: 78 1b 7e 7c mr r30,r3
    ...
    000000000009f7a0 :
    ...
    9f8f8: 00 00 89 2f cmpwi cr7,r9,0
    9f8fc: 1c ff 9e 40 bne cr7,9f818
    9f900: c9 ea ff 4b bl 9e3c8
    9f904: 00 00 00 60 nop
    9f908: e8 90 22 e9 ld r9,-28440(r2)
    ...

    # perf probe -x /usr/lib64/libc-2.26.so -a _int_malloc+0x180
    # perf record -e probe_libc:_int_malloc -g ./test-malloc
    # perf script

    Before:

    test-malloc 6554 [009] 515975.797403: probe_libc:_int_malloc: (7fffa6e6cf10)
    7fffa6e6cf10 _int_malloc+0x180 (/usr/lib64/libc-2.26.so)
    7fffa6dd0000 [unknown] (/usr/lib64/libc-2.26.so)
    7fffa6e6f904 malloc+0x164 (/usr/lib64/libc-2.26.so)
    7fffa6e6f9fc malloc+0x25c (/usr/lib64/libc-2.26.so)
    100006b4 main+0x38 (/home/testuser/test-malloc)
    7fffa6df36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa6df3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    After:

    test-malloc 6554 [009] 515975.797403: probe_libc:_int_malloc: (7fffa6e6cf10)
    7fffa6e6cf10 _int_malloc+0x180 (/usr/lib64/libc-2.26.so)
    7fffa6e6e42c tcache_init.part.4+0x6c (/usr/lib64/libc-2.26.so)
    7fffa6e6f904 malloc+0x164 (/usr/lib64/libc-2.26.so)
    7fffa6e6f9fc malloc+0x25c (/usr/lib64/libc-2.26.so)
    100006b4 main+0x38 (/home/sandipan/test-malloc)
    7fffa6df36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa6df3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    Signed-off-by: Sandipan Das
    Cc: Jiri Olsa
    Cc: Maynard Johnson
    Cc: Naveen N. Rao
    Cc: Ravi Bangoria
    Cc: Sukadev Bhattiprolu
    Fixes: a60335ba3298 ("perf tools powerpc: Adjust callchain based on DWARF debug info")
    Link: http://lkml.kernel.org/r/24bb726d91ed173aebc972ec3f41a2ef2249434e.1530724939.git.sandipan@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     
  • [ Upstream commit 9068533e4f470daf2b0f29c71d865990acd8826e ]

    For powerpc64, perf will filter out the second entry in the callchain,
    i.e. the LR value, if the return address of the function corresponding
    to the probed location has already been saved on its caller's stack.

    The state of the return address is determined using debug information.
    At any point within a function, if the return address is already saved
    somewhere, a DWARF expression can tell us about its location. If the
    return address in still in LR only, no DWARF expression would exist.

    Typically, the instructions in a function's prologue first copy the LR
    value to R0 and then pushes R0 on to the stack. If LR has already been
    copied to R0 but R0 is yet to be pushed to the stack, we can still get a
    DWARF expression that says that the return address is in R0. This is
    indicating that getting a DWARF expression for the return address does
    not guarantee the fact that it has already been saved on the stack.

    This can be observed on a powerpc64le system running Fedora 27 as shown
    below.

    # objdump -d /usr/lib64/libc-2.26.so | less
    ...
    000000000015af20 :
    15af20: 0b 00 4c 3c addis r2,r12,11
    15af24: e0 c1 42 38 addi r2,r2,-15904
    15af28: a6 02 08 7c mflr r0
    15af2c: f0 ff c1 fb std r30,-16(r1)
    15af30: f8 ff e1 fb std r31,-8(r1)
    15af34: 78 1b 7f 7c mr r31,r3
    15af38: 78 23 83 7c mr r3,r4
    15af3c: 78 2b be 7c mr r30,r5
    15af40: 10 00 01 f8 std r0,16(r1)
    15af44: c1 ff 21 f8 stdu r1,-64(r1)
    15af48: 28 00 81 f8 std r4,40(r1)
    ...

    # readelf --debug-dump=frames-interp /usr/lib64/libc-2.26.so | less
    ...
    00027024 0000000000000024 00027028 FDE cie=00000000 pc=000000000015af20..000000000015af88
    LOC CFA r30 r31 ra
    000000000015af20 r1+0 u u u
    000000000015af34 r1+0 c-16 c-8 r0
    000000000015af48 r1+64 c-16 c-8 c+16
    000000000015af5c r1+0 c-16 c-8 c+16
    000000000015af78 r1+0 u u
    ...

    # perf probe -x /usr/lib64/libc-2.26.so -a inet_pton+0x18
    # perf record -e probe_libc:inet_pton -g ping -6 -c 1 ::1
    # perf script

    Before:

    ping 2829 [005] 512917.460174: probe_libc:inet_pton: (7fff7e2baf38)
    7fff7e2baf38 __GI___inet_pton+0x18 (/usr/lib64/libc-2.26.so)
    7fff7e2705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    12f152d70 _init+0xbfc (/usr/bin/ping)
    7fff7e1836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fff7e183898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    After:

    ping 2829 [005] 512917.460174: probe_libc:inet_pton: (7fff7e2baf38)
    7fff7e2baf38 __GI___inet_pton+0x18 (/usr/lib64/libc-2.26.so)
    7fff7e26fa54 gaih_inet.constprop.7+0xf44 (/usr/lib64/libc-2.26.so)
    7fff7e2705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    12f152d70 _init+0xbfc (/usr/bin/ping)
    7fff7e1836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fff7e183898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    Reported-by: Ravi Bangoria
    Signed-off-by: Sandipan Das
    Cc: Jiri Olsa
    Cc: Maynard Johnson
    Cc: Naveen N. Rao
    Cc: Ravi Bangoria
    Cc: Sukadev Bhattiprolu
    Link: http://lkml.kernel.org/r/66e848a7bdf2d43b39210a705ff6d828a0865661.1530724939.git.sandipan@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     
  • [ Upstream commit 46b3722cc7765582354488da633aafffcb138458 ]

    We occasionaly hit following assert failure in 'perf top', when processing the
    /proc info in multiple threads.

    perf: ...include/linux/refcount.h:109: refcount_inc:
    Assertion `!(!refcount_inc_not_zero(r))' failed.

    The gdb backtrace looks like this:

    [Switching to Thread 0x7ffff11ba700 (LWP 13749)]
    0x00007ffff50839fb in raise () from /lib64/libc.so.6
    (gdb)
    #0 0x00007ffff50839fb in raise () from /lib64/libc.so.6
    #1 0x00007ffff5085800 in abort () from /lib64/libc.so.6
    #2 0x00007ffff507c0da in __assert_fail_base () from /lib64/libc.so.6
    #3 0x00007ffff507c152 in __assert_fail () from /lib64/libc.so.6
    #4 0x0000000000535373 in refcount_inc (r=0x7fffdc009be0)
    at ...include/linux/refcount.h:109
    #5 0x00000000005354f1 in comm_str__get (cs=0x7fffdc009bc0)
    at util/comm.c:24
    #6 0x00000000005356bd in __comm_str__findnew (str=0x7fffd000b260 ":2",
    root=0xbed5c0 ) at util/comm.c:72
    #7 0x000000000053579e in comm_str__findnew (str=0x7fffd000b260 ":2",
    root=0xbed5c0 ) at util/comm.c:95
    #8 0x000000000053582e in comm__new (str=0x7fffd000b260 ":2",
    timestamp=0, exec=false) at util/comm.c:111
    #9 0x00000000005363bc in thread__new (pid=2, tid=2) at util/thread.c:57
    #10 0x0000000000523da0 in ____machine__findnew_thread (machine=0xbfde38,
    threads=0xbfdf28, pid=2, tid=2, create=true) at util/machine.c:457
    #11 0x0000000000523eb4 in __machine__findnew_thread (machine=0xbfde38,
    ...

    The failing assertion is this one:

    REFCOUNT_WARN(!refcount_inc_not_zero(r), ...

    The problem is that we keep global comm_str_root list, which
    is accessed by multiple threads during the 'perf top' startup
    and following 2 paths can race:

    thread 1:
    ...
    thread__new
    comm__new
    comm_str__findnew
    down_write(&comm_str_lock);
    __comm_str__findnew
    comm_str__get

    thread 2:
    ...
    comm__override or comm__free
    comm_str__put
    refcount_dec_and_test
    down_write(&comm_str_lock);
    rb_erase(&cs->rb_node, &comm_str_root);

    Because thread 2 first decrements the refcnt and only after then it removes the
    struct comm_str from the list, the thread 1 can find this object on the list
    with refcnt equls to 0 and hit the assert.

    This patch fixes the thread 1 __comm_str__findnew path, by ignoring objects
    that already dropped the refcnt to 0. For the rest of the objects we take the
    refcnt before comparing its name and release it afterwards with comm_str__put,
    which can also release the object completely.

    Signed-off-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Kan Liang
    Cc: Lukasz Odzioba
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Cc: kernel-team@lge.com
    Link: http://lkml.kernel.org/r/20180720101740.GA27176@krava
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit e8fedff1cc729fd227924305152ccc6f580e8c83 ]

    Stephan reported, that pipe mode does not carry the group information
    and thus the piped report won't display the grouped output for following
    command:

    # perf record -e '{cycles,instructions,branches}' -a sleep 4 | perf report

    It has no idea about the group setup, so it will display events
    separately:

    # Overhead Command Shared Object ...
    # ........ ............... .......................
    #
    6.71% swapper [kernel.kallsyms]
    2.28% offlineimap libpython2.7.so.1.0
    0.78% perf [kernel.kallsyms]
    ...

    Fix GROUP_DESC feature record to be synthesized in pipe mode, so the
    report output is grouped if there are groups defined in record:

    # Overhead Command Shared ...
    # ........................ ............... .......
    #
    7.57% 0.16% 0.30% swapper [kernel
    1.87% 3.15% 2.46% offlineimap libpyth
    1.33% 0.00% 0.00% perf [kernel
    ...

    Reported-by: Stephane Eranian
    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Stephane Eranian
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: David Carrillo-Cisneros
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180712135202.14774-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit 9ef0112442bdddef5fb55adf20b3a5464b33de75 ]

    Perf test 40 for example has several subtests numbered 1-4 when
    displaying the start of the subtest. When the subtest results
    are displayed the subtests are numbered 0-3.

    Use this command to generate trace output:

    [root@s35lp76 perf]# ./perf test -Fv 40 2>/tmp/bpf1

    Fix this by adjusting the subtest number when show the
    subtest result.

    Output before:

    [root@s35lp76 perf]# egrep '(^40\.[0-4]| subtest [0-4]:)' /tmp/bpf1
    40.1: Basic BPF filtering :
    BPF filter subtest 0: Ok
    40.2: BPF pinning :
    BPF filter subtest 1: Ok
    40.3: BPF prologue generation :
    BPF filter subtest 2: Ok
    40.4: BPF relocation checker :
    BPF filter subtest 3: Ok
    [root@s35lp76 perf]#

    Output after:

    root@s35lp76 ~]# egrep '(^40\.[0-4]| subtest [0-4]:)' /tmp/bpf1
    40.1: Basic BPF filtering :
    BPF filter subtest 1: Ok
    40.2: BPF pinning :
    BPF filter subtest 2: Ok
    40.3: BPF prologue generation :
    BPF filter subtest 3: Ok
    40.4: BPF relocation checker :
    BPF filter subtest 4: Ok
    [root@s35lp76 ~]#

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Link: http://lkml.kernel.org/r/20180724134858.100644-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Thomas Richter
     

20 Sep, 2018

5 commits

  • [ Upstream commit 45df5d3dc0c7289c1e67afe6d2ba806ad5174314 ]

    The mock / test version of pmem_direct_access() needs to check the
    validity of pointers kaddr and pfn for NULL assignment. If anyone
    equals to NULL, it doesn't need to calculate the value.

    If pointer equals to NULL, that is to say callers may have no need for
    kaddr or pfn, so this patch is prepared for allowing them to pass in
    NULL instead of having to pass in a local pointer or variable that
    they then just throw away.

    Suggested-by: Dan Williams
    Signed-off-by: Huaisheng Ye
    Reviewed-by: Ross Zwisler
    Signed-off-by: Dave Jiang
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Huaisheng Ye
     
  • [ Upstream commit 95035c5e167ae6e740b1ddd30210ae0eaf39a5db ]

    'perf record' will error out if both --delay and LBR are applied.

    For example:

    # perf record -D 1000 -a -e cycles -j any -- sleep 2
    Error:
    dummy:HG: PMU Hardware doesn't support sampling/overflow-interrupts.
    Try 'perf stat'
    #

    A dummy event is added implicitly for initial delay, which has the same
    configurations as real sampling events. The dummy event is a software
    event. If LBR is configured, perf must error out.

    The dummy event will only be used to track PERF_RECORD_MMAP while perf
    waits for the initial delay to enable the real events. The BRANCH_STACK
    bit can be safely cleared for the dummy event.

    After applying the patch:

    # perf record -D 1000 -a -e cycles -j any -- sleep 2
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 1.054 MB perf.data (828 samples) ]
    #

    Reported-by: Sunil K Pandey
    Signed-off-by: Kan Liang
    Acked-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Andi Kleen
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1531145722-16404-1-git-send-email-kan.liang@linux.intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Kan Liang
     
  • [ Upstream commit 73978332572ccf5e364c31e9a70ba953f8202b46 ]

    'perf c2c' scans read/write accesses and tries to find false sharing
    cases, so when the events it wants were not asked for or ended up not
    taking place, we get no histograms.

    So do not try to display entry details if there's not any. Currently
    this ends up in crash:

    $ perf c2c report # then press 'd'
    perf: Segmentation fault
    $

    Committer testing:

    Before:

    Record a perf.data file without events of interest to 'perf c2c report',
    then call it and press 'd':

    # perf record sleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.001 MB perf.data (6 samples) ]
    # perf c2c report
    perf: Segmentation fault
    -------- backtrace --------
    perf[0x5b1d2a]
    /lib64/libc.so.6(+0x346df)[0x7fcb566e36df]
    perf[0x46fcae]
    perf[0x4a9f1e]
    perf[0x4aa220]
    perf(main+0x301)[0x42c561]
    /lib64/libc.so.6(__libc_start_main+0xe9)[0x7fcb566cff29]
    perf(_start+0x29)[0x42c999]
    #

    After the patch the segfault doesn't take place, a follow up patch to
    tell the user why nothing changes when 'd' is pressed would be good.

    Reported-by: rodia@autistici.org
    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Joe Mario
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Fixes: f1c5fd4d0bb9 ("perf c2c report: Add TUI cacheline browser")
    Link: http://lkml.kernel.org/r/20180724062008.26126-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit 21b8732eb4479b579bda9ee38e62b2c312c2a0e5 ]

    After update of kernel, the perf tool doesn't run anymore on my 32MB RAM
    powerpc board, but still runs on a 128MB RAM board:

    ~# strace perf
    execve("/usr/sbin/perf", ["perf"], [/* 12 vars */]) = -1 ENOMEM (Cannot allocate memory)
    --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
    +++ killed by SIGSEGV +++
    Segmentation fault

    objdump -x shows that .bss section has a huge size of 24Mbytes:

    27 .bss 016baca8 101cebb8 101cebb8 001cd988 2**3

    With especially the following objects having quite big size:

    10205f80 l O .bss 00140000 runtime_cycles_stats
    10345f80 l O .bss 00140000 runtime_stalled_cycles_front_stats
    10485f80 l O .bss 00140000 runtime_stalled_cycles_back_stats
    105c5f80 l O .bss 00140000 runtime_branches_stats
    10705f80 l O .bss 00140000 runtime_cacherefs_stats
    10845f80 l O .bss 00140000 runtime_l1_dcache_stats
    10985f80 l O .bss 00140000 runtime_l1_icache_stats
    10ac5f80 l O .bss 00140000 runtime_ll_cache_stats
    10c05f80 l O .bss 00140000 runtime_itlb_cache_stats
    10d45f80 l O .bss 00140000 runtime_dtlb_cache_stats
    10e85f80 l O .bss 00140000 runtime_cycles_in_tx_stats
    10fc5f80 l O .bss 00140000 runtime_transaction_stats
    11105f80 l O .bss 00140000 runtime_elision_stats
    11245f80 l O .bss 00140000 runtime_topdown_total_slots
    11385f80 l O .bss 00140000 runtime_topdown_slots_retired
    114c5f80 l O .bss 00140000 runtime_topdown_slots_issued
    11605f80 l O .bss 00140000 runtime_topdown_fetch_bubbles
    11745f80 l O .bss 00140000 runtime_topdown_recovery_bubbles

    This is due to commit 4d255766d28b1 ("perf: Bump max number of cpus
    to 1024"), because many tables are sized with MAX_NR_CPUS

    This patch gives the opportunity to redefine MAX_NR_CPUS via

    $ make EXTRA_CFLAGS=-DMAX_NR_CPUS=1

    Signed-off-by: Christophe Leroy
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Cc: linuxppc-dev@lists.ozlabs.org
    Link: http://lkml.kernel.org/r/20170922112043.8349468C57@po15668-vm-win7.idsi0.si.c-s.fr
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Christophe Leroy
     
  • [ Upstream commit 0069fb854364da79fd99236ea620affc8e1152d5 ]

    Commit fbeb1603bf4e ("bpf: verifier: MOV64 don't mark dst reg unbounded")
    revealed a typo in commit fb30d4b71214 ("bpf: Add tests for map-in-map"):
    BPF_MOV64_REG(BPF_REG_0, 0) was used instead of
    BPF_MOV64_IMM(BPF_REG_0, 0).

    I've noticed the problem by running bpf kselftests.

    Fixes: fb30d4b71214 ("bpf: Add tests for map-in-map")
    Signed-off-by: Roman Gushchin
    Cc: Martin KaFai Lau
    Cc: Arthur Fabre
    Cc: Daniel Borkmann
    Cc: Alexei Starovoitov
    Acked-by: Martin KaFai Lau
    Signed-off-by: Daniel Borkmann
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Roman Gushchin
     

15 Sep, 2018

3 commits

  • [ Upstream commit 7c27a26e1ed5a7dd709aa19685d2c98f64e1cf0c ]

    There are some powerpc selftests, as tm/tm-unavailable, that run for a long
    period (>120 seconds), and if it is interrupted, as pressing CRTL-C
    (SIGINT), the foreground process (harness) dies but the child process and
    threads continue to execute (with PPID = 1 now) in background.

    In this case, you'd think the whole test exited, but there are remaining
    threads and processes being executed in background. Sometimes these
    zombies processes are doing annoying things, as consuming the whole CPU or
    dumping things to STDOUT.

    This patch fixes this problem by attaching an empty signal handler to
    SIGINT in the harness process. This handler will interrupt (EINTR) the
    parent process waitpid() call, letting the code to follow through the
    normal flow, which will kill all the processes in the child process group.

    This patch also fixes a typo.

    Signed-off-by: Breno Leitao
    Signed-off-by: Gustavo Romero
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Breno Leitao
     
  • [ Upstream commit 354b064b8ebc1e1ede58550ca9e08bfa81e6af43 ]

    In some cases, a symbol may have multiple aliases. Attempting to add an
    entry probe for such symbols results in a probe being added at an
    incorrect location while it fails altogether for return probes. This is
    only applicable for binaries with debug information.

    During the arch-dependent post-processing, the offset from the start of
    the symbol at which the probe is to be attached is determined and added
    to the start address of the symbol to get the probe's location. In case
    there are multiple aliases, this offset gets added multiple times for
    each alias of the symbol and we end up with an incorrect probe location.

    This can be verified on a powerpc64le system as shown below.

    $ nm /lib/modules/$(uname -r)/build/vmlinux | grep "sys_open$"
    ...
    c000000000414290 T __se_sys_open
    c000000000414290 T sys_open

    $ objdump -d /lib/modules/$(uname -r)/build/vmlinux | grep -A 10 ":"

    c000000000414290 :
    c000000000414290: 19 01 4c 3c addis r2,r12,281
    c000000000414294: 70 c4 42 38 addi r2,r2,-15248
    c000000000414298: a6 02 08 7c mflr r0
    c00000000041429c: e8 ff a1 fb std r29,-24(r1)
    c0000000004142a0: f0 ff c1 fb std r30,-16(r1)
    c0000000004142a4: f8 ff e1 fb std r31,-8(r1)
    c0000000004142a8: 10 00 01 f8 std r0,16(r1)
    c0000000004142ac: c1 ff 21 f8 stdu r1,-64(r1)
    c0000000004142b0: 78 23 9f 7c mr r31,r4
    c0000000004142b4: 78 1b 7e 7c mr r30,r3

    For both the entry probe and the return probe, the probe location
    should be _text+4276888 (0xc000000000414298). Since another alias
    exists for 'sys_open', the post-processing code will end up adding
    the offset (8 for powerpc64le) twice and perf will attempt to add
    the probe at _text+4276896 (0xc0000000004142a0) instead.

    Before:

    # perf probe -v -a sys_open

    probe-definition(0): sys_open
    symbol:sys_open file:(null) line:0 offset:0 return:0 lazy:(null)
    0 arguments
    Looking at the vmlinux_path (8 entries long)
    Using /lib/modules/4.18.0-rc8+/build/vmlinux for symbols
    Open Debuginfo file: /lib/modules/4.18.0-rc8+/build/vmlinux
    Try to find probe point from debuginfo.
    Symbol sys_open address found : c000000000414290
    Matched function: __se_sys_open [2ad03a0]
    Probe point found: __se_sys_open+0
    Found 1 probe_trace_events.
    Opening /sys/kernel/debug/tracing/kprobe_events write=1
    Writing event: p:probe/sys_open _text+4276896
    Added new event:
    probe:sys_open (on sys_open)
    ...

    # perf probe -v -a sys_open%return $retval

    probe-definition(0): sys_open%return
    symbol:sys_open file:(null) line:0 offset:0 return:1 lazy:(null)
    0 arguments
    Looking at the vmlinux_path (8 entries long)
    Using /lib/modules/4.18.0-rc8+/build/vmlinux for symbols
    Open Debuginfo file: /lib/modules/4.18.0-rc8+/build/vmlinux
    Try to find probe point from debuginfo.
    Symbol sys_open address found : c000000000414290
    Matched function: __se_sys_open [2ad03a0]
    Probe point found: __se_sys_open+0
    Found 1 probe_trace_events.
    Opening /sys/kernel/debug/tracing/README write=0
    Opening /sys/kernel/debug/tracing/kprobe_events write=1
    Parsing probe_events: p:probe/sys_open _text+4276896
    Group:probe Event:sys_open probe:p
    Writing event: r:probe/sys_open__return _text+4276896
    Failed to write event: Invalid argument
    Error: Failed to add events. Reason: Invalid argument (Code: -22)

    After:

    # perf probe -v -a sys_open

    probe-definition(0): sys_open
    symbol:sys_open file:(null) line:0 offset:0 return:0 lazy:(null)
    0 arguments
    Looking at the vmlinux_path (8 entries long)
    Using /lib/modules/4.18.0-rc8+/build/vmlinux for symbols
    Open Debuginfo file: /lib/modules/4.18.0-rc8+/build/vmlinux
    Try to find probe point from debuginfo.
    Symbol sys_open address found : c000000000414290
    Matched function: __se_sys_open [2ad03a0]
    Probe point found: __se_sys_open+0
    Found 1 probe_trace_events.
    Opening /sys/kernel/debug/tracing/kprobe_events write=1
    Writing event: p:probe/sys_open _text+4276888
    Added new event:
    probe:sys_open (on sys_open)
    ...

    # perf probe -v -a sys_open%return $retval

    probe-definition(0): sys_open%return
    symbol:sys_open file:(null) line:0 offset:0 return:1 lazy:(null)
    0 arguments
    Looking at the vmlinux_path (8 entries long)
    Using /lib/modules/4.18.0-rc8+/build/vmlinux for symbols
    Open Debuginfo file: /lib/modules/4.18.0-rc8+/build/vmlinux
    Try to find probe point from debuginfo.
    Symbol sys_open address found : c000000000414290
    Matched function: __se_sys_open [2ad03a0]
    Probe point found: __se_sys_open+0
    Found 1 probe_trace_events.
    Opening /sys/kernel/debug/tracing/README write=0
    Opening /sys/kernel/debug/tracing/kprobe_events write=1
    Parsing probe_events: p:probe/sys_open _text+4276888
    Group:probe Event:sys_open probe:p
    Writing event: r:probe/sys_open__return _text+4276888
    Added new event:
    probe:sys_open__return (on sys_open%return)
    ...

    Reported-by: Aneesh Kumar
    Signed-off-by: Sandipan Das
    Acked-by: Naveen N. Rao
    Cc: Aneesh Kumar
    Cc: Jiri Olsa
    Cc: Ravi Bangoria
    Fixes: 99e608b5954c ("perf probe ppc64le: Fix probe location when using DWARF")
    Link: http://lkml.kernel.org/r/20180809161929.35058-1-sandipan@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     
  • [ Upstream commit 3f4417d693b43fa240ac8bde4487f67745ca23d8 ]

    The argument to nsinfo__copy() was assumed to be valid, but some code paths
    exist that will lead to NULL being passed.

    In particular, running 'perf script -D' on a perf.data file containing an
    PERF_RECORD_MMAP event associating the '[vdso]' dso with pid 0 earlier in
    the event stream will lead to a segfault.

    Since all calling code is already checking for a non-null return value,
    just return NULL for this case as well.

    Signed-off-by: Benno Evers
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Krister Johansen
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180810133614.9925-1-bevers@mesosphere.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Benno Evers
     

10 Sep, 2018

1 commit

  • commit 99cbbe56eb8bede625f410ab62ba34673ffa7d21 upstream.

    When the number of queues grows beyond 32, the array of queues is
    resized but not all members were being copied. Fix by also copying
    'tid', 'cpu' and 'set'.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org
    Fixes: e502789302a6e ("perf auxtrace: Add helpers for queuing AUX area tracing data")
    Link: http://lkml.kernel.org/r/20180814084608.6563-1-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Greg Kroah-Hartman

    Adrian Hunter
     

05 Sep, 2018

4 commits

  • [ Upstream commit 5aa3d1a20a233d4a5f1ec3d62da3f19d9afea682 ]

    This fixes the reported family on modern AMD processors (e.g. Ryzen,
    which is family 0x17). Previously these processors all showed up as
    family 0xf.

    See the document
    https://support.amd.com/TechDocs/56255_OSRR.pdf
    section CPUID_Fn00000001_EAX for how to calculate the family
    from the BaseFamily and ExtFamily values.

    This matches the code in arch/x86/lib/cpu.c

    Signed-off-by: Calvin Walton
    Signed-off-by: Len Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Calvin Walton
     
  • [ Upstream commit 82f4f3e69c5c29bce940dd87a2c0f16c51d48d17 ]

    Add a testcase for checking snapshot and tracing_on
    relationship. This ensures that the snapshotting doesn't
    affect current tracing on/off settings.

    Link: http://lkml.kernel.org/r/153149932412.11274.15289227592627901488.stgit@devbox

    Cc: Tom Zanussi
    Cc: Hiraku Toyooka
    Signed-off-by: Masami Hiramatsu
    Cc: Ingo Molnar
    Cc: Shuah Khan
    Cc: linux-kselftest@vger.kernel.org
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masami Hiramatsu
     
  • [ Upstream commit 9d83601a9cc1884d1b5706ee2acc661d558c6838 ]

    The -S (system summary) option failed to print any data on a 1-processor system.

    Reported-by: Artem Bityutskiy
    Signed-off-by: Len Brown
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Len Brown
     
  • [ Upstream commit a2b22dddc7bb6110ac3b5ed1a60aa9279836fadb ]

    The tools/usb/ffs-test.c file defines cpu_to_le16/32 by using the C
    library htole16/32 function calls. However, cpu_to_le16/32 are used when
    initializing structures, i.e in a context where a function call is not
    allowed.

    It works fine on little endian systems because htole16/32 are defined by
    the C library as no-ops. But on big-endian systems, they are actually
    doing something, which might involve calling a function, causing build
    failures, such as:

    ffs-test.c:48:25: error: initializer element is not constant
    #define cpu_to_le32(x) htole32(x)
    ^~~~~~~
    ffs-test.c:128:12: note: in expansion of macro ‘cpu_to_le32’
    .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
    ^~~~~~~~~~~

    To solve this, we code cpu_to_le16/32 in a way that allows them to be
    used when initializing structures. This fix was imported from
    meta-openembedded/android-tools/fix-big-endian-build.patch written by
    Thomas Petazzoni .

    CC: Thomas Petazzoni
    Signed-off-by: Peter Senna Tschudin
    Signed-off-by: Felipe Balbi
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peter Senna Tschudin
     

24 Aug, 2018

1 commit

  • [ Upstream commit 8b247a92ebd0cda7dec49a6f771d9c4950f3d3ad ]

    The final link of fixdep uses LDFLAGS but not the existing HOSTLDFLAGS.
    Fix this.

    Signed-off-by: Laura Abbott
    Acked-by: Jiri Olsa
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Laura Abbott