linux/drivers/gpu/drm/i915
Umesh Nerlige Ramappa 6a77c6bb72 i915/perf: Start hrtimer only if sampling the OA buffer
SAMPLE_OA parameter enables sampling of OA buffer and results in a call
to init the OA buffer which initializes the OA unit head/tail pointers.
The OA_EXPONENT parameter controls the periodicity of the OA reports in
the OA buffer and results in starting a hrtimer.

Before gen12, all use cases required the use of the OA buffer and i915
enforced this setting when vetting out the parameters passed. In these
platforms the hrtimer was enabled if OA_EXPONENT was passed. This worked
fine since it was implied that SAMPLE_OA is always passed.

With gen12, this changed. Users can use perf without enabling the OA
buffer as in OAR use cases. While an OAR use case should ideally not
start the hrtimer, we see that passing an OA_EXPONENT parameter will
start the hrtimer even though SAMPLE_OA is not specified. This results
in an uninitialized OA buffer, so the head/tail pointers used to track
the buffer are zero.

This itself does not fail, but if we ran a use-case that SAMPLED the OA
buffer previously, then the OA_TAIL register is still pointing to an old
value. When the timer callback runs, it ends up calculating a
wrong/large number of available reports. Since we do a spinlock_irq_save
and start processing a large number of reports, NMI watchdog fires and
causes a crash.

Start the timer only if SAMPLE_OA is specified.

v2:
- Drop SAMPLE OA check when appending samples (Ashutosh)
- Prevent read if OA buffer is not being sampled

