14 Sep, 2016

1 commit


09 Sep, 2016

1 commit

  • …jic23/iio into staging-linus

    Jonathan writes:

    Second set of IIO fixes for the 4.8 cycle.

    We have a big rework of the kxsd9 driver queued up behind the fix below and
    a fix for a recent fix that was marked for stable.
    Hence this fix series is perhaps a little more urgent than average for IIO.
    * core
    - a fix for a fix in the last set. The recent fix for blocking ops when
    ! task running left a path (unlikely one) in which the function return
    value was not set - so initialise it to 0.
    - The IIO_TYPE_FRACTIONAL code previously didn't cope with negative
    fractions. Turned out a fix for this was in Analog's tree but hadn't made
    it upstream.
    * bmc150
    - reset chip at init time. At least one board out there ends up coming up
    in an unstable state due to noise during power up. The reset does no
    harm on other boards.
    * kxsd9
    - Fix a bug in the reported scaling due to failing to set the integer
    part to 0.
    * hid-sensors-pressure
    - Output was in the wrong units to comply with the IIO ABI.
    * tools
    - iio_generic_buffer: Fix the trigger-less mode by ensuring we don't fault
    out for having no trigger when we explicitly said we didn't want to have
    one.

    Greg Kroah-Hartman
     

08 Sep, 2016

1 commit

  • Running lguest without arguments or with a wrong argument name
    borks the terminal, because the cleanup handler is set up too late
    in the initialization process.

    Signed-off-by: Daniel Baluta
    Signed-off-by: Rusty Russell
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Daniel Baluta
     

04 Sep, 2016

1 commit

  • Pull staging/IIO driver fixes from Greg KH:
    "Here are a number of small fixes for staging and IIO drivers that
    resolve reported problems.

    Full details are in the shortlog. All of these have been in
    linux-next with no reported issues"

    * tag 'staging-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (35 commits)
    arm: dts: rockchip: add reset node for the exist saradc SoCs
    arm64: dts: rockchip: add reset saradc node for rk3368 SoCs
    iio: adc: rockchip_saradc: reset saradc controller before programming it
    iio: accel: kxsd9: Fix raw read return
    iio: adc: ti_am335x_adc: Increase timeout value waiting for ADC sample
    iio: adc: ti_am335x_adc: Protect FIFO1 from concurrent access
    include/linux: fix excess fence.h kernel-doc notation
    staging: wilc1000: correctly check if associatedsta has not been found
    staging: wilc1000: NULL dereference on error
    staging: wilc1000: txq_event: Fix coding error
    MAINTAINERS: Add file patterns for ion device tree bindings
    MAINTAINERS: Update maintainer entry for wilc1000
    iio: chemical: atlas-ph-sensor: fix typo in val assignment
    iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING"
    staging: comedi: ni_mio_common: fix AO inttrig backwards compatibility
    staging: comedi: dt2811: fix a precedence bug
    staging: comedi: adv_pci1760: Do not return EINVAL for CMDF_ROUND_DOWN.
    staging: comedi: ni_mio_common: fix wrong insn_write handler
    staging: comedi: comedi_test: fix timer race conditions
    staging: comedi: daqboard2000: bug fix board type matching code
    ...

    Linus Torvalds
     

30 Aug, 2016

1 commit

  • Passing the trigger-less mode option on the command line causes
    iio_generic_buffer to fail searching for an IIO trigger.
    Fix this by skipping trigger initialization if trigger-less mode is
    requested.

    Technically it actually fixes:
    7c7e9dad70 where the bug was introduced but as the window to the patch
    below that changes the context was very small let's mark it with that.

    Signed-off-by: Gregor Boirie
    Fixes: deb4d1fdcb5af ("iio: generic_buffer: Fix --trigger-num option")
    Signed-off-by: Jonathan Cameron

    Gregor Boirie
     

29 Aug, 2016

1 commit

  • Pull perf fixes from Thomas Gleixner:
    "A few fixes from the perf departement

    - prevent a imbalanced preemption disable in the events teardown code
    - prevent out of bound acces in perf userspace
    - make perf tools compile with UCLIBC again
    - a fix for the userspace unwinder utility"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/core: Use this_cpu_ptr() when stopping AUX events
    perf evsel: Do not access outside hw cache name arrays
    tools lib: Reinstate strlcpy() header guard with __UCLIBC__
    perf unwind: Use addr_location::addr instead of ip for entries

    Linus Torvalds
     

23 Aug, 2016

1 commit

  • Pull GPIO fixes from Linus Walleij:
    "Here are a few GPIO fixes for v4.8.

    I was expecting some fallout from the new chardev rework but nothing
    like that turned up att all. Instead a Kconfig confusion that I think
    I have finally nailed, then some ordinary driver noise and trivia.

    This fixes a Kconfig issue with UM: when I made GPIOLIB available to
    all archs, that included UM, but the OF part of GPIOLIB requires
    HAS_IOMEM, so we add HAS_IOMEM as a dependency to OF_GPIO.

    This in turn exposed the fact that a few GPIO drivers were implicitly
    assuming OF_GPIO as their dependency but instead depended on OF alone
    (the typical problem being a pointer inside gpio_chip not existing
    unless OF_GPIO is selected) and then UM would fail to compile with
    these drivers instead. Then I lost patience and made any GPIO driver
    depending on just OF depend on OF_GPIO instead, that is certainly what
    they meant and the only thing that makes sense anyway. GPIO with just
    OF but !OF_GPIO does not make sense.

    Also a fix for the max730x driver data pointer, and a minor comment
    fix for the GPIO tools"

    * tag 'gpio-v4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
    gpio: make any OF dependent driver depend on OF_GPIO
    gpio: Fix OF build problem on UM
    gpio: max730x: set gpiochip data pointer before using it
    tools/gpio: fix gpio-event-mon header comment

    Linus Torvalds
     

