drm/xe/exec: move fence reservation
authorMatthew Auld <matthew.auld@intel.com>
Wed, 13 Dec 2023 17:47:04 +0000 (17:47 +0000)
committerMatthew Auld <matthew.auld@intel.com>
Tue, 9 Jan 2024 14:26:58 +0000 (14:26 +0000)
commit29f424eb8702b686cb6f07ddd659c6312e0c796d
treeaffd6094b18a5ad4e1a818247c362adf49667ae7
parentfa78e188d8d1df850eb232a2631012093aeeb0e0
drm/xe/exec: move fence reservation

We currently assume that we can upfront know exactly how many fence
slots we will need at the start of the exec, however the TTM bo_validate
can itself consume numerous fence slots, and due to how the
dma_resv_reserve_fences() works it only ensures that at least that many
fence slots are available. With this it is quite possible that TTM
steals some of the fence slots and then when it comes time to do the vma
binding and final exec stage we are lacking enough fence slots, leading
to some nasty BUG_ON(). A simple fix is to reserve our own fences later,
after the validate stage.

References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/698
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Tested-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
drivers/gpu/drm/xe/xe_exec.c