1. 22 Jan, 2019 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo-5.0-20190121' of... · d3c8c0af
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo-5.0-20190121' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
      Kernel:
      
        Stephane Eranian:
      
        - Fix perf_proc_update_handler() bug.
      
      perf script:
      
        Andi Kleen:
      
        - Fix crash with printing mixed trace point and other events.
      
        Tony Jones:
      
        - Fix crash when processing recorded stat data.
      
      perf top:
      
        He Kuang:
      
        - Fix wrong hottest instruction highlighted.
      
      perf python:
      
        Arnaldo Carvalho de Melo:
      
        - Remove -fstack-clash-protection when building with some clang versions.
      
      perf ordered_events:
      
        Jiri Olsa:
      
        - Fix out of buffers crash in ordered_events__free().
      
      perf cpu_map:
      
        Stephane Eranian:
      
        - Handle TOPOLOGY headers with no CPU.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d3c8c0af
  2. 21 Jan, 2019 3 commits
    • Tony Jones's avatar
      perf script: Fix crash when processing recorded stat data · 8bf8c6da
      Tony Jones authored
      While updating perf to work with Python3 and Python2 I noticed that the
      stat-cpi script was dumping core.
      
      $ perf  stat -e cycles,instructions record -o /tmp/perf.data /bin/false
      
       Performance counter stats for '/bin/false':
      
                 802,148      cycles
      
                 604,622      instructions                                                       802,148      cycles
                 604,622      instructions
      
             0.001445842 seconds time elapsed
      
      $ perf script -i /tmp/perf.data -s scripts/python/stat-cpi.py
      Segmentation fault (core dumped)
      ...
      ...
          rblist=rblist@entry=0xb2a200 <rt_stat>,
          new_entry=new_entry@entry=0x7ffcb755c310) at util/rblist.c:33
          ctx=<optimized out>, type=<optimized out>, create=<optimized out>,
          cpu=<optimized out>, evsel=<optimized out>) at util/stat-shadow.c:118
          ctx=<optimized out>, type=<optimized out>, st=<optimized out>)
          at util/stat-shadow.c:196
          count=count@entry=727442, cpu=cpu@entry=0, st=0xb2a200 <rt_stat>)
          at util/stat-shadow.c:239
          config=config@entry=0xafeb40 <stat_config>,
          counter=counter@entry=0x133c6e0) at util/stat.c:372
      ...
      ...
      
      The issue is that since 1fcd0394 perf_stat__update_shadow_stats now calls
      update_runtime_stat passing rt_stat rather than calling update_stats but
      perf_stat__init_shadow_stats has never been called to initialize rt_stat in
      the script path processing recorded stat data.
      
      Since I can't see any reason why perf_stat__init_shadow_stats() is presently
      initialized like it is in builtin-script.c::perf_sample__fprint_metric()
      [4bd1bef8] I'm proposing it instead be initialized once in __cmd_script
      
      Committer testing:
      
      After applying the patch:
      
        # perf script -i /tmp/perf.data -s tools/perf/scripts/python/stat-cpi.py
             0.001970: cpu -1, thread -1 -> cpi 1.709079 (1075684/629394)
        #
      
      No segfault.
      Signed-off-by: default avatarTony Jones <tonyj@suse.de>
      Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Fixes: 1fcd0394 ("perf stat: Update per-thread shadow stats")
      Link: http://lkml.kernel.org/r/20190120191414.12925-1-tonyj@suse.deSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8bf8c6da
    • He Kuang's avatar
      perf top: Fix wrong hottest instruction highlighted · da06d568
      He Kuang authored
      The annotation line percentage is compared and inserted into the rbtree,
      but the percent field of 'struct annotation_data' is an array, the
      comparison result between them is the address difference.
      
      This patch compares the right slot of percent array according to
      opts->percent_type and makes things right.
      
      The problem can be reproduced by pressing 'H' in perf top annotation view.
      It should highlight the instruction line which has the highest sampling
      percentage.
      Signed-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190120160523.4391-1-hekuang@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da06d568
    • Stephane Eranian's avatar
      perf tools: Handle TOPOLOGY headers with no CPU · 1497e804
      Stephane Eranian authored
      This patch fixes an issue in cpumap.c when used with the TOPOLOGY
      header. In some configurations, some NUMA nodes may have no CPU (empty
      cpulist). Yet a cpumap map must be created otherwise perf abort with an
      error. This patch handles this case by creating a dummy map.
      
        Before:
      
        $ perf record -o - -e cycles noploop 2 | perf script -i -
        0x6e8 [0x6c]: failed to process type: 80
      
        After:
      
        $ perf record -o - -e cycles noploop 2 | perf script -i -
        noploop for 2 seconds
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1547885559-1657-1-git-send-email-eranian@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1497e804
  3. 18 Jan, 2019 7 commits
    • Arnaldo Carvalho de Melo's avatar
      perf python: Remove -fstack-clash-protection when building with some clang versions · 94ec1eb7
      Arnaldo Carvalho de Melo authored
      These options are not present in some (all?) clang versions, so when we
      build for a distro that has a gcc new enough to have these options and
      that the distro python build config settings use them but clang doesn't
      support, b00m.
      
      This is the case with fedora rawhide (now gearing towards f30), so check
      if clang has the  and remove the missing ones from CFLAGS.
      
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Thiago Macieira <thiago.macieira@intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-5q50q9w458yawgxf9ez54jbp@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      94ec1eb7
    • Stephane Eranian's avatar
      perf core: Fix perf_proc_update_handler() bug · 1a51c5da
      Stephane Eranian authored
      The perf_proc_update_handler() handles /proc/sys/kernel/perf_event_max_sample_rate
      syctl variable.  When the PMU IRQ handler timing monitoring is disabled, i.e,
      when /proc/sys/kernel/perf_cpu_time_max_percent is equal to 0 or 100,
      then no modification to sysctl_perf_event_sample_rate is allowed to prevent
      possible hang from wrong values.
      
      The problem is that the test to prevent modification is made after the
      sysctl variable is modified in perf_proc_update_handler().
      
      You get an error:
      
        $ echo 10001 >/proc/sys/kernel/perf_event_max_sample_rate
        echo: write error: invalid argument
      
      But the value is still modified causing all sorts of inconsistencies:
      
        $ cat /proc/sys/kernel/perf_event_max_sample_rate
        10001
      
      This patch fixes the problem by moving the parsing of the value after
      the test.
      
      Committer testing:
      
        # echo 100 > /proc/sys/kernel/perf_cpu_time_max_percent
        # echo 10001 > /proc/sys/kernel/perf_event_max_sample_rate
        -bash: echo: write error: Invalid argument
        # cat /proc/sys/kernel/perf_event_max_sample_rate
        10001
        #
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1547169436-6266-1-git-send-email-eranian@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1a51c5da
    • Andi Kleen's avatar
      perf script: Fix crash with printing mixed trace point and other events · 96167167
      Andi Kleen authored
      'perf script' crashes currently when printing mixed trace points and
      other events because the trace format does not handle events without
      trace meta data. Add a simple check to avoid that.
      
        % cat > test.c
        main()
        {
            printf("Hello world\n");
        }
        ^D
        % gcc -g -o test test.c
        % sudo perf probe -x test 'test.c:3'
        % perf record -e '{cpu/cpu-cycles,period=10000/,probe_test:main}:S' ./test
        % perf script
        <segfault>
      
      Committer testing:
      
      Before:
      
        # perf probe -x /lib64/libc-2.28.so malloc
        Added new event:
          probe_libc:malloc    (on malloc in /usr/lib64/libc-2.28.so)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe_libc:malloc -aR sleep 1
      
        # perf probe -l
        probe_libc:malloc    (on __libc_malloc@malloc/malloc.c in /usr/lib64/libc-2.28.so)
        # perf record -e '{cpu/cpu-cycles,period=10000/,probe_libc:*}:S' sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.023 MB perf.data (40 samples) ]
        # perf script
        Segmentation fault (core dumped)
        ^C
        #
      
      After:
      
        # perf script | head -6
           sleep 2888 94796.944981: 16198 cpu/cpu-cycles,period=10000/: ffffffff925dc04f get_random_u32+0x1f (/lib/modules/5.0.0-rc2+/build/vmlinux)
           sleep 2888 [-01] 94796.944981: probe_libc:malloc:
           sleep 2888 94796.944983:  4713 cpu/cpu-cycles,period=10000/: ffffffff922763af change_protection+0xcf (/lib/modules/5.0.0-rc2+/build/vmlinux)
           sleep 2888 [-01] 94796.944983: probe_libc:malloc:
           sleep 2888 94796.944986:  9934 cpu/cpu-cycles,period=10000/: ffffffff922777e0 move_page_tables+0x0 (/lib/modules/5.0.0-rc2+/build/vmlinux)
           sleep 2888 [-01] 94796.944986: probe_libc:malloc:
        #
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20190117194834.21940-1-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      96167167
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · d7393226
      Linus Torvalds authored
      Pull rdma fixes frfom Jason Gunthorpe:
       "Not much so far. We have the usual batch of bugs and two fixes to code
        merged this cycle:
      
         - Restore valgrind support for the ioctl verbs interface merged this
           window, and fix a missed error code on an error path from that
           conversion
      
         - A user reported crash on obsolete mthca hardware
      
         - pvrdma was using the wrong command opcode toward the hypervisor
      
         - NULL pointer crash regression when dumping rdma-cm over netlink
      
         - Be conservative about exposing the global rkey"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/uverbs: Mark ioctl responses with UVERBS_ATTR_F_VALID_OUTPUT
        RDMA/mthca: Clear QP objects during their allocation
        RDMA/vmw_pvrdma: Return the correct opcode when creating WR
        RDMA/cma: Add cm_id restrack resource based on kernel or user cm_id type
        RDMA/nldev: Don't expose unsafe global rkey to regular user
        RDMA/uverbs: Fix post send success return value in case of error
      d7393226
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2019-01-18' of git://anongit.freedesktop.org/drm/drm · 1092a94f
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "The rc3 fixes are a bit scattered:
      
         - meson, sun4i and rockchip all had missing of_node_put.
      
         - qxl and virtio both were advertising dma-buf to userspace when they
           really shouldn't have.
      
        Otherwise:
      
        meson:
         - modesetting regression fix
      
        i915 GVT:
         - one cmd parser failure fix
         - region cleanup fix in vGPU destroy
      
        amdgpu:
         - KFD fixes for arm64 mixed APU/DGPU
         - vega12 powerplay fix
         - raven DC fixes
         - freesync fix"
      
      * tag 'drm-fixes-2019-01-18' of git://anongit.freedesktop.org/drm/drm:
        drm/amd/display: Detach backlight from stream
        drm/sun4i: backend: add missing of_node_puts
        Revert "drm/amdgpu: validate user pitch alignment"
        Revert "drm/amdgpu: validate user GEM object size"
        drm/meson: Fix atomic mode switching regression
        drm/i915/gvt: Fix mmap range check
        drm/i915/gvt: free VFIO region space in vgpu detach
        drm/amd/display: Fix disabled cursor on top screen edge
        drm/amd/display: fix warning on raven hotplug
        drm/amd/display: fix PME notification not working in RV desktop
        drm/amd/display: Only get the connector state for VRR when toggled
        drm/amd/display: Pack DMCU iRAM alignment
        drm/amd/powerplay: run acg btc for Vega12
        drm/amdkfd: Don't assign dGPUs to APU topology devices
        drm/amdkfd: Allow building KFD on ARM64 (v2)
        drm/meson: add missing of_node_put
        drm/virtio: drop prime import/export callbacks
        drm/qxl: drop prime import/export callbacks
        drm/i915/gvt: Allow F_CMD_ACCESS on mmio 0x21f0
        drm/rockchip: add missing of_node_put
      1092a94f
    • Linus Torvalds's avatar
      Merge tag 'led-fix-for-5.0-rc3' of... · 2451f371
      Linus Torvalds authored
      Merge tag 'led-fix-for-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
      
      Pull LED fix from Jacek Anaszewski.
      
      * tag 'led-fix-for-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
        leds: lp5523: fix a missing check of return value of lp55xx_read
      2451f371
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v5.0-rc3' of... · 0a2fbed8
      Linus Torvalds authored
      Merge tag 'hwmon-for-v5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
       "Minor fixes/regressions"
      
      * tag 'hwmon-for-v5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (tmp421) Correct the misspelling of the tmp442 compatible attribute in OF device ID table
        hwmon: (occ) Fix potential integer overflow
        hwmon: (lm80) Fix missing unlock on error in set_fan_div()
        hwmon: (nct6775) Enable IO mapping for NCT6797D and NCT6798D
        hwmon: (nct6775) Fix chip ID for NCT6798D
      0a2fbed8
  4. 17 Jan, 2019 19 commits
  5. 16 Jan, 2019 10 commits