19 Aug, 2016

3 commits

  • Pull perf fixes from Ingo Molnar:
    "Mostly tooling fixes, but also start/stop filter related fixes, a perf
    event read() fix, a fix uncovered by fuzzing, and an uprobes leak fix"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/core: Check return value of the perf_event_read() IPI
    perf/core: Enable mapping of the stop filters
    perf/core: Update filters only on executable mmap
    perf/core: Fix file name handling for start/stop filters
    perf/core: Fix event_function_local()
    uprobes: Fix the memcg accounting
    perf intel-pt: Fix occasional decoding errors when tracing system-wide
    tools: Sync kvm related header files for arm64 and s390
    perf probe: Release resources on error when handling exit paths
    perf probe: Check for dup and fdopen failures
    perf symbols: Fix annotation of objects with debuginfo files
    perf script: Don't disable use_callchain if input is pipe
    perf script: Show proper message when failed list scripts
    perf jitdump: Add the right header to get the major()/minor() definitions
    perf ppc64le: Fix build failure when libelf is not present
    perf tools mem: Fix -t store option for record command
    perf intel-pt: Fix ip compression

    Linus Torvalds
     
  • We have to check if the values are >= *_MAX, not just >, fix it.

    From the bugzilla report:

    ''In file /tools/perf/util/evsel.c function __perf_evsel__hw_cache_name
    it appears that there is a bug that reads beyond the end of the buffer.
    The statement "if (type > PERF_COUNT_HW_CACHE_MAX)" allows type to be
    equal to the maximum value. Later, when statement "if
    (!perf_evsel__is_cache_op_valid(type, op))" is executed, the function
    can access array perf_evsel__hw_cache_stat[type] beyond the end of the
    buffer.

    It appears to me that the statement "if (type > PERF_COUNT_HW_CACHE_MAX)"
    should be "if (type >= PERF_COUNT_HW_CACHE_MAX)"

    Bug found with Coverity and manual code review. No attempts were made to
    execute the code with a maximum type value.''

    Committer note:

    Testing it:

    $ perf record -e $(echo $(perf list cache | cut -d \[ -f1) | sed 's/ /,/g') usleep 1
    [ perf record: Woken up 16 times to write data ]
    [ perf record: Captured and wrote 0.023 MB perf.data (34 samples) ]
    $ perf evlist
    L1-dcache-load-misses
    L1-dcache-loads
    L1-dcache-stores
    L1-icache-load-misses
    LLC-load-misses
    LLC-loads
    LLC-store-misses
    LLC-stores
    branch-load-misses
    branch-loads
    dTLB-load-misses
    dTLB-loads
    dTLB-store-misses
    dTLB-stores
    iTLB-load-misses
    iTLB-loads
    node-load-misses
    node-loads
    node-store-misses
    node-stores
    $ perf list cache

    List of pre-defined events (to be used in -e):

    L1-dcache-load-misses [Hardware cache event]
    L1-dcache-loads [Hardware cache event]
    L1-dcache-stores [Hardware cache event]
    L1-icache-load-misses [Hardware cache event]
    LLC-load-misses [Hardware cache event]
    LLC-loads [Hardware cache event]
    LLC-store-misses [Hardware cache event]
    LLC-stores [Hardware cache event]
    branch-load-misses [Hardware cache event]
    branch-loads [Hardware cache event]
    dTLB-load-misses [Hardware cache event]
    dTLB-loads [Hardware cache event]
    dTLB-store-misses [Hardware cache event]
    dTLB-stores [Hardware cache event]
    iTLB-load-misses [Hardware cache event]
    iTLB-loads [Hardware cache event]
    node-load-misses [Hardware cache event]
    node-loads [Hardware cache event]
    node-store-misses [Hardware cache event]
    node-stores [Hardware cache event]
    $

    Reported-by: Brian Sweeney
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Jiri Olsa
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=153351
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • perf tools build in recent kernels spews splat when cross compiling with uClibc:

    | CC util/alias.o
    | In file included from tools/perf/util/../ui/../util/cache.h:8:0,
    | from tools/perf/util/../ui/helpline.h:7,
    | from tools/perf/util/debug.h:8,
    | from arch/../util/cpumap.h:9,
    | from arch/../util/env.h:5,
    | from arch/common.h:4,
    | from arch/common.c:3:
    | tools/include/linux/string.h:12:15: warning: redundant redeclaration of ‘strlcpy’ [-Wredundant-decls]
    | extern size_t strlcpy(char *dest, const char *src, size_t size);
    ^
    This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with
    __GLIBC__").

    The problem is uClibc also defines __GLIBC__ for exported headers for
    applications. So add that specific check to not trip for uClibc.

    Signed-off-by: Vineet Gupta
    Cc: Adrian Hunter
    Cc: Alexey Brodkin
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Petri Gynther
    Cc: Wang Nan
    Cc: linux-snps-arc@lists.infradead.org
    Link: http://lkml.kernel.org/r/1471537703-16439-1-git-send-email-vgupta@synopsys.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Vineet Gupta
     

17 Aug, 2016

3 commits

  • Pull virtio/vhost fixes from Michael Tsirkin:
    - test fixes
    - a vsock fix

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    tools/virtio: add dma stubs
    vhost/test: fix after swiotlb changes
    vhost/vsock: drop space available check for TX vq
    ringtest: test build fix

    Linus Torvalds
     
  • This fixes the srcline translation for call chains of user space
    applications.

    Before we got:

    perf report --stdio --no-children -s sym,srcline -g address
    8.92% [.] main mandelbrot.h:41
    |
    |--3.70%--main +8390240
    | __libc_start_main +139950056726769
    | _start +8388650
    |
    |--2.74%--main +8390189
    |
    --2.08%--main +8390296
    __libc_start_main +139950056726769
    _start +8388650

    7.59% [.] main complex:1326
    |
    |--4.79%--main +8390203
    | __libc_start_main +139950056726769
    | _start +8388650
    |
    --2.80%--main +8390219

    7.12% [.] __muldc3 libgcc2.c:1945
    |
    |--3.76%--__muldc3 +139950060519490
    | main +8390224
    | __libc_start_main +139950056726769
    | _start +8388650
    |
    --3.32%--__muldc3 +139950060519512
    main +8390224

    With this patch applied, we instead get:

    perf report --stdio --no-children -s sym,srcline -g address
    8.92% [.] main mandelbrot.h:41
    |
    |--3.70%--main mandelbrot.h:41
    | __libc_start_main +241
    | _start +4194346
    |
    |--2.74%--main mandelbrot.h:41
    |
    --2.08%--main mandelbrot.h:41
    __libc_start_main +241
    _start +4194346

    7.59% [.] main complex:1326
    |
    |--4.79%--main complex:1326
    | __libc_start_main +241
    | _start +4194346
    |
    --2.80%--main complex:1326

    7.12% [.] __muldc3 libgcc2.c:1945
    |
    |--3.76%--__muldc3 libgcc2.c:1945
    | main mandelbrot.h:39
    | __libc_start_main +241
    | _start +4194346
    |
    --3.32%--__muldc3 libgcc2.c:1945
    main mandelbrot.h:39

    Suggested-and-Acked-by: Namhyung Kim
    Signed-off-by: Milian Wolff
    Tested-by: Arnaldo Carvalho de Melo
    LPU-Reference: 20160816153926.11288-1-milian.wolff@kdab.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Milian Wolff
     
  • …/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    - Fix occasional decoding errors when tracing system-wide with
    Intel PT (Adrian Hunter)

    - Fix ip compression in Intel PT for some specific packet types not
    present on current hardware (Adrian Hunter)

    - Fix annotation of objects with debuginfo files (Anton Blanchard)

    - Fix build on Fedora Rawhide (25) wrt using the right header to
    get the major() & minor() definitions in the jitdump code, now
    it is deprecated getting those using sys/types.h, one has to use
    sys/sysmacros.h (Arnaldo Carvalho de Melo)

    - Sync arm64/s390 kvm related header files (Arnaldo Carvalho de Melo)

    - Check for dup and fdopen failures in 'perf probe' (Colin Ian King,
    Arnaldo Carvalho de Melo)

    - Fix showing callchains in pipe mode, i.e.

    perf record -g -o - workload | perf script

    now shows callchains (He Kuang)

    - Show proper message when the scripts directory points to some
    invalid location in 'perf script --list' (He Kuang)

    - Fix 'perf mem -t store' to record 'cpu/mem-stores/P' events
    again (Jiri Olsa)

    - Fix ppc64le build failure when libelf is not present (Ravi Bangoria)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

16 Aug, 2016

9 commits

  • In order to successfully decode Intel PT traces, context switch events
    are needed from the moment the trace starts. Currently that is ensured
    by using the 'immediate' flag which enables the switch event when it is
    opened.

    However, since commit 86c2786994bd ("perf intel-pt: Add support for
    PERF_RECORD_SWITCH") that might not always happen. When tracing
    system-wide the context switch event is added to the tracking event
    which was not set as 'immediate'. Change that so it is.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Cc: stable@vger.kernel.org # v4.4+
    Fixes: 86c2786994bd ("perf intel-pt: Add support for PERF_RECORD_SWITCH")
    Link: http://lkml.kernel.org/r/1471245784-22580-1-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     
  • From a quick look nothing stands out as requiring changes to kvm tools
    such as tools/perf/arch/s390/util/kvm-stat.c.

    Silences these header checking warnings:

    $ make -C tools/perf
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    Warning: tools/arch/s390/include/uapi/asm/kvm.h differs from kernel
    Warning: tools/arch/s390/include/uapi/asm/sie.h differs from kernel
    Warning: tools/arch/arm64/include/uapi/asm/kvm.h differs from kernel

    Cc: Adrian Hunter
    Cc: Alexander Yarygin
    Cc: David Ahern
    Cc: Hemant Kumar
    Cc: Jiri Olsa
    Cc: Michael Ellerman
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Scott Wood
    Cc: Srikar Dronamraju
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-btutge414g516qmh6r5ienlj@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Cc: Adrian Hunter
    Cc: Colin King
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-zh2j4iqimralugke5qq7dn6d@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • dup and fdopen can potentially fail, so add some extra
    error handling checks rather than assuming they always work.

    Signed-off-by: Colin King
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1471038296-12956-1-git-send-email-colin.king@canonical.com
    [ Free resources when those functions (now being verified) fail ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Colin Ian King
     
  • Commit 73cdf0c6ea9c ("perf symbols: Record text offset in dso
    to calculate objdump address") started storing the offset of
    the text section for all DSOs:

    if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
    dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;

    Unfortunately this breaks debuginfo files, because we need to calculate
    the offset of the text section in the associated executable file. As a
    result perf annotate returns junk for all debuginfo files.

    Fix this by using runtime_ss->elf which should point at the executable
    when parsing a debuginfo file.

    Signed-off-by: Anton Blanchard
    Reviewed-by: Naveen N. Rao
    Tested-by: Wang Nan
    Cc: Peter Zijlstra
    Cc: Ravi Bangoria
    Cc: stable@vger.kernel.org # v4.6+
    Fixes: 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address")
    Link: http://lkml.kernel.org/r/20160813115533.6de17912@kryten
    Signed-off-by: Arnaldo Carvalho de Melo

    Anton Blanchard
     
  • Because perf data from pipe do not have a header with evsel attr, we
    should not check that and disable symbol_conf.use_callchain. Otherwise,
    perf script won't show callchains even if the data stream contains
    callchain.

    Before:
    $ perf record -g -o - uname |perf script
    Linux
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.000 MB - ]
    uname 1828 182630.186578: 250000 cpu-clock: ..b9499 setup_arg_pages
    uname 1828 182630.186850: 250000 cpu-clock: ..83b20 ___might_sleep
    uname 1828 182630.187153: 250000 cpu-clock: ..4b6be file_map_prot_ch
    ...

    After:
    $ perf record -g -o - uname |perf script
    Linux
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.000 MB - ]
    uname 1833 182675.927099: 250000 cpu-clock:
    ba5520 _raw_spin_lock+0xfe200040 ([kernel.kallsyms])
    389dd4 expand_downwards+0xfe200154 ([kernel.kallsyms])
    389f34 expand_stack+0xfe200024 ([kernel.kallsyms])
    3b957e setup_arg_pages+0xfe20019e ([kernel.kallsyms])
    40c80f load_elf_binary+0xfe20042f ([kernel.kallsyms])
    ...

    Signed-off-by: He Kuang
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470309943-153909-2-git-send-email-hekuang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     
  • Perf shows the usage message when perf scripts folder failed to open,
    which misleads users to let them think the command is being mistyped.

    This patch shows a proper message and guides users to check the
    PERF_EXEC_PATH environment variable in that case.

    Before:

    $ perf script --list

    Usage: perf script []
    or: perf script [] record ]
    or: perf script [] report ] ]
    or: perf script [] [script-args]

    -l, --list list available scripts

    After:

    $ perf script --list
    open(/home/user/perf-core/scripts) failed.
    Check for "PERF_EXEC_PATH" env to set scripts dir.

    Signed-off-by: He Kuang
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470309943-153909-1-git-send-email-hekuang@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    He Kuang
     
  • Noticed on Fedora Rawhide:

    $ gcc --version
    gcc (GCC) 6.1.1 20160721 (Red Hat 6.1.1-4)
    $ rpm -q glibc
    glibc-2.24.90-1.fc26.x86_64
    $

    CC /tmp/build/perf/util/jitdump.o
    util/jitdump.c: In function 'jit_repipe_code_load':
    util/jitdump.c:428:2: error: '__major_from_sys_types' is deprecated:
    In the GNU C Library, `major' is defined by .
    For historical compatibility, it is currently defined by
    as well, but we plan to remove this soon.
    To use `major', include directly.
    If you did not intend to use a system-defined macro `major',
    you should #undef it after including .
    [-Werror=deprecated-declarations]
    event->mmap2.maj = major(st.st_dev);
    ^~~~~
    In file included from /usr/include/features.h:397:0,
    from /usr/include/sys/types.h:25,
    from util/jitdump.c:1:
    /usr/include/sys/sysmacros.h:87:1: note: declared here
    __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_FST_IMPL_TEMPL)

    Fix it following that recomendation.

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Stephane Eranian
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-3majvd0adhfr25rvx4v5e9te@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Uninitialized channel pointer causes segmentation fault when we
    call free(channel) during cleanup() with no channels initialized.
    This happens when you exit early for usage errors. Initialize
    the pointer to NULL when it is declared.

    Signed-off-by: Alison Schofield
    Cc: Daniel Baluta
    Tested-by: Gregor Boirie
    Signed-off-by: Jonathan Cameron

    Alison Schofield
     

15 Aug, 2016

2 commits


13 Aug, 2016

5 commits

  • Pull perf fixes from Ingo Molnar:
    "Mostly tooling fixes, plus two uncore-PMU fixes, an uprobes fix, a
    perf-cgroups fix and an AUX events fix"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/x86/intel/uncore: Add enable_box for client MSR uncore
    perf/x86/intel/uncore: Fix uncore num_counters
    uprobes/x86: Fix RIP-relative handling of EVEX-encoded instructions
    perf/core: Set cgroup in CPU contexts for new cgroup events
    perf/core: Fix sideband list-iteration vs. event ordering NULL pointer deference crash
    perf probe ppc64le: Fix probe location when using DWARF
    perf probe: Add function to post process kernel trace events
    tools: Sync cpufeatures headers with the kernel
    toops: Sync tools/include/uapi/linux/bpf.h with the kernel
    tools: Sync cpufeatures.h and vmx.h with the kernel
    perf probe: Support signedness casting
    perf stat: Avoid skew when reading events
    perf probe: Fix module name matching
    perf probe: Adjust map->reloc offset when finding kernel symbol from map
    perf hists: Trim libtraceevent trace_seq buffers
    perf script: Add 'bpf-output' field to usage message

    Linus Torvalds
     
  • Pull libnvdimm fixes from Dan Williams:

    - Fix for the nd_blk (NVDIMM Block Window Aperture) driver.

    A spec clarification requires the driver to mask off reserved bits in
    status register. This is tagged for -stable back to the v4.2 kernel.

    - Fix for a kernel crash in the nvdimm unit tests when module loading
    is interrupted with SIGTERM. Tagged for -stable since validation
    efforts external to Intel use the unit tests for qualifying
    backports.

    - Add a new 'size' sysfs attribute for the BTT (NVDIMM Block
    Translation Table) driver to make it symmetric with the other
    namespace personality drivers (PFN and DAX) that provide a size
    attribute for indicating how much namespace capacity is lost to
    metadata.

    The BTT change arrived at the start of the merge window and has
    appeared in a -next release. It can technically wait for 4.9, but it
    is small, fixes asymmetry in the libnvdimm-sysfs interface, and
    something I would have squeezed into the v4.8 pull request had it
    arrived a few days earlier.

    * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
    tools/testing/nvdimm: fix SIGTERM vs hotplug crash
    nvdimm, btt: add a size attribute for BTTs
    libnvdimm, nd_blk: mask off reserved status bits

    Linus Torvalds
     
  • arch__post_process_probe_trace_events() calls get_target_map() to
    prepare symbol table. get_target_map() is defined inside
    util/probe-event.c.

    probe-event.c will only get included in perf binary if CONFIG_LIBELF is
    set. Hence arch__post_process_probe_trace_events() needs to be defined
    inside #ifdef HAVE_LIBELF_SUPPORT to solve compilation error.

    Reported-and-Tested-by: Anton Blanchard
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Peter Zijlstra
    Cc: Alexander Shishkin
    Cc: Balbir Singh
    Cc: Naveen N. Rao
    Cc: Ananth N Mavinakayanahalli
    Cc: Masami Hiramatsu
    Cc: Wang Nan
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/57ABFF88.8030905@linux.vnet.ibm.com
    [ Thunderbird MUA mangled it, fix that ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • Michael reported 'perf mem -t store record' being broken. The reason is
    latest rework of this area:

    commit acbe613e0c03 ("perf tools: Add monitored events array")

    We don't mark perf_mem_events store record when -t store option is
    specified.

    Committer notes:

    Before:

    # perf mem -t store record usleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.020 MB perf.data (7 samples) ]
    # perf evlist
    cycles:ppp
    #

    After:

    # perf mem -t store record usleep 1
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.020 MB perf.data (7 samples) ]
    # perf evlist
    cpu/mem-stores/P
    #

    Reported-by: Michael Petlan
    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Cc: David Ahern
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Fixes: acbe613e0c03 ("perf tools: Add monitored events array")
    Link: http://lkml.kernel.org/r/1470905457-18311-1-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Jiri Olsa
     
  • The June 2015 Intel SDM introduced IP Compression types 4 and 6. Refer
    to section 36.4.2.2 Target IP (TIP) Packet - IP Compression.

    Existing Intel PT packet decoder did not support type 4, and got type 6
    wrong. Because type 3 and type 4 have the same number of bytes, the
    packet 'count' has been changed from being the number of ip bytes to
    being the type code. That allows the Intel PT decoder to correctly
    decide whether to sign-extend or use the last ip. However that also
    meant the code had to be adjusted in a number of places.

    Currently hardware is not using the new compression types, so this fix
    has no effect on existing hardware.

    Signed-off-by: Adrian Hunter
    Cc: Jiri Olsa
    Link: http://lkml.kernel.org/r/1469005206-3049-1-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

11 Aug, 2016

1 commit

  • The unit tests crash when hotplug races the previous probe. This race
    requires that the loading of the nfit_test module be terminated with
    SIGTERM, and the module to be unloaded while the ars scan is still
    running.

    In contrast to the normal nfit driver, the unit test calls
    acpi_nfit_init() twice to simulate hotplug, whereas the nominal case
    goes through the acpi_nfit_notify() event handler. The
    acpi_nfit_notify() path is careful to flush the previous region
    registration before servicing the hotplug event. The unit test was
    missing this guarantee.

    BUG: unable to handle kernel NULL pointer dereference at (null)
    IP: [] pwq_activate_delayed_work+0x47/0x170
    [..]
    Call Trace:
    [] pwq_dec_nr_in_flight+0x66/0xa0
    [] process_one_work+0x2d0/0x680
    [] ? process_one_work+0x171/0x680
    [] worker_thread+0x4e/0x480
    [] ? process_one_work+0x680/0x680
    [] ? process_one_work+0x680/0x680
    [] kthread+0xf3/0x110
    [] ret_from_fork+0x1f/0x40
    [] ? kthread_create_on_node+0x230/0x230

    Cc:
    Signed-off-by: Dan Williams

    Dan Williams
     

10 Aug, 2016

2 commits

  • We have some tests that assume we're using std=gnu99, which is fine on
    most compilers, but some old compilers use a different default.

    So make it explicit that we want to use std=gnu99.

    Signed-off-by: Michael Ellerman

    Michael Ellerman
     
  • …/kernel/git/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    User visible fixes:

    - Fix the lookup for a kernel module in 'perf probe', fixing for instance, the
    erroneous return of "[raid10]" when looking for "[raid1]" (Konstantin Khlebnikov)

    - Disable counters in a group before reading them in 'perf stat', to avoid skew (Mark Rutland)

    - Fix adding probes to function aliases in systems using kaslr (Masami Hiramatsu)

    - Trip libtraceevent trace_seq buffers, removing unnecessary memory usage that could
    bring a system using tracepoint events with 'perf top' to a crawl, as the trace_seq
    buffers start at a whooping 4 KB, which is very rarely used in perf's usecases,
    so realloc it to the really used space as a last measure after using libtraceevent
    functions to format the fields of tracepoint events (Arnaldo Carvalho de Melo)

    - Fix 'perf probe' location when using DWARF on ppc64le (Ravi Bangoria)

    - Allow specifying signedness casts to a 'perf probe' variable, to shorten
    the number of steps to see signed values that otherwise would always appear
    as hex values (Naohiro Aota)

    Documentation fixes:

    - Add 'bpf-output' field to 'perf script' usage message (Brendan Gregg)

    Infrastructure fixes:

    - Sync kernel header files: cpufeatures.h, {disabled,required}-features.h,
    bpf.h and vmx.h, so that we get a clean build, without warnings about files
    being different from the kernel counterparts.

    A verification of the need or desirability of changes in tools/ based on what
    was done in the kernel changesets was made and documented in the respective
    file sync changesets (Arnaldo Carvalho de Melo)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     

09 Aug, 2016

8 commits

  • Powerpc has Global Entry Point and Local Entry Point for functions. LEP
    catches call from both the GEP and the LEP. Symbol table of ELF contains
    GEP and Offset from which we can calculate LEP, but debuginfo does not
    have LEP info.

    Currently, perf prioritize symbol table over dwarf to probe on LEP for
    ppc64le. But when user tries to probe with function parameter, we fall
    back to using dwarf(i.e. GEP) and when function called via LEP, probe
    will never hit.

    For example:

    $ objdump -d vmlinux
    ...
    do_sys_open():
    c0000000002eb4a0: e8 00 4c 3c addis r2,r12,232
    c0000000002eb4a4: 60 00 42 38 addi r2,r2,96
    c0000000002eb4a8: a6 02 08 7c mflr r0
    c0000000002eb4ac: d0 ff 41 fb std r26,-48(r1)

    $ sudo ./perf probe do_sys_open
    $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060904

    $ sudo ./perf probe 'do_sys_open filename:string'
    $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060896 filename_string=+0(%gpr4):string

    For second case, perf probed on GEP. So when function will be called via
    LEP, probe won't hit.

    $ sudo ./perf record -a -e probe:do_sys_open ls
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.195 MB perf.data ]

    To resolve this issue, let's not prioritize symbol table, let perf
    decide what it wants to use. Perf is already converting GEP to LEP when
    it uses symbol table. When perf uses debuginfo, let it find LEP offset
    form symbol table. This way we fall back to probe on LEP for all cases.

    After patch:

    $ sudo ./perf probe 'do_sys_open filename:string'
    $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060904 filename_string=+0(%gpr4):string

    $ sudo ./perf record -a -e probe:do_sys_open ls
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.197 MB perf.data (11 samples) ]

    Signed-off-by: Ravi Bangoria
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Ananth N Mavinakayanahalli
    Cc: Balbir Singh
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470723805-5081-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • Instead of inline code, introduce function to post process kernel
    probe trace events.

    Signed-off-by: Ravi Bangoria
    Acked-by: Masami Hiramatsu
    Cc: Alexander Shishkin
    Cc: Ananth N Mavinakayanahalli
    Cc: Balbir Singh
    Cc: Namhyung Kim
    Cc: Naveen N. Rao
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470723805-5081-1-git-send-email-ravi.bangoria@linux.vnet.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Ravi Bangoria
     
  • Due to:

    1e61f78baf89 ("x86/cpufeature: Make sure DISABLED/REQUIRED macros are updated")

    No changes to tools using those headers (tools/arch/x86/lib/mem{set,cpu}_64.S)
    seems necessary.

    Detected by the tools build header drift checker:

    $ make -C tools/perf O=/tmp/build/perf
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    GEN /tmp/build/perf/common-cmds.h
    Warning: tools/arch/x86/include/asm/disabled-features.h differs from kernel
    Warning: tools/arch/x86/include/asm/required-features.h differs from kernel
    Warning: tools/arch/x86/include/asm/cpufeatures.h differs from kernel
    CC /tmp/build/perf/util/probe-finder.o
    CC /tmp/build/perf/builtin-help.o

    ^C$

    Cc: Adrian Hunter
    Cc: Dave Hansen
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-ja75m7zk8j0jkzmrv16i5ehw@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The way we're using kernel headers in tools/ now, with a copy that is
    made to the same path prefixed by "tools/" plus checking if that copy
    got stale, i.e. if the kernel counterpart changed, helps in keeping
    track with new features that may be useful for tools to exploit.

    For instance, looking at all the changes to bpf.h since it was last
    copied to tools/include brings this to toolers' attention:

    Need to investigate this one to check how to run a program via perf, setting up
    a BPF event, that will take advantage of the way perf already calls clang/LLVM,
    sets up the event and runs the workload in a single command line, helping in
    debugging such semi cooperative programs:

    96ae52279594 ("bpf: Add bpf_probe_write_user BPF helper to be called in tracers")

    This one needs further investigation about using the feature it improves
    in 'perf trace' to do some tcpdumpin' mixed with syscalls, tracepoints,
    probe points, callgraphs, etc:

    555c8a8623a3 ("bpf: avoid stack copy and use skb ctx for event output")

    Add tracing just packets that are related to some container to that mix:

    4a482f34afcc ("cgroup: bpf: Add bpf_skb_in_cgroup_proto")
    4ed8ec521ed5 ("cgroup: bpf: Add BPF_MAP_TYPE_CGROUP_ARRAY")

    Definetely needs to have example programs accessing task_struct from a bpf proggie
    started from 'perf trace':

    606274c5abd8 ("bpf: introduce bpf_get_current_task() helper")

    Core networking related, XDP:

    6ce96ca348a9 ("bpf: add XDP_TX xdp_action for direct forwarding")
    6a773a15a1e8 ("bpf: add XDP prog type for early driver filter")
    13c5c240f789 ("bpf: add bpf_get_hash_recalc helper")
    d2485c4242a8 ("bpf: add bpf_skb_change_type helper")
    6578171a7ff0 ("bpf: add bpf_skb_change_proto helper")

    Changes detected by the tools build system:

    $ make -C tools/perf O=/tmp/build/perf install-bin
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    Warning: tools/include/uapi/linux/bpf.h differs from kernel
    INSTALL GTK UI
    CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o

    $

    Cc: Adrian Hunter
    Cc: Alexei Starovoitov
    Cc: Brenden Blanco
    Cc: Daniel Borkmann
    Cc: David Ahern
    Cc: David S. Miller
    Cc: Jiri Olsa
    Cc: Martin KaFai Lau
    Cc: Namhyung Kim
    Cc: Sargun Dhillon
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-difq4ts1xvww6eyfs9e7zlft@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • There were changes related to the deprecation of the "pcommit"
    instruction:

    fd1d961dd681 ("x86/insn: remove pcommit")
    dfa169bbee00 ("Revert "KVM: x86: add pcommit support"")

    No need to update anything in the tools, as "pcommit" wasn't being
    listed on the VMX_EXIT_REASONS in the tools/perf/arch/x86/util/kvm-stat.c
    file.

    Just grab fresh copies of these files to silence the file cache
    coherency detector:

    $ make -C tools/perf O=/tmp/build/perf install-bin
    make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD: Doing 'make -j4' parallel build
    Warning: tools/arch/x86/include/asm/cpufeatures.h differs from kernel
    Warning: tools/arch/x86/include/uapi/asm/vmx.h differs from kernel
    INSTALL GTK UI

    #

    Cc: Adrian Hunter
    Cc: Dan Williams
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Paolo Bonzini
    Cc: Ross Zwisler
    Cc: Wang Nan
    Cc: Xiao Guangrong
    Link: http://lkml.kernel.org/n/tip-07pmcc1ysydhyyxbmp1vt0l4@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • The 'perf probe' tool detects a variable's type and use the detected
    type to add a new probe. Then, kprobes prints its variable in
    hexadecimal format if the variable is unsigned and prints in decimal if
    it is signed.

    We sometimes want to see unsigned variable in decimal format (i.e.
    sector_t or size_t). In that case, we need to investigate the variable's
    size manually to specify just signedness.

    This patch add signedness casting support. By specifying "s" or "u" as a
    type, perf-probe will investigate variable size as usual and use the
    specified signedness.

    E.g. without this:

    $ perf probe -a 'submit_bio bio->bi_iter.bi_sector'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector)
    You can now use it in all perf tools, such as:
    perf record -e probe:submit_bio -aR sleep 1
    $ cat trace_pipe|head
    dbench-9692 [003] d..1 971.096633: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x3a3d00
    dbench-9692 [003] d..1 971.096685: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x1a3d80
    dbench-9692 [003] d..1 971.096687: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x3a3d80
    ...
    // need to investigate the variable size
    $ perf probe -a 'submit_bio bio->bi_iter.bi_sector:s64'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s64)
    You can now use it in all perf tools, such as:
    perf record -e probe:submit_bio -aR sleep 1

    With this:

    // just use "s" to cast its signedness
    $ perf probe -v -a 'submit_bio bio->bi_iter.bi_sector:s'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s)
    You can now use it in all perf tools, such as:
    perf record -e probe:submit_bio -aR sleep 1
    $ cat trace_pipe|head
    dbench-9689 [001] d..1 1212.391237: submit_bio: (submit_bio+0x0/0x140) bi_sector=128
    dbench-9689 [001] d..1 1212.391252: submit_bio: (submit_bio+0x0/0x140) bi_sector=131072
    dbench-9697 [006] d..1 1212.398611: submit_bio: (submit_bio+0x0/0x140) bi_sector=30208

    This commit also update perf-probe.txt to describe "types". Most parts
    are based on existing documentation: Documentation/trace/kprobetrace.txt

    Committer note:

    Testing using 'perf trace':

    # perf probe -a 'submit_bio bio->bi_iter.bi_sector'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector)

    You can now use it in all perf tools, such as:

    perf record -e probe:submit_bio -aR sleep 1

    # trace --no-syscalls --ev probe:submit_bio
    0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=0xc133c0)
    3181.861 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffb8)
    3181.881 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffc0)
    3184.488 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffc8)

    4717.927 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x4dc7a88)
    4717.970 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x4dc7880)
    ^C[root@jouet ~]#

    Now, using this new feature:

    [root@jouet ~]# perf probe -a 'submit_bio bio->bi_iter.bi_sector:s'
    Added new event:
    probe:submit_bio (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s)

    You can now use it in all perf tools, such as:

    perf record -e probe:submit_bio -aR sleep 1

    [root@jouet ~]# trace --no-syscalls --ev probe:submit_bio
    0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145704)
    0.017 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145712)
    0.019 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145720)
    2.567 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145728)
    5631.919 probe:submit_bio:(ffffffffac3aee00) bi_sector=0)
    5631.941 probe:submit_bio:(ffffffffac3aee00) bi_sector=8)
    5631.945 probe:submit_bio:(ffffffffac3aee00) bi_sector=16)
    5631.948 probe:submit_bio:(ffffffffac3aee00) bi_sector=24)
    ^C#

    With callchains:

    # trace --no-syscalls --ev probe:submit_bio/max-stack=10/
    0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662544)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    0.023 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662552)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    0.027 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662560)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    2.593 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662568)
    submit_bio+0xa8200001 ([kernel.kallsyms])
    submit_bh+0xa8200013 ([kernel.kallsyms])
    journal_submit_commit_record+0xa82001ac ([kernel.kallsyms])
    jbd2_journal_commit_transaction+0xa82012e8 ([kernel.kallsyms])
    kjournald2+0xa82000ca ([kernel.kallsyms])
    kthread+0xa82000d8 ([kernel.kallsyms])
    ret_from_fork+0xa820001f ([kernel.kallsyms])
    ^C#

    Signed-off-by: Naohiro Aota
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Hemant Kumar
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Link: http://lkml.kernel.org/r/1470710408-23515-1-git-send-email-naohiro.aota@hgst.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Naohiro Aota
     
  • When we don't have a tracee (i.e. we're attaching to a task or CPU),
    counters can still be running after our workload finishes, and can still
    be running as we read their values. As we read events one-by-one, there
    can be arbitrary skew between values of events, even within a group.
    This means that ratios within an event group are not reliable.

    This skew can be seen if measuring a group of identical events, e.g:

    # perf stat -a -C0 -e '{cycles,cycles}' sleep 1

    To avoid this, we must stop groups from counting before we read the
    values of any constituent events. This patch adds and makes use of a new
    disable_counters() helper, which disables group leaders (and thus each
    group as a whole). This mirrors the use of enable_counters() for
    starting event groups in the absence of a tracee.

    Closing a group leader splits the group, and without a disabled group
    leader the newly split events will begin counting. Thus to ensure counts
    are reliable we must defer closing group leaders until all counts have
    been read. To do so this patch removes the event closing logic from the
    read_counters() helper, explicitly closes the events using
    perf_evlist__close(), which also aids legibility.

    Signed-off-by: Mark Rutland
    Tested-by: Arnaldo Carvalho de Melo
    Cc: Alexander Shishkin
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1470747869-3567-1-git-send-email-mark.rutland@arm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Mark Rutland
     
  • If module is "module" then dso->short_name is "[module]". Substring
    comparing is't enough: "raid10" matches to "[raid1]". This patch also
    checks terminating zero in module name.

    Signed-off-by: Konstantin Khlebnikov
    Acked-by: Masami Hiramatsu
    Link: http://lkml.kernel.org/r/147039975648.715620.12985971832789032159.stgit@buzz
    Signed-off-by: Arnaldo Carvalho de Melo

    Konstantin Khlebnikov