linux/drivers/gpu/drm/i915
Matthew Brost 6a07990384 drm/i915/guc: Add delay to disable scheduling after pin count goes to zero
Add a delay, configurable via debugfs (default 34ms), to disable
scheduling of a context after the pin count goes to zero. Disable
scheduling is a costly operation as it requires synchronizing with
the GuC. So the idea is that a delay allows the user to resubmit
something before doing this operation. This delay is only done if
the context isn't closed and less than a given threshold
(default is 3/4) of the guc_ids are in use.

As temporary WA disable this feature for the selftests. Selftests are
very timing sensitive and any change in timing can cause failure. A
follow up patch will fixup the selftests to understand this delay.

Alan Previn: Matt Brost first introduced this series back in Oct 2021.
However no real world workload with measured performance impact was
available to prove the intended results. Today, this series is being
republished in response to a real world workload that benefited greatly
from it along with measured performance improvement.

Workload description: 36 containers were created on a DG2 device where
each container was performing a combination of 720p 3d game rendering
and 30fps video encoding. The workload density was configured in a way
that guaranteed each container to ALWAYS be able to render and
encode no less than 30fps with a predefined maximum render + encode
latency time. That means the totality of all 36 containers and their
workloads were not saturating the engines to their max (in order to
maintain just enough headrooom to meet the min fps and max latencies
of incoming container submissions).

Problem statement: It was observed that the CPU core processing the i915
soft IRQ work was experiencing severe load. Using tracelogs and an
instrumentation patch to count specific i915 IRQ events, it was confirmed
that the majority of the CPU cycles were caused by the
gen11_other_irq_handler() -> guc_irq_handler() code path. The vast
majority of the cycles was determined to be processing a specific G2H
IRQ: i.e. INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE. These IRQs are sent
by GuC in response to i915 KMD sending H2G requests:
INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_SET. Those H2G requests are sent
whenever a context goes idle so that we can unpin the context from GuC.
The high CPU utilization % symptom was limiting density scaling.

Root Cause Analysis: Because the incoming execution buffers were spread
across 36 different containers (each with multiple contexts) but the
system in totality was NOT saturated to the max, it was assumed that each
context was constantly idling between submissions. This was causing
a thrashing of unpinning contexts from GuC at one moment, followed quickly
by repinning them due to incoming workload the very next moment. These
event-pairs were being triggered across multiple contexts per container,
across all containers at the rate of > 30 times per sec per context.

Metrics: When running this workload without this patch, we measured an
average of ~69K INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE events every 10
seconds or ~10 million times over ~25+ mins. With this patch, the count
reduced to ~480 every 10 seconds or about ~28K over ~10 mins. The
improvement observed is ~99% for the average counts per 10 seconds.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220817020511.2180747-3-alan.previn.teres.alexis@intel.com
2022-08-18 15:23:47 -07:00
..
display drm/i915/display: Add smem fallback allocation for dpt 2022-06-22 11:17:13 +01:00
gem drm/i915/guc: Add delay to disable scheduling after pin count goes to zero 2022-08-18 15:23:47 -07:00
gt drm/i915/guc: Add delay to disable scheduling after pin count goes to zero 2022-08-18 15:23:47 -07:00
gvt Merge tag 'drm-intel-next-2022-05-20' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-gt-next 2022-05-23 09:34:47 +01:00
pxp drm/i915: include uapi/drm/i915_drm.h directly where needed 2022-03-17 20:06:04 +02:00
selftests drm/i915/selftests: Use correct selfest calls for live tests 2022-08-18 15:23:44 -07:00
.gitignore
i915_active_types.h drm/i915/active: remove useless i915_utils.h include 2021-12-13 12:04:44 +02:00
i915_active.c drm/i915: Bump GT idling delay to 2 jiffies 2022-07-12 17:44:40 -04:00
i915_active.h drm/i915: Remove unused bits of i915_vma/active api 2021-12-20 16:26:09 +01:00
i915_cmd_parser.c drm/i915: include linux/highmem.h and linux/swap.h where needed 2022-03-04 11:15:25 +02:00
i915_cmd_parser.h drm/i915: split out i915_cmd_parser.h from i915_drv.h 2022-01-10 15:43:09 +02:00
i915_config.c drm/i915: remove IS_ACTIVE 2021-10-07 11:04:05 -07:00
i915_debugfs_params.c drm/i915: Use to_gt() helper 2021-12-17 21:51:59 -08:00
i915_debugfs_params.h
i915_debugfs.c Merge drm/drm-next into drm-intel-gt-next 2022-04-21 13:48:26 -04:00
i915_debugfs.h
i915_deps.c drm/i915: fix broken build 2022-04-08 10:36:11 +02:00
i915_deps.h drm/i915: Break out the i915_deps utility 2021-12-22 08:52:57 +01:00
i915_driver.c drm/i915: Improve on suspend / resume time with VT-d enabled 2022-06-20 10:50:01 +02:00
i915_driver.h drm/i915: Move intel_vtd_active and run_as_guest to i915_utils 2022-03-30 12:04:01 +01:00
i915_drm_client.c drm/i915/fdinfo: Don't show engine classes not present 2022-06-17 09:04:38 +01:00
i915_drm_client.h drm/i915/client: only include what's needed 2022-06-07 21:31:17 +03:00
i915_drv.h drm/i915/gem: Remove shared locking on freeing objects 2022-08-03 10:27:24 +01:00
i915_file_private.h drm/i915: Explicitly track DRM clients 2022-04-05 08:38:49 +01:00
i915_fixed.h
i915_gem_evict.c Merge tag 'drm-intel-gt-next-2022-02-17' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-next 2022-02-23 15:03:51 -05:00
i915_gem_evict.h Merge tag 'drm-intel-gt-next-2022-02-17' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-next 2022-02-23 15:03:51 -05:00
i915_gem_gtt.c Merge tag 'drm-intel-gt-next-2022-02-17' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-next 2022-02-23 15:03:51 -05:00
i915_gem_gtt.h drm/i915: Remove short-term pins from execbuf, v6. 2022-01-18 12:19:30 +01:00
i915_gem_ww.c drm/i915: Break out dma_resv ww locking utilities to separate files 2021-06-17 14:22:59 +01:00
i915_gem_ww.h drm/i915: Ditch the i915_gem_ww_ctx loop member 2021-08-20 09:39:41 +01:00
i915_gem.c drm/i915: Explicitly track DRM clients 2022-04-05 08:38:49 +01:00
i915_gem.h drm/i915: remove single-use GEM_DEBUG_EXEC() 2022-05-09 14:16:29 +03:00
i915_getparam.c drm/i915/sseu: Disassociate internal subslice mask representation from uapi 2022-06-02 07:20:59 -07:00
i915_getparam.h drm/i915: split out i915_getparam.h from i915_drv.h 2022-01-10 15:43:05 +02:00
i915_gpu_error.c drm/i915/guc: Record CTB info in error logs 2022-08-17 10:06:59 -07:00
i915_gpu_error.h drm/i915/guc: Record CTB info in error logs 2022-08-17 10:06:59 -07:00
i915_ioc32.c drm/i915: split out i915_getparam.h from i915_drv.h 2022-01-10 15:43:05 +02:00
i915_ioc32.h
i915_ioctl.c drm/i915: split out i915_reg_read_ioctl() to i915_ioctl.[ch] 2022-01-21 09:59:22 +02:00
i915_ioctl.h drm/i915: split out i915_reg_read_ioctl() to i915_ioctl.[ch] 2022-01-21 09:59:22 +02:00
i915_iosf_mbi.h drm/i915: abstraction for iosf to compile on all archs 2021-10-27 00:32:01 -07:00
i915_irq.c drm/i915/reg: split out icl_dsi_regs.h 2022-02-21 12:06:15 +02:00
i915_irq.h drm/i915/hpd: hide struct intel_hotplug_funcs 2022-02-09 13:39:35 +02:00
i915_memcpy.c
i915_memcpy.h
i915_mitigations.c drm/i915: move the DRIVER_* macros to i915_driver.[ch] 2022-02-10 11:44:25 +02:00
i915_mitigations.h
i915_mm.c drm/i915: Skip remap_io_mapping() for non-x86 platforms 2021-12-08 13:26:14 -08:00
i915_mm.h drm/i915: Fix header test for !CONFIG_X86 2022-02-07 12:56:49 +00:00
i915_module.c Merge tag 'drm-intel-gt-next-2022-02-17' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-next 2022-02-23 15:03:51 -05:00
i915_params.c drm/i915/guc: Make GuC log sizes runtime configurable 2022-08-17 10:07:04 -07:00
i915_params.h drm/i915/guc: Make GuC log sizes runtime configurable 2022-08-17 10:07:04 -07:00
i915_pci.c drm/i915/mtl: Add MeteorLake PCI IDs 2022-07-08 13:25:33 -07:00
i915_pci.h drm/i915/pci: rename functions to have i915_pci prefix 2021-08-26 10:50:19 +03:00
i915_perf_oa_regs.h drm/i915/perf: Express OA register ranges with i915_range 2022-02-02 07:52:23 -08:00
i915_perf_types.h drm/i915: Fix CFI violation with show_dynamic_id() 2022-05-13 11:07:59 +01:00
i915_perf.c i915/perf: Disable OA sseu config param for gfx12.50+ 2022-07-08 08:27:36 -07:00
i915_perf.h drm/i915: Use a table for i915_init/exit (v2) 2021-07-22 12:05:17 +02:00
i915_pmu.c drm/i915/pmu: Drop redundant IS_VALLEYVIEW check in __get_rc6() 2022-04-06 15:47:38 +05:30
i915_pmu.h drm/i915: Use a table for i915_init/exit (v2) 2021-07-22 12:05:17 +02:00
i915_priolist_types.h
i915_pvinfo.h
i915_query.c drm/i915/uapi: expose the avail tracking 2022-07-01 08:29:59 +01:00
i915_query.h
i915_reg_defs.h drm/i915/gt: Remove GEN12_SFC_DONE_MAX from register defs header 2022-03-11 08:18:27 -08:00
i915_reg.h drm/i915: Prefer "XEHP_" prefix for registers 2022-06-27 07:44:25 -07:00
i915_request.c Revert "drm/i915: Hold reference to intel_context over life of i915_request" 2022-06-27 23:47:26 +05:30
i915_request.h drm/i915: Do not access rq->engine without a reference 2022-06-27 23:46:35 +05:30
i915_scatterlist.c drm/i915/ttm: fix 32b build 2022-07-13 16:06:08 +01:00
i915_scatterlist.h drm/i915/ttm: fix 32b build 2022-07-13 16:06:08 +01:00
i915_scheduler_types.h drm/i915/guc: Implement GuC priority management 2021-07-27 17:32:27 -07:00
i915_scheduler.c drm/i915: move scheduler slabs to direct module init/exit 2021-07-28 17:18:56 +02:00
i915_scheduler.h drm/i915: move scheduler slabs to direct module init/exit 2021-07-28 17:18:56 +02:00
i915_selftest.h drm/i915/guc: Add delay to disable scheduling after pin count goes to zero 2022-08-18 15:23:47 -07:00
i915_suspend.c drm/i915/fbc: Remove intel_fbc_global_disable() 2022-04-13 17:19:04 +03:00
i915_suspend.h
i915_sw_fence_work.c drm/i915: Drop stealing of bits from i915_sw_fence function pointer 2021-11-30 17:52:15 -08:00
i915_sw_fence_work.h drm/i915: Drop error handling from dma_fence_work 2021-07-16 21:47:39 +02:00
i915_sw_fence.c dma-buf: add enum dma_resv_usage v4 2022-04-07 12:53:53 +02:00
i915_sw_fence.h drm/i915: Drop stealing of bits from i915_sw_fence function pointer 2021-11-30 17:52:15 -08:00
i915_switcheroo.c drm/i915/driver: add i915_driver_ prefix to functions 2021-11-17 11:47:55 +02:00
i915_switcheroo.h
i915_syncmap.c
i915_syncmap.h
i915_sysfs.c drm/i915/gt: Fix memory leaks in per-gt sysfs 2022-05-26 09:37:05 +01:00
i915_sysfs.h drm/i915/gt: create per-tile sysfs interface 2022-03-21 08:37:39 +00:00
i915_trace_points.c
i915_trace.h drm/i915/trace: split out display trace to a separate file 2021-12-09 11:21:46 +02:00
i915_ttm_buddy_manager.c drm/i915/uapi: expose the avail tracking 2022-07-01 08:29:59 +01:00
i915_ttm_buddy_manager.h drm/i915/uapi: expose the avail tracking 2022-07-01 08:29:59 +01:00
i915_user_extensions.c
i915_user_extensions.h
i915_utils.c drm/i915: Move intel_vtd_active and run_as_guest to i915_utils 2022-03-30 12:04:01 +01:00
i915_utils.h drm/i915: Split i915_run_as_guest into x86 and non-x86 2022-04-06 09:02:37 -07:00
i915_vgpu.c drm/i915: Add object locking to i915_gem_evict_for_node and i915_gem_evict_something, v2. 2022-01-18 12:18:03 +01:00
i915_vgpu.h
i915_vma_resource.c drm/i915/gt: describe the new tlb parameter at i915_vma_resource 2022-07-28 14:02:27 +02:00
i915_vma_resource.h drm/i915/gt: Batch TLB invalidations 2022-07-28 14:02:14 +02:00
i915_vma_types.h drm/i915: Remove the vma refcount 2022-03-07 08:50:52 +01:00
i915_vma.c drm/i915: pass a pointer for tlb seqno at vma_invalidate_tlb() 2022-08-08 14:04:44 -04:00
i915_vma.h drm/i915: pass a pointer for tlb seqno at vma_invalidate_tlb() 2022-08-08 14:04:44 -04:00
intel_device_info.c drm/i915/mtl: Add MeteorLake PCI IDs 2022-07-08 13:25:33 -07:00
intel_device_info.h drm/i915/mtl: Add MeteorLake PCI IDs 2022-07-08 13:25:33 -07:00
intel_dram.c drm/i915/pcode: Extend pcode functions for multiple gt's 2022-05-20 09:11:27 +01:00
intel_dram.h
intel_gvt_mmio_table.c Merge tag 'gvt-next-2022-04-21-for-christoph' of https://github.com/intel/gvt-linux into drm-intel-next 2022-04-25 11:20:57 +03:00
intel_gvt.c drm/i915/gvt: Fix the compiling error when CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n 2022-04-28 17:01:17 -04:00
intel_gvt.h drm/i915/gvt: move the gvt code into kvmgt.ko 2022-04-21 07:36:56 -04:00
intel_mchbar_regs.h drm/i915: Clean up SSKPD/MLTR defines 2022-02-18 08:42:17 +02:00
intel_memory_region.c drm/i915: remove intel_memory_region avail 2022-07-01 08:29:59 +01:00
intel_memory_region.h drm/i915: remove intel_memory_region avail 2022-07-01 08:29:59 +01:00
intel_pch.c drm/i915: Move intel_vtd_active and run_as_guest to i915_utils 2022-03-30 12:04:01 +01:00
intel_pch.h drm for 5.18-rc1 2022-03-24 16:19:43 -07:00
intel_pci_config.h drm/i915: split out PCI config space registers from i915_reg.h 2022-01-10 16:17:46 +02:00
intel_pcode.c drm/i915/pcode: Add a couple of pcode helpers 2022-05-20 09:11:45 +01:00
intel_pcode.h drm/i915/pcode: Add a couple of pcode helpers 2022-05-20 09:11:45 +01:00
intel_pm_types.h drm/i915: split out intel_pm_types.h 2021-12-03 11:28:12 +02:00
intel_pm.c drm/i915/pvc: Add initial PVC workarounds 2022-05-31 14:44:58 -07:00
intel_pm.h drm/i915/display/adlp: Fix programing of PIPE_MBUS_DBOX_CTL 2022-03-30 13:34:46 -07:00
intel_region_ttm.c drm/i915/ttm: fix 32b build 2022-07-13 16:06:08 +01:00
intel_region_ttm.h drm/i915/ttm: fix 32b build 2022-07-13 16:06:08 +01:00
intel_runtime_pm.c drm/i915/selftests: Disable runtime pm wakeref tracking for the mock device 2022-02-11 13:22:10 +02:00
intel_runtime_pm.h drm/i915/selftests: Disable runtime pm wakeref tracking for the mock device 2022-02-11 13:22:10 +02:00
intel_sbi.c drm/i915: Only include i915_reg.h from .c files 2022-02-02 07:59:54 -08:00
intel_sbi.h drm/i915: rename intel_sideband.[ch] to intel_sbi.[ch] 2021-10-14 18:05:04 +03:00
intel_step.c drm/i915/pvc: Extract stepping information from PCI revid 2022-05-31 14:44:57 -07:00
intel_step.h drm/i915/pvc: Extract stepping information from PCI revid 2022-05-31 14:44:57 -07:00
intel_uncore.c drm/i915/gt: Move multicast register handling to a dedicated file 2022-06-17 08:05:12 -07:00
intel_uncore.h drm/i915/gt: Move multicast register handling to a dedicated file 2022-06-17 08:05:12 -07:00
intel_wakeref.c
intel_wakeref.h drm/i915/guc: Take engine PM when a context is pinned with GuC submission 2021-10-15 10:37:26 -07:00
intel_wopcm.c drm/i915/wopcm: Handle pre-programmed WOPCM registers 2022-01-26 11:47:24 -08:00
intel_wopcm.h
Kconfig Merge tag 'drm-intel-next-2022-05-20' of git://anongit.freedesktop.org/drm/drm-intel into drm-intel-gt-next 2022-05-23 09:34:47 +01:00
Kconfig.debug drm/i915: Improve debug Kconfig texts a bit 2021-07-06 10:10:07 +02:00
Kconfig.profile
Kconfig.unstable drm/i915: Kill the fake lmem support 2022-02-18 22:31:46 -08:00
Makefile drm/i915/gt: Re-do the intel-gtt split 2022-06-22 15:52:56 -07:00
TODO.txt
vlv_sideband_reg.h drm/i915: split out vlv sideband registers from i915_reg.h 2022-01-10 16:17:50 +02:00
vlv_sideband.c drm/i915: Only include i915_reg.h from .c files 2022-02-02 07:59:54 -08:00
vlv_sideband.h drm/i915: split out vlv sideband registers from i915_reg.h 2022-01-10 16:17:50 +02:00
vlv_suspend.c drm/i915: Use str_on_off() 2022-03-02 08:48:23 -08:00
vlv_suspend.h