linux/drivers/gpu/drm/i915/gt
Matthew Brost 12a9917e9e drm/i915/guc: Fix recursive lock in GuC submission
Use __release_guc_id (lock held) rather than release_guc_id (acquires
lock), add lockdep annotations.

213.280129] i915: Running i915_perf_live_selftests/live_noa_gpr
[ 213.283459] ============================================
[ 213.283462] WARNING: possible recursive locking detected
{{[ 213.283466] 5.15.0-rc6+ #18 Tainted: G U W }}
[ 213.283470] --------------------------------------------
[ 213.283472] kworker/u24:0/8 is trying to acquire lock:
[ 213.283475] ffff8ffc4f6cc1e8 (&guc->submission_state.lock){....}-{2:2}, at: destroyed_worker_func+0x2df/0x350 [i915]
{{[ 213.283618] }}
{{ but task is already holding lock:}}
[ 213.283621] ffff8ffc4f6cc1e8 (&guc->submission_state.lock){....}-{2:2}, at: destroyed_worker_func+0x4f/0x350 [i915]
{{[ 213.283720] }}
{{ other info that might help us debug this:}}
[ 213.283724] Possible unsafe locking scenario:[ 213.283727] CPU0
[ 213.283728] ----
[ 213.283730] lock(&guc->submission_state.lock);
[ 213.283734] lock(&guc->submission_state.lock);
{{[ 213.283737] }}
{{ *** DEADLOCK ***}}[ 213.283740] May be due to missing lock nesting notation[ 213.283744] 3 locks held by kworker/u24:0/8:
[ 213.283747] #0: ffff8ffb80059d38 ((wq_completion)events_unbound){..}-{0:0}, at: process_one_work+0x1f3/0x550
[ 213.283757] #1: ffffb509000e3e78 ((work_completion)(&guc->submission_state.destroyed_worker)){..}-{0:0}, at: process_one_work+0x1f3/0x550
[ 213.283766] #2: ffff8ffc4f6cc1e8 (&guc->submission_state.lock){....}-{2:2}, at: destroyed_worker_func+0x4f/0x350 [i915]
{{[ 213.283860] }}
{{ stack backtrace:}}
[ 213.283863] CPU: 8 PID: 8 Comm: kworker/u24:0 Tainted: G U W 5.15.0-rc6+ #18
[ 213.283868] Hardware name: ASUS System Product Name/PRIME B560M-A AC, BIOS 0403 01/26/2021
[ 213.283873] Workqueue: events_unbound destroyed_worker_func [i915]
[ 213.283957] Call Trace:
[ 213.283960] dump_stack_lvl+0x57/0x72
[ 213.283966] __lock_acquire.cold+0x191/0x2d3
[ 213.283972] lock_acquire+0xb5/0x2b0
[ 213.283978] ? destroyed_worker_func+0x2df/0x350 [i915]
[ 213.284059] ? destroyed_worker_func+0x2d7/0x350 [i915]
[ 213.284139] ? lock_release+0xb9/0x280
[ 213.284143] _raw_spin_lock_irqsave+0x48/0x60
[ 213.284148] ? destroyed_worker_func+0x2df/0x350 [i915]
[ 213.284226] destroyed_worker_func+0x2df/0x350 [i915]
[ 213.284310] process_one_work+0x270/0x550
[ 213.284315] worker_thread+0x52/0x3b0
[ 213.284319] ? process_one_work+0x550/0x550
[ 213.284322] kthread+0x135/0x160
[ 213.284326] ? set_kthread_struct+0x40/0x40
[ 213.284331] ret_from_fork+0x1f/0x30

and a bit later in the trace:

{{ 227.499864] do_raw_spin_lock+0x94/0xa0}}
[ 227.499868] _raw_spin_lock_irqsave+0x50/0x60
[ 227.499871] ? guc_flush_destroyed_contexts+0x4f/0xf0 [i915]
[ 227.499995] guc_flush_destroyed_contexts+0x4f/0xf0 [i915]
[ 227.500104] intel_guc_submission_reset_prepare+0x99/0x4b0 [i915]
[ 227.500209] ? mark_held_locks+0x49/0x70
[ 227.500212] intel_uc_reset_prepare+0x46/0x50 [i915]
[ 227.500320] reset_prepare+0x78/0x90 [i915]
[ 227.500412] __intel_gt_set_wedged.part.0+0x13/0xe0 [i915]
[ 227.500485] intel_gt_set_wedged.part.0+0x54/0x100 [i915]
[ 227.500556] intel_gt_set_wedged_on_fini+0x1a/0x30 [i915]
[ 227.500622] intel_gt_driver_unregister+0x1e/0x60 [i915]
[ 227.500694] i915_driver_remove+0x4a/0xf0 [i915]
[ 227.500767] i915_pci_probe+0x84/0x170 [i915]
[ 227.500838] local_pci_probe+0x42/0x80
[ 227.500842] pci_device_probe+0xd9/0x190
[ 227.500844] really_probe+0x1f2/0x3f0
[ 227.500847] __driver_probe_device+0xfe/0x180
[ 227.500848] driver_probe_device+0x1e/0x90
[ 227.500850] __driver_attach+0xc4/0x1d0
[ 227.500851] ? __device_attach_driver+0xe0/0xe0
[ 227.500853] ? __device_attach_driver+0xe0/0xe0
[ 227.500854] bus_for_each_dev+0x64/0x90
[ 227.500856] bus_add_driver+0x12e/0x1f0
[ 227.500857] driver_register+0x8f/0xe0
[ 227.500859] i915_init+0x1d/0x8f [i915]
[ 227.500934] ? 0xffffffffc144a000
[ 227.500936] do_one_initcall+0x58/0x2d0
[ 227.500938] ? rcu_read_lock_sched_held+0x3f/0x80
[ 227.500940] ? kmem_cache_alloc_trace+0x238/0x2d0
[ 227.500944] do_init_module+0x5c/0x270
[ 227.500946] __do_sys_finit_module+0x95/0xe0
[ 227.500949] do_syscall_64+0x38/0x90
[ 227.500951] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 227.500953] RIP: 0033:0x7ffa59d2ae0d
[ 227.500954] Code: c8 0c 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 3b 80 0c 00 f7 d8 64 89 01 48
[ 227.500955] RSP: 002b:00007fff320bbf48 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[ 227.500956] RAX: ffffffffffffffda RBX: 00000000022ea710 RCX: 00007ffa59d2ae0d
[ 227.500957] RDX: 0000000000000000 RSI: 00000000022e1d90 RDI: 0000000000000004
[ 227.500958] RBP: 0000000000000020 R08: 00007ffa59df3a60 R09: 0000000000000070
[ 227.500958] R10: 00000000022e1d90 R11: 0000000000000246 R12: 00000000022e1d90
[ 227.500959] R13: 00000000022e58e0 R14: 0000000000000043 R15: 00000000022e42c0

v2:
 (CI build)
  - Fix build error

Fixes: 1a52faed31 ("drm/i915/guc: Take GT PM ref when deregistering context")
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211020192147.8048-1-matthew.brost@intel.com
2021-10-22 14:54:59 -07:00
..
selftests
shaders
uc drm/i915/guc: Fix recursive lock in GuC submission 2021-10-22 14:54:59 -07:00
gen2_engine_cs.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
gen2_engine_cs.h
gen6_engine_cs.c drm/i915: Do not share hwsp across contexts any more, v8. 2021-03-24 11:38:56 +01:00
gen6_engine_cs.h
gen6_ppgtt.c drm/i915/gtt: drop unneeded make_unshrinkable 2021-10-22 13:19:22 +01:00
gen6_ppgtt.h drm/i915/gt: Replace unnecessary ',' with '; ' 2021-03-24 19:30:35 +01:00
gen6_renderstate.c drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
gen7_renderclear.c drm/i915/gt: Disable HiZ Raw Stall Optimization on broken gen7 2021-05-18 08:56:53 -04:00
gen7_renderclear.h
gen7_renderstate.c drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
gen8_engine_cs.c drm/i915/xehp: Extra media engines - Part 1 (engine definitions) 2021-07-24 07:16:50 -07:00
gen8_engine_cs.h
gen8_ppgtt.c drm/i915/gtt: drop unneeded make_unshrinkable 2021-10-22 13:19:22 +01:00
gen8_ppgtt.h drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
gen8_renderstate.c drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
gen9_renderstate.c drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
hsw_clear_kernel.c
intel_breadcrumbs_types.h drm/i915/guc: Direct all breadcrumbs for a class to single breadcrumbs 2021-07-27 17:31:35 -07:00
intel_breadcrumbs.c drm/i915/guc: Implement GuC priority management 2021-07-27 17:32:27 -07:00
intel_breadcrumbs.h drm/i915/guc: Direct all breadcrumbs for a class to single breadcrumbs 2021-07-27 17:31:35 -07:00
intel_context_param.h drm/i915/gem: Set the watchdog timeout directly in intel_context_set_gem (v2) 2021-07-08 19:43:49 +02:00
intel_context_sseu.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
intel_context_types.h drm/i915: Multi-BB execbuf 2021-10-15 10:45:50 -07:00
intel_context.c drm/i915/guc: Implement no mid batch preemption for multi-lrc 2021-10-15 10:45:50 -07:00
intel_context.h drm/i915: Multi-BB execbuf 2021-10-15 10:45:50 -07:00
intel_engine_cs.c drm/i915/guc: Connect UAPI to GuC multi-lrc interface 2021-10-15 10:45:50 -07:00
intel_engine_heartbeat.c drm/i915: remove IS_ACTIVE 2021-10-07 11:04:05 -07:00
intel_engine_heartbeat.h drm/i915: Reset GPU immediately if submission is disabled 2021-07-27 17:31:45 -07:00
intel_engine_pm.c drm/i915/guc: Don't call switch_to_kernel_context with GuC submission 2021-10-15 10:37:28 -07:00
intel_engine_pm.h drm/i915/guc: Take engine PM when a context is pinned with GuC submission 2021-10-15 10:37:26 -07:00
intel_engine_stats.h
intel_engine_types.h drm/i915: Add logical engine mapping 2021-10-15 10:37:29 -07:00
intel_engine_user.c drm/i915/guc: Implement GuC priority management 2021-07-27 17:32:27 -07:00
intel_engine_user.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_engine.h drm/i915/guc: Connect UAPI to GuC multi-lrc interface 2021-10-15 10:45:50 -07:00
intel_execlists_submission.c drm/i915/guc: Connect UAPI to GuC multi-lrc interface 2021-10-15 10:45:50 -07:00
intel_execlists_submission.h drm/i915/guc: GuC virtual engines 2021-07-27 17:31:28 -07:00
intel_ggtt_fencing.c drm/i915/gt: Fix -EDEADLK handling regression 2021-07-13 15:56:21 -04:00
intel_ggtt_fencing.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_ggtt.c Merge tag 'drm-intel-gt-next-2021-10-08' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-10-11 18:09:39 +10:00
intel_gpu_commands.h drm/i915/pxp: Implement arb session teardown 2021-10-04 13:10:50 -04:00
intel_gt_buffer_pool_types.h Merge tag 'drm-intel-gt-next-2021-04-06' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-04-08 12:46:12 +10:00
intel_gt_buffer_pool.c drm/i915: Flush buffer pools on driver remove 2021-09-24 19:56:30 -07:00
intel_gt_buffer_pool.h drm/i915: Defer pin calls in buffer pool until first use by caller. 2021-03-24 17:27:20 +01:00
intel_gt_clock_utils.c drm/i915/gt: remove GRAPHICS_VER == 10 2021-07-29 10:06:10 -07:00
intel_gt_clock_utils.h
intel_gt_debugfs.c drm/i915/gt: move remaining debugfs interfaces into gt 2021-10-14 21:47:49 -07:00
intel_gt_debugfs.h drm/i915/gt: move remaining debugfs interfaces into gt 2021-10-14 21:47:49 -07:00
intel_gt_engines_debugfs.c drm/i915: rename debugfs_engines files 2021-09-18 23:33:22 -07:00
intel_gt_engines_debugfs.h drm/i915: rename debugfs_engines files 2021-09-18 23:33:22 -07:00
intel_gt_irq.c drm/i915/pxp: Implement PXP irq handler 2021-10-04 13:10:55 -04:00
intel_gt_irq.h drm/i915/gt: Move CS interrupt handler to the backend 2021-05-25 15:14:40 +02:00
intel_gt_pm_debugfs.c Merge tag 'drm-intel-gt-next-2021-10-21' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-10-22 06:30:34 +10:00
intel_gt_pm_debugfs.h drm/i915/gt: move remaining debugfs interfaces into gt 2021-10-14 21:47:49 -07:00
intel_gt_pm_irq.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
intel_gt_pm_irq.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_gt_pm.c drm/i915/pxp: Enable PXP power management 2021-10-04 13:11:11 -04:00
intel_gt_pm.h drm/i915/guc: Take engine PM when a context is pinned with GuC submission 2021-10-15 10:37:26 -07:00
intel_gt_requests.c drm/i915/guc: Update intel_gt_wait_for_idle to work with GuC 2021-07-22 10:07:23 -07:00
intel_gt_requests.h drm/i915: use linux/stddef.h due to "isystem: trim/fixup stdarg.h and other headers" 2021-09-06 09:31:23 +02:00
intel_gt_types.h drm/i915/pxp: allocate a vcs context for pxp usage 2021-10-04 13:10:28 -04:00
intel_gt.c drm/i915/pxp: allocate a vcs context for pxp usage 2021-10-04 13:10:28 -04:00
intel_gt.h drm/i915/guc: Update intel_gt_wait_for_idle to work with GuC 2021-07-22 10:07:23 -07:00
intel_gtt.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
intel_gtt.h drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
intel_llc_types.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_llc.c Merge tag 'drm-intel-gt-next-2021-10-21' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-10-22 06:30:34 +10:00
intel_llc.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_lrc_reg.h drm/i915/guc: Implement GuC context operations for new inteface 2021-07-22 10:07:08 -07:00
intel_lrc.c drm/i915/guc: Add multi-lrc context registration 2021-10-15 10:37:34 -07:00
intel_lrc.h
intel_migrate_types.h drm/i915/gt: Pipelined page migration 2021-06-17 14:23:05 +01:00
intel_migrate.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
intel_migrate.h drm/i915/gt: Pipelined clear 2021-06-17 14:23:09 +01:00
intel_mocs.c drm/i915/gt: Add "intel_" as prefix in set_mocs_index() 2021-09-20 08:23:27 -07:00
intel_mocs.h drm/i915/gt: Add "intel_" as prefix in set_mocs_index() 2021-09-20 08:23:27 -07:00
intel_ppgtt.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
intel_rc6_types.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_rc6.c drm/i915: split out intel_pcode.[ch] to separate file 2021-10-14 18:04:17 +03:00
intel_rc6.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_region_lmem.c drm/i915: Use direction definition DMA_BIDIRECTIONAL instead of PCI_DMA_BIDIRECTIONAL 2021-09-30 16:19:45 +02:00
intel_region_lmem.h drm/i915: setup the LMEM region 2021-03-24 19:30:36 +01:00
intel_renderstate.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
intel_renderstate.h drm/i915: Break out dma_resv ww locking utilities to separate files 2021-06-17 14:22:59 +01:00
intel_reset_types.h drm/i915/gt: Remove repeated words from comments 2021-03-24 19:30:35 +01:00
intel_reset.c drm/i915/guc: Implement banned contexts for GuC submission 2021-07-27 17:32:12 -07:00
intel_reset.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_ring_submission.c drm/i915: Replace the unconditional clflush with drm_clflush_virt_range() 2021-10-18 12:44:41 +03:00
intel_ring_types.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_ring.c drm/i915: Don't back up pinned LMEM context images and rings during suspend 2021-09-24 08:19:15 +02:00
intel_ring.h drm/i915/gt: Pipelined page migration 2021-06-17 14:23:05 +01:00
intel_rps_types.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
intel_rps.c drm/i915: split out intel_pcode.[ch] to separate file 2021-10-14 18:04:17 +03:00
intel_rps.h drm/i915/xehpsdv: factor out function to read RP_STATE_CAP 2021-08-12 16:06:56 -07:00
intel_sseu_debugfs.c drm/i915: rename debugfs_gt files 2021-09-18 23:33:19 -07:00
intel_sseu_debugfs.h
intel_sseu.c drm/i915/xehp: Check new fuse bits for SFC availability 2021-09-20 21:42:09 -07:00
intel_sseu.h drm/i915/xehpsdv: Add compute DSS type 2021-08-11 08:21:49 -07:00
intel_timeline_types.h Merge tag 'drm-intel-gt-next-2021-04-06' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-04-08 12:46:12 +10:00
intel_timeline.c drm/i915: Catch yet another unconditioal clflush 2021-10-18 12:45:19 +03:00
intel_timeline.h Merge tag 'drm-intel-gt-next-2021-04-06' of git://anongit.freedesktop.org/drm/drm-intel into drm-next 2021-04-08 12:46:12 +10:00
intel_workarounds_types.h drm/i915/guc: Provide mmio list to be saved/restored on engine reset 2021-07-27 17:31:55 -07:00
intel_workarounds.c drm/i915: Make wa list per-gt 2021-09-20 08:06:36 -07:00
intel_workarounds.h drm/i915: Make wa list per-gt 2021-09-20 08:06:36 -07:00
ivb_clear_kernel.c
mock_engine.c drm/i915/gt: Register the migrate contexts with their engines 2021-09-24 08:19:13 +02:00
mock_engine.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
selftest_context.c drm/i915/guc: Disable engine barriers with GuC during unpin 2021-07-22 10:07:15 -07:00
selftest_engine_cs.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
selftest_engine_heartbeat.c drm/i915: remove IS_ACTIVE 2021-10-07 11:04:05 -07:00
selftest_engine_heartbeat.h drm/i915/selftest: Fix hangcheck self test for GuC submission 2021-07-27 17:32:23 -07:00
selftest_engine_pm.c drm/i915/selftest: Extend ctx_timestamp ICL workaround to GEN11 2021-06-25 12:08:35 +01:00
selftest_engine.c drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
selftest_engine.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
selftest_execlists.c drm/i915/guc: Connect UAPI to GuC multi-lrc interface 2021-10-15 10:45:50 -07:00
selftest_gt_pm.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
selftest_hangcheck.c drm/i915: Reduce the number of objects subject to memcpy recover 2021-09-24 08:19:16 +02:00
selftest_llc.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
selftest_llc.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
selftest_lrc.c drm/i915: Move submission tasklet to i915_sched_engine 2021-06-18 15:14:42 -07:00
selftest_migrate.c drm/i915/gt: Setup a default migration context on the GT 2021-06-17 14:23:11 +01:00
selftest_mocs.c drm/i915/selftest: Fix hangcheck self test for GuC submission 2021-07-27 17:32:23 -07:00
selftest_rc6.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
selftest_rc6.h drm/i915/gt: SPDX cleanup 2021-03-24 19:30:34 +01:00
selftest_reset.c drm/i915: Move submission tasklet to i915_sched_engine 2021-06-18 15:14:42 -07:00
selftest_ring_submission.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
selftest_ring.c
selftest_rps.c drm/i915/gt: replace IS_GEN and friends with GRAPHICS_VER 2021-06-05 15:09:06 -07:00
selftest_rps.h
selftest_slpc.c drm/i915/guc/slpc: Add SLPC selftest 2021-08-03 16:05:42 -07:00
selftest_timeline.c drm/i915: Stop storing the ring size in the ring pointer (v3) 2021-07-08 19:43:35 +02:00
selftest_workarounds.c drm/i915: Make wa list per-gt 2021-09-20 08:06:36 -07:00
shmem_utils.c drm/i915/dg1: Fix mapping type for default state object 2021-04-27 16:19:52 +01:00
shmem_utils.h
st_shmem_utils.c
sysfs_engines.c
sysfs_engines.h