1. 18 Sep, 2020 1 commit
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-09-18' of git://anongit.freedesktop.org/drm/drm · 4c0449c9
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "A bunch of small fixes, some of the i915 ones have been out for a
        while and got better commit msg explaining some better reasoning
        behind them (hopefully this trend continues).
      
        Otherwise there a few AMD related ones mostly small, one radeon PLL
        regression fix and a bunch of small mediatek fixes.
      
        amdgpu:
         - Sienna Cichlid fixes
         - Navy Flounder fixes
         - DC fixes
      
        amdkfd:
         - Fix a GPU reset crash
         - Fix a memory leak
      
        radeon:
         - Revert a PLL fix that broke other boards
      
        i915:
         - Avoid exposing a partially constructed context
         - Use RCU instead of mutex for context termination list iteration
         - Avoid data race reported by KCSAN
         - Filter wake_flags passed to default_wake_function
      
        mediatek:
         - Fix scrolling of panel
         - Remove duplicated include
         - Use CPU when fail to get cmdq event
         - Add missing put_device() call"
      
      * tag 'drm-fixes-2020-09-18' of git://anongit.freedesktop.org/drm/drm: (21 commits)
        drm/amd/display: Don't log hdcp module warnings in dmesg
        drm/amdgpu: declare ta firmware for navy_flounder
        drm/mediatek: Add missing put_device() call in mtk_hdmi_dt_parse_pdata()
        drm/mediatek: Add missing put_device() call in mtk_drm_kms_init()
        drm/mediatek: Add exception handing in mtk_drm_probe() if component init fail
        drm/mediatek: Add missing put_device() call in mtk_ddp_comp_init()
        drm/mediatek: Use CPU when fail to get cmdq event
        drm/mediatek: Remove duplicated include
        drm/i915: Filter wake_flags passed to default_wake_function
        drm/i915: Be wary of data races when reading the active execlists
        drm/i915/gem: Reduce context termination list iteration guard to RCU
        drm/i915/gem: Delay tracking the GEM context until it is registered
        drm/amdgpu/dc: Require primary plane to be enabled whenever the CRTC is
        drm/radeon: revert "Prefer lower feedback dividers"
        drm/amdgpu: Include sienna_cichlid in USBC PD FW support.
        drm/amd/display: update nv1x stutter latencies
        drm/amd/display: Don't use DRM_ERROR() for DTM add topology
        drm/amd/pm: support runtime pptable update for sienna_cichlid etc.
        drm/amdkfd: fix a memory leak issue
        drm/kfd: fix a system crash issue during GPU recovery
        ...
      4c0449c9
  2. 17 Sep, 2020 7 commits
  3. 16 Sep, 2020 15 commits
  4. 15 Sep, 2020 17 commits
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 9803ab17
      Linus Torvalds authored
      Pull SCSI fix from James Bottomley:
       "Just one fix in libsas for a resource leak in an error path"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: libsas: Fix error path in sas_notify_lldd_dev_found()
      9803ab17
    • Linus Torvalds's avatar
      Merge tag 'fixes-v5.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 1e484d38
      Linus Torvalds authored
      Pull security layer fix from James  Morris:
       "A device_cgroup RCU warning fix from Amol Grover"
      
      * tag 'fixes-v5.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        device_cgroup: Fix RCU list debugging warning
      1e484d38
    • Linus Torvalds's avatar
      Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux · 00acc505
      Linus Torvalds authored
      Pull hyperv fixes from Wei Liu:
       "Two patches from Michael and Dexuan to fix vmbus hanging issues"
      
      * tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
        Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload
        Drivers: hv: vmbus: hibernation: do not hang forever in vmbus_bus_resume()
      00acc505
    • Michel Dänzer's avatar
      drm/amdgpu/dc: Require primary plane to be enabled whenever the CRTC is · 2f228aab
      Michel Dänzer authored
      Don't check drm_crtc_state::active for this either, per its
      documentation in include/drm/drm_crtc.h:
      
       * Hence drivers must not consult @active in their various
       * &drm_mode_config_funcs.atomic_check callback to reject an atomic
       * commit.
      
      atomic_remove_fb disables the CRTC as needed for disabling the primary
      plane.
      
      This prevents at least the following problems if the primary plane gets
      disabled (e.g. due to destroying the FB assigned to the primary plane,
      as happens e.g. with mutter in Wayland mode):
      
      * The legacy cursor ioctl returned EINVAL for a non-0 cursor FB ID
        (which enables the cursor plane).
      * If the cursor plane was enabled, changing the legacy DPMS property
        value from off to on returned EINVAL.
      
      v2:
      * Minor changes to code comment and commit log, per review feedback.
      
      GitLab: https://gitlab.gnome.org/GNOME/mutter/-/issues/1108
      GitLab: https://gitlab.gnome.org/GNOME/mutter/-/issues/1165
      GitLab: https://gitlab.gnome.org/GNOME/mutter/-/issues/1344Suggested-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Signed-off-by: default avatarMichel Dänzer <mdaenzer@redhat.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      2f228aab
    • Christian König's avatar
      drm/radeon: revert "Prefer lower feedback dividers" · 40eab0f8
      Christian König authored
      Turns out this breaks a lot of different hardware.
      
      This reverts commit fc8c7052.
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      Acked-by: default avatarNirmoy Das <nirmoy.das@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      40eab0f8
    • Andrey Grodzovsky's avatar
      drm/amdgpu: Include sienna_cichlid in USBC PD FW support. · 5367eb6d
      Andrey Grodzovsky authored
      Create sysfs interface also for sienna_cichlid.
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5367eb6d
    • Jun Lei's avatar
      drm/amd/display: update nv1x stutter latencies · c4790a88
      Jun Lei authored
      [why]
      Recent characterization shows increased stutter latencies on some SKUs,
      leading to underflow.
      
      [how]
      Update SOC params to account for this worst case latency.
      Signed-off-by: default avatarJun Lei <jun.lei@amd.com>
      Acked-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      c4790a88
    • Bhawanpreet Lakha's avatar
      drm/amd/display: Don't use DRM_ERROR() for DTM add topology · 4cdd7b33
      Bhawanpreet Lakha authored
      [Why]
      Previously we were only calling add_topology when hdcp was being enabled.
      Now we call add_topology by default so the ERROR messages are printed if
      the firmware is not loaded.
      
      This error message is not relevant for normal display functionality so
      no need to print a ERROR message.
      
      [How]
      Change DRM_ERROR to DRM_INFO
      Signed-off-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
      Acked-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      4cdd7b33
    • Jiansong Chen's avatar
      drm/amd/pm: support runtime pptable update for sienna_cichlid etc. · cc8e66e7
      Jiansong Chen authored
      This avoids smu issue when enabling runtime pptable update for
      sienna_cichlid and so on. Runtime pptable udpate is needed for test
      and debug purpose.
      Signed-off-by: default avatarJiansong Chen <Jiansong.Chen@amd.com>
      Reviewed-by: default avatarKenneth Feng <kenneth.feng@amd.com>
      Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      cc8e66e7
    • Dennis Li's avatar
      drm/amdkfd: fix a memory leak issue · 087d7641
      Dennis Li authored
      In the resume stage of GPU recovery, start_cpsch will call pm_init
      which set pm->allocated as false, cause the next pm_release_ib has
      no chance to release ib memory.
      
      Add pm_release_ib in stop_cpsch which will be called in the suspend
      stage of GPU recovery.
      Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
      Signed-off-by: default avatarDennis Li <Dennis.Li@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      087d7641
    • Dennis Li's avatar
      drm/kfd: fix a system crash issue during GPU recovery · 66a5710b
      Dennis Li authored
      The crash log as the below:
      
      [Thu Aug 20 23:18:14 2020] general protection fault: 0000 [#1] SMP NOPTI
      [Thu Aug 20 23:18:14 2020] CPU: 152 PID: 1837 Comm: kworker/152:1 Tainted: G           OE     5.4.0-42-generic #46~18.04.1-Ubuntu
      [Thu Aug 20 23:18:14 2020] Hardware name: GIGABYTE G482-Z53-YF/MZ52-G40-00, BIOS R12 05/13/2020
      [Thu Aug 20 23:18:14 2020] Workqueue: events amdgpu_ras_do_recovery [amdgpu]
      [Thu Aug 20 23:18:14 2020] RIP: 0010:evict_process_queues_cpsch+0xc9/0x130 [amdgpu]
      [Thu Aug 20 23:18:14 2020] Code: 49 8d 4d 10 48 39 c8 75 21 eb 44 83 fa 03 74 36 80 78 72 00 74 0c 83 ab 68 01 00 00 01 41 c6 45 41 00 48 8b 00 48 39 c8 74 25 <80> 78 70 00 c6 40 6d 01 74 ee 8b 50 28 c6 40 70 00 83 ab 60 01 00
      [Thu Aug 20 23:18:14 2020] RSP: 0018:ffffb29b52f6fc90 EFLAGS: 00010213
      [Thu Aug 20 23:18:14 2020] RAX: 1c884edb0a118914 RBX: ffff8a0d45ff3c00 RCX: ffff8a2d83e41038
      [Thu Aug 20 23:18:14 2020] RDX: 0000000000000000 RSI: 0000000000000082 RDI: ffff8a0e2e4178c0
      [Thu Aug 20 23:18:14 2020] RBP: ffffb29b52f6fcb0 R08: 0000000000001b64 R09: 0000000000000004
      [Thu Aug 20 23:18:14 2020] R10: ffffb29b52f6fb78 R11: 0000000000000001 R12: ffff8a0d45ff3d28
      [Thu Aug 20 23:18:14 2020] R13: ffff8a2d83e41028 R14: 0000000000000000 R15: 0000000000000000
      [Thu Aug 20 23:18:14 2020] FS:  0000000000000000(0000) GS:ffff8a0e2e400000(0000) knlGS:0000000000000000
      [Thu Aug 20 23:18:14 2020] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [Thu Aug 20 23:18:14 2020] CR2: 000055c783c0e6a8 CR3: 00000034a1284000 CR4: 0000000000340ee0
      [Thu Aug 20 23:18:14 2020] Call Trace:
      [Thu Aug 20 23:18:14 2020]  kfd_process_evict_queues+0x43/0xd0 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  kfd_suspend_all_processes+0x60/0xf0 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  kgd2kfd_suspend.part.7+0x43/0x50 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  kgd2kfd_pre_reset+0x46/0x60 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  amdgpu_amdkfd_pre_reset+0x1a/0x20 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  amdgpu_device_gpu_recover+0x377/0xf90 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  ? amdgpu_ras_error_query+0x1b8/0x2a0 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  amdgpu_ras_do_recovery+0x159/0x190 [amdgpu]
      [Thu Aug 20 23:18:14 2020]  process_one_work+0x20f/0x400
      [Thu Aug 20 23:18:14 2020]  worker_thread+0x34/0x410
      
      When GPU hang, user process will fail to create a compute queue whose
      struct object will be freed later, but driver wrongly add this queue to
      queue list of the proccess. And then kfd_process_evict_queues will
      access a freed memory, which cause a system crash.
      
      v2:
      The failure to execute_queues should probably not be reported to
      the caller of create_queue, because the queue was already created.
      Therefore change to ignore the return value from execute_queues.
      Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
      Signed-off-by: default avatarDennis Li <Dennis.Li@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      66a5710b
    • Namhyung Kim's avatar
      perf test: Free formats for perf pmu parse test · d26383dc
      Namhyung Kim authored
      The following leaks were detected by ASAN:
      
        Indirect leak of 360 byte(s) in 9 object(s) allocated from:
          #0 0x7fecc305180e in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10780e)
          #1 0x560578f6dce5 in perf_pmu__new_format util/pmu.c:1333
          #2 0x560578f752fc in perf_pmu_parse util/pmu.y:59
          #3 0x560578f6a8b7 in perf_pmu__format_parse util/pmu.c:73
          #4 0x560578e07045 in test__pmu tests/pmu.c:155
          #5 0x560578de109b in run_test tests/builtin-test.c:410
          #6 0x560578de109b in test_and_print tests/builtin-test.c:440
          #7 0x560578de401a in __cmd_test tests/builtin-test.c:661
          #8 0x560578de401a in cmd_test tests/builtin-test.c:807
          #9 0x560578e49354 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #10 0x560578ce71a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #11 0x560578ce71a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #12 0x560578ce71a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #13 0x7fecc2b7acc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: cff7f956 ("perf tests: Move pmu tests into separate object")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-12-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d26383dc
    • Namhyung Kim's avatar
      perf metric: Do not free metric when failed to resolve · 6f47ed6c
      Namhyung Kim authored
      It's dangerous to free the original metric when it's called from
      resolve_metric() as it's already in the metric_list and might have other
      resources too.  Instead, it'd better let them bail out and be released
      properly at the later stage.
      
      So add a check when it's called from metricgroup__add_metric() and
      release it.  Also make sure that mp is set properly.
      
      Fixes: 83de0b7d ("perf metric: Collect referenced metrics in struct metric_ref_node")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-10-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6f47ed6c
    • Namhyung Kim's avatar
      perf metric: Free metric when it failed to resolve · 27adafcd
      Namhyung Kim authored
      The metricgroup__add_metric() can find multiple match for a metric group
      and it's possible to fail.  Also it can fail in the middle like in
      resolve_metric() even for single metric.
      
      In those cases, the intermediate list and ids will be leaked like:
      
        Direct leak of 3 byte(s) in 1 object(s) allocated from:
          #0 0x7f4c938f40b5 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x920b5)
          #1 0x55f7e71c1bef in __add_metric util/metricgroup.c:683
          #2 0x55f7e71c31d0 in add_metric util/metricgroup.c:906
          #3 0x55f7e71c3844 in metricgroup__add_metric util/metricgroup.c:940
          #4 0x55f7e71c488d in metricgroup__add_metric_list util/metricgroup.c:993
          #5 0x55f7e71c488d in parse_groups util/metricgroup.c:1045
          #6 0x55f7e71c60a4 in metricgroup__parse_groups_test util/metricgroup.c:1087
          #7 0x55f7e71235ae in __compute_metric tests/parse-metric.c:164
          #8 0x55f7e7124650 in compute_metric tests/parse-metric.c:196
          #9 0x55f7e7124650 in test_recursion_fail tests/parse-metric.c:318
          #10 0x55f7e7124650 in test__parse_metric tests/parse-metric.c:356
          #11 0x55f7e70be09b in run_test tests/builtin-test.c:410
          #12 0x55f7e70be09b in test_and_print tests/builtin-test.c:440
          #13 0x55f7e70c101a in __cmd_test tests/builtin-test.c:661
          #14 0x55f7e70c101a in cmd_test tests/builtin-test.c:807
          #15 0x55f7e7126214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #16 0x55f7e6fc41a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #17 0x55f7e6fc41a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #18 0x55f7e6fc41a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #19 0x7f4c93492cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: 83de0b7d ("perf metric: Collect referenced metrics in struct metric_ref_node")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-9-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      27adafcd
    • Namhyung Kim's avatar
      perf metric: Release expr_parse_ctx after testing · 437822bf
      Namhyung Kim authored
      The test_generic_metric() missed to release entries in the pctx.  Asan
      reported following leak (and more):
      
        Direct leak of 128 byte(s) in 1 object(s) allocated from:
          #0 0x7f4c9396980e in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10780e)
          #1 0x55f7e748cc14 in hashmap_grow (/home/namhyung/project/linux/tools/perf/perf+0x90cc14)
          #2 0x55f7e748d497 in hashmap__insert (/home/namhyung/project/linux/tools/perf/perf+0x90d497)
          #3 0x55f7e7341667 in hashmap__set /home/namhyung/project/linux/tools/perf/util/hashmap.h:111
          #4 0x55f7e7341667 in expr__add_ref util/expr.c:120
          #5 0x55f7e7292436 in prepare_metric util/stat-shadow.c:783
          #6 0x55f7e729556d in test_generic_metric util/stat-shadow.c:858
          #7 0x55f7e712390b in compute_single tests/parse-metric.c:128
          #8 0x55f7e712390b in __compute_metric tests/parse-metric.c:180
          #9 0x55f7e712446d in compute_metric tests/parse-metric.c:196
          #10 0x55f7e712446d in test_dcache_l2 tests/parse-metric.c:295
          #11 0x55f7e712446d in test__parse_metric tests/parse-metric.c:355
          #12 0x55f7e70be09b in run_test tests/builtin-test.c:410
          #13 0x55f7e70be09b in test_and_print tests/builtin-test.c:440
          #14 0x55f7e70c101a in __cmd_test tests/builtin-test.c:661
          #15 0x55f7e70c101a in cmd_test tests/builtin-test.c:807
          #16 0x55f7e7126214 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #17 0x55f7e6fc41a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #18 0x55f7e6fc41a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #19 0x55f7e6fc41a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #20 0x7f4c93492cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: 6d432c4c ("perf tools: Add test_generic_metric function")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      437822bf
    • Namhyung Kim's avatar
      perf test: Fix memory leaks in parse-metric test · f5a56570
      Namhyung Kim authored
      It didn't release resources when there's an error so the
      test_recursion_fail() will leak some memory.
      
      Fixes: 0a507af9 ("perf tests: Add parse metric test for ipc metric")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-7-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f5a56570
    • Namhyung Kim's avatar
      perf parse-event: Fix memory leak in evsel->unit · b12eea5a
      Namhyung Kim authored
      The evsel->unit borrows a pointer of pmu event or alias instead of
      owns a string.  But tool event (duration_time) passes a result of
      strdup() caused a leak.
      
      It was found by ASAN during metric test:
      
        Direct leak of 210 byte(s) in 70 object(s) allocated from:
          #0 0x7fe366fca0b5 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x920b5)
          #1 0x559fbbcc6ea3 in add_event_tool util/parse-events.c:414
          #2 0x559fbbcc6ea3 in parse_events_add_tool util/parse-events.c:1414
          #3 0x559fbbd8474d in parse_events_parse util/parse-events.y:439
          #4 0x559fbbcc95da in parse_events__scanner util/parse-events.c:2096
          #5 0x559fbbcc95da in __parse_events util/parse-events.c:2141
          #6 0x559fbbc28555 in check_parse_id tests/pmu-events.c:406
          #7 0x559fbbc28555 in check_parse_id tests/pmu-events.c:393
          #8 0x559fbbc28555 in check_parse_cpu tests/pmu-events.c:415
          #9 0x559fbbc28555 in test_parsing tests/pmu-events.c:498
          #10 0x559fbbc0109b in run_test tests/builtin-test.c:410
          #11 0x559fbbc0109b in test_and_print tests/builtin-test.c:440
          #12 0x559fbbc03e69 in __cmd_test tests/builtin-test.c:695
          #13 0x559fbbc03e69 in cmd_test tests/builtin-test.c:807
          #14 0x559fbbc691f4 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:312
          #15 0x559fbbb071a8 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:364
          #16 0x559fbbb071a8 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:408
          #17 0x559fbbb071a8 in main /home/namhyung/project/linux/tools/perf/perf.c:538
          #18 0x7fe366b68cc9 in __libc_start_main ../csu/libc-start.c:308
      
      Fixes: f0fbb114 ("perf stat: Implement duration_time as a proper event")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200915031819.386559-6-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b12eea5a