Fixes: 00a7f0d715 ("drm/i915/tgl: Add perf support on TGL")
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210305210947.58751-1-umesh.nerlige.ramappa@intel.com
(cherry picked from commit be0bdd67fd)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2021-03-17 12:51:37 +02:00
..
display drm fixes for 5.12-rc1 + msm-next 2021-02-25 12:10:22 -08:00
gem drm/i915/gem: Move freeze/freeze_late next to suspend/suspend_late 2021-02-08 16:56:49 -05:00
gt drm/i915: Wedge the GPU if command parser setup fails 2021-03-12 11:20:50 +10:00
gvt drm fixes for 5.12-rc1 + msm-next 2021-02-25 12:10:22 -08:00
selftests drm pull for 5.12-rc1 2021-02-21 14:44:44 -08:00
.gitignore
dma_resv_utils.c drm/i915/gem: Optimistically prune dma-resv from the shrinker. 2020-12-23 21:58:00 +00:00
dma_resv_utils.h drm/i915/gem: Optimistically prune dma-resv from the shrinker. 2020-12-23 21:58:00 +00:00
i915_active_types.h
i915_active.c drm pull for 5.12-rc1 2021-02-21 14:44:44 -08:00
i915_active.h drm/i915: Provide a fastpath for waiting on vma bindings 2020-09-07 13:29:19 +03:00
i915_buddy.c
i915_buddy.h
i915_cmd_parser.c drm/i915: Wedge the GPU if command parser setup fails 2021-03-12 11:20:50 +10:00
i915_config.c
i915_debugfs_params.c
i915_debugfs_params.h
i915_debugfs.c drm/i915/gem: Move stolen node into GEM object union 2021-01-20 20:46:36 +00:00
i915_debugfs.h
i915_drv.c drm/i915/gem: Move freeze/freeze_late next to suspend/suspend_late 2021-02-08 16:56:49 -05:00
i915_drv.h drm/i915: Wedge the GPU if command parser setup fails 2021-03-12 11:20:50 +10:00
i915_fixed.h
i915_gem_evict.c drm/i915/gem: Protect used framebuffers from casual eviction 2021-01-20 21:05:12 +00:00
i915_gem_gtt.c drm/i915: Remove livelock from "do_idle_maps" vtd w/a 2020-12-09 19:32:51 +00:00
i915_gem_gtt.h
i915_gem.c drm/i915/gem: Move freeze/freeze_late next to suspend/suspend_late 2021-02-08 16:56:49 -05:00
i915_gem.h drm/i915: Make GEM errors non-fatal by default 2021-01-19 11:54:44 +00:00
i915_getparam.c drm/i915/gt: Consolidate the CS timestamp clocks 2020-12-23 21:10:41 +00:00
i915_globals.c
i915_globals.h
i915_gpu_error.c drm/i915/error: Fix object page offset within a region 2021-01-19 20:36:27 +00:00
i915_gpu_error.h drm/i915: Improve record of hung engines in error state 2020-11-09 11:59:43 +00:00
i915_ioc32.c
i915_ioc32.h
i915_irq.c drm/i915: Implement async flips for vlv/chv 2021-01-29 19:05:02 +02:00
i915_irq.h drm/i915: Add plane vfuncs to enable/disable flip_done interrupt 2021-01-19 19:14:21 +02:00
i915_memcpy.c
i915_memcpy.h
i915_mitigations.c drm/i915: Allow the sysadmin to override security mitigations 2021-01-12 19:03:40 +02:00
i915_mitigations.h drm/i915: Allow the sysadmin to override security mitigations 2021-01-12 19:03:40 +02:00
i915_mm.c drm/i915: Fix the sgt.pfn sanity check 2021-01-19 20:36:26 +00:00
i915_params.c drm/i915/dp: Allow forcing specific interfaces through enable_dpcd_backlight 2021-01-19 12:35:52 -05:00
i915_params.h drm/i915/uc: Add function to define defaults for GuC/HuC enable 2021-01-20 10:30:13 +00:00
i915_pci.c drm/i915: Mark per-engine-reset as supported on gen7 2021-01-19 11:55:14 +00:00
i915_perf_types.h
i915_perf.c i915/perf: Start hrtimer only if sampling the OA buffer 2021-03-17 12:51:37 +02:00
i915_perf.h
i915_pmu.c drm/i915/pmu: Don't grab wakeref when enabling events 2021-01-18 12:25:05 +02:00
i915_pmu.h Merge tag 'drm-intel-gt-next-2021-01-14' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-01-15 15:03:36 +10:00
i915_priolist_types.h
i915_pvinfo.h
i915_query.c drm/i915/sseu: Move sseu_info under gt_info 2020-07-08 21:13:09 +01:00
i915_query.h
i915_reg.h drm/i915: Workaround async flip + VT-d corruption on HSW/BDW 2021-03-17 12:51:29 +02:00
i915_request.c drm/i915: Reduce test_and_set_bit to set_bit in i915_request_submit() 2021-01-15 08:00:03 +00:00
i915_request.h drm/i915: Check for rq->hwsp validity after acquiring RCU lock 2021-01-18 12:54:25 +02:00
i915_scatterlist.c
i915_scatterlist.h Merge tag 'drm-intel-gt-next-2020-11-12-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2020-11-13 15:01:57 +10:00
i915_scheduler_types.h drm/i915: Lift waiter/signaler iterators 2020-11-19 20:34:18 +00:00
i915_scheduler.c drm/i915: Mark up protected uses of 'i915_request_completed' 2021-01-15 08:00:03 +00:00
i915_scheduler.h drm/i915: Show timeline dependencies for debug 2020-11-19 20:34:18 +00:00
i915_selftest.h
i915_suspend.c drm/i915/suspend: replace I915_READ()/WRITE() with intel_de_read()/write() 2020-12-01 17:56:36 +02:00
i915_suspend.h drm/i915: Rename i915_{save,restore}_state() 2020-10-09 21:12:13 +03:00
i915_sw_fence_work.c
i915_sw_fence_work.h
i915_sw_fence.c drm/i915: Encode fence specific waitqueue behaviour into the wait.flags 2020-12-16 20:59:56 +00:00
i915_sw_fence.h
i915_switcheroo.c
i915_switcheroo.h
i915_syncmap.c
i915_syncmap.h
i915_sysfs.c
i915_sysfs.h
i915_trace_points.c
i915_trace.h
i915_user_extensions.c
i915_user_extensions.h
i915_utils.c drm/i915: Wrap our timer_list.expires checking 2021-01-07 21:37:14 +00:00
i915_utils.h drm/i915: Wrap our timer_list.expires checking 2021-01-07 21:37:14 +00:00
i915_vgpu.c
i915_vgpu.h
i915_vma_types.h drm/i915/gem: Protect used framebuffers from casual eviction 2021-01-20 21:05:12 +00:00
i915_vma.c drm/i915: Hold onto an explicit ref to i915_vma_work.pinned 2020-11-03 19:22:42 -05:00
i915_vma.h drm/i915/gem: Protect used framebuffers from casual eviction 2021-01-20 21:05:12 +00:00
intel_device_info.c Merge tag 'drm-intel-gt-next-2021-01-14' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-01-15 15:03:36 +10:00
intel_device_info.h drm/i915/gt: Only disable preemption on gen8 render engines 2021-01-08 21:35:56 +00:00
intel_dram.c drm/i915: Rename is_16gb_dimm to wm_lv_0_adjust_needed 2021-01-29 05:50:50 -08:00
intel_dram.h
intel_gvt.c drm/i915/gvt: Save/restore HW status to support GVT suspend/resume 2020-11-10 14:37:56 +08:00
intel_gvt.h drm/i915/gvt: Save/restore HW status to support GVT suspend/resume 2020-11-10 14:37:56 +08:00
intel_memory_region.c drm/i915/region: make intel_region_map static 2021-01-12 21:11:42 +00:00
intel_memory_region.h drm/i915/region: convert object_create into object_init 2021-01-15 08:00:03 +00:00
intel_pch.c drm/i915: Try to guess PCH type even without ISA bridge 2021-01-15 12:44:46 +02:00
intel_pch.h drm/i915/dg1: Add fake PCH 2020-07-14 02:47:21 -07:00
intel_pm.c drm/i915: Workaround async flip + VT-d corruption on HSW/BDW 2021-03-17 12:51:29 +02:00
intel_pm.h drm/i915: Encapsulate dbuf state handling harder 2021-01-26 15:41:49 +02:00
intel_runtime_pm.c
intel_runtime_pm.h
intel_sideband.c drm/i915: remove last traces of I915_READ(), I915_WRITE() and POSTING_READ() 2020-12-02 17:29:46 +02:00
intel_sideband.h drm/i915/dg1: Wait for pcode/uncore handshake at startup 2020-10-05 15:54:45 -07:00
intel_uncore.c drm/i915: remove last traces of I915_READ(), I915_WRITE() and POSTING_READ() 2020-12-02 17:29:46 +02:00
intel_uncore.h drm/i915: remove last traces of I915_READ(), I915_WRITE() and POSTING_READ() 2020-12-02 17:29:46 +02:00
intel_wakeref.c
intel_wakeref.h
intel_wopcm.c
intel_wopcm.h
Kconfig drm/i915: use vmap in i915_gem_object_map 2020-10-18 09:27:10 -07:00
Kconfig.debug drm/i915: Restrict DRM_I915_DEBUG to developer builds 2021-02-08 16:56:36 -05:00
Kconfig.profile
Kconfig.unstable
Makefile drm fixes for 5.12-rc1 + msm-next 2021-02-25 12:10:22 -08:00
vlv_suspend.c
vlv_suspend